Skip to content

Commit

Permalink
chore: update jsdoctypeparser
Browse files Browse the repository at this point in the history
BREAKING CHANGE:

1. Adds spaces between union items per jsdoctypeparser update.
2. Removes JSDuck support (unions with "/" instead of "|")

Also adds support in typescript mode for `readonly` and intersections (`X & Y`)
  • Loading branch information
brettz9 committed Jul 8, 2020
1 parent 5409f25 commit 96dcdce
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 25 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3469,23 +3469,23 @@ function quux () {
// Message: Invalid JSDoc @returns type "Number"; prefer: "number".

/**
* @param {(Number|string|Boolean)=} foo
* @param {(Number | string | Boolean)=} foo
*/
function quux (foo, bar, baz) {

}
// Message: Invalid JSDoc @param "foo" type "Number"; prefer: "number".

/**
* @param {Array.<Number|String>} foo
* @param {Array.<Number | String>} foo
*/
function quux (foo, bar, baz) {

}
// Message: Invalid JSDoc @param "foo" type "Number"; prefer: "number".

/**
* @param {(Number|String)[]} foo
* @param {(Number | String)[]} foo
*/
function quux (foo, bar, baz) {

Expand Down Expand Up @@ -3984,7 +3984,7 @@ function quux () {}
// Message: Invalid JSDoc @typedef "foo" type "object"; prefer: "Object<>".

/**
* @param {Array<number|undefined>} foo
* @param {Array<number | undefined>} foo
*/
function quux (foo) {

Expand Down Expand Up @@ -4015,7 +4015,7 @@ function quux (foo, bar, baz) {
}

/**
* @param {(number|string|boolean)=} foo
* @param {(number | string | boolean)=} foo
*/
function quux (foo, bar, baz) {

Expand Down Expand Up @@ -13558,10 +13558,10 @@ function quux() {
// Message: Tag @type must have a type
/**
* @modifies {bar|foo<}
* @modifies {bar | foo<}
*/
function quux (foo, bar, baz) {}
// Message: Syntax error in type: bar|foo<
// Message: Syntax error in type: bar | foo<
/**
* @private {BadTypeChecked<}
Expand Down Expand Up @@ -13771,17 +13771,17 @@ function quux() {
// Settings: {"jsdoc":{"mode":"closure"}}
/**
* @typedef {number|string} UserDefinedType
* @typedef {number | string} UserDefinedType
*/
/**
* @typedef {number|string}
* @typedef {number | string}
*/
let UserDefinedGCCType;
// Settings: {"jsdoc":{"mode":"closure"}}
/**
* @modifies {foo|bar}
* @modifies {foo | bar}
*/
function quux (foo, bar, baz) {}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"dependencies": {
"comment-parser": "^0.7.5",
"debug": "^4.1.1",
"jsdoctypeparser": "^7.0.0",
"jsdoctypeparser": "^8.0.0",
"lodash": "^4.17.15",
"regextras": "^0.7.1",
"semver": "^7.3.2",
Expand Down
18 changes: 9 additions & 9 deletions test/rules/assertions/checkTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export default {
{
code: `
/**
* @param {(Number|string|Boolean)=} foo
* @param {(Number | string | Boolean)=} foo
*/
function quux (foo, bar, baz) {
Expand All @@ -122,7 +122,7 @@ export default {
],
output: `
/**
* @param {(number|string|boolean)=} foo
* @param {(number | string | boolean)=} foo
*/
function quux (foo, bar, baz) {
Expand All @@ -132,7 +132,7 @@ export default {
{
code: `
/**
* @param {Array.<Number|String>} foo
* @param {Array.<Number | String>} foo
*/
function quux (foo, bar, baz) {
Expand All @@ -150,7 +150,7 @@ export default {
],
output: `
/**
* @param {Array.<number|string>} foo
* @param {Array.<number | string>} foo
*/
function quux (foo, bar, baz) {
Expand All @@ -160,7 +160,7 @@ export default {
{
code: `
/**
* @param {(Number|String)[]} foo
* @param {(Number | String)[]} foo
*/
function quux (foo, bar, baz) {
Expand All @@ -178,7 +178,7 @@ export default {
],
output: `
/**
* @param {(number|string)[]} foo
* @param {(number | string)[]} foo
*/
function quux (foo, bar, baz) {
Expand Down Expand Up @@ -1896,7 +1896,7 @@ export default {
{
code: `
/**
* @param {Array<number|undefined>} foo
* @param {Array<number | undefined>} foo
*/
function quux (foo) {
Expand All @@ -1909,7 +1909,7 @@ export default {
],
output: `
/**
* @param {(number|undefined)[]} foo
* @param {(number | undefined)[]} foo
*/
function quux (foo) {
Expand Down Expand Up @@ -1953,7 +1953,7 @@ export default {
{
code: `
/**
* @param {(number|string|boolean)=} foo
* @param {(number | string | boolean)=} foo
*/
function quux (foo, bar, baz) {
Expand Down
10 changes: 5 additions & 5 deletions test/rules/assertions/validTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,13 +253,13 @@ export default {
{
code: `
/**
* @modifies {bar|foo<}
* @modifies {bar | foo<}
*/
function quux (foo, bar, baz) {}
`,
errors: [
{
message: 'Syntax error in type: bar|foo<',
message: 'Syntax error in type: bar | foo<',
},
],
},
Expand Down Expand Up @@ -655,14 +655,14 @@ export default {
{
code: `
/**
* @typedef {number|string} UserDefinedType
* @typedef {number | string} UserDefinedType
*/
`,
},
{
code: `
/**
* @typedef {number|string}
* @typedef {number | string}
*/
let UserDefinedGCCType;
`,
Expand All @@ -675,7 +675,7 @@ export default {
{
code: `
/**
* @modifies {foo|bar}
* @modifies {foo | bar}
*/
function quux (foo, bar, baz) {}
`,
Expand Down

0 comments on commit 96dcdce

Please sign in to comment.