Skip to content

Commit

Permalink
fix: update comment-parser to surface restoration of support for eq…
Browse files Browse the repository at this point in the history
…ual signs in defaults and multi-line types; fixes #669; fixes #673
  • Loading branch information
brettz9 committed Jan 17, 2021
1 parent 8de40d3 commit 081d7eb
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 8 deletions.
16 changes: 16 additions & 0 deletions README.md
Expand Up @@ -11381,6 +11381,13 @@ function quux (foo) {
* @callback
* @param
*/

/**
* @param {Function} [processor=data => data] A function to run
*/
function processData(processor) {
return processor(data)
}
````


Expand Down Expand Up @@ -13318,6 +13325,15 @@ The following patterns are not considered problems:
* @class
* @property foo Foo.
*/

/**
* Typedef with multi-line property type.
*
* @typedef {object} MyType
* @property {function(
* number
* )} numberEater Method which takes a number.
*/
````


Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -5,7 +5,7 @@
"url": "http://gajus.com"
},
"dependencies": {
"comment-parser": "1.0.1",
"comment-parser": "1.1.0",
"debug": "^4.3.1",
"jsdoctypeparser": "^9.0.0",
"lodash": "^4.17.20",
Expand Down
15 changes: 8 additions & 7 deletions src/iterateJsdoc.js
@@ -1,13 +1,14 @@
import {
parse as commentParser, stringify as commentStringify,
} from 'comment-parser';
import getSpacer from 'comment-parser/lib/parser/spacer';
import {
tagTokenizer,
typeTokenizer,
nameTokenizer,
descriptionTokenizer,
} from 'comment-parser/lib/parser/spec-parser';
// eslint-disable-next-line import/no-named-default
default as descriptionTokenizer,
getJoiner,
} from 'comment-parser/lib/parser/tokenizers/description';
import nameTokenizer from 'comment-parser/lib/parser/tokenizers/name';
import tagTokenizer from 'comment-parser/lib/parser/tokenizers/tag';
import typeTokenizer from 'comment-parser/lib/parser/tokenizers/type';
import {
rewireSpecs,
seedBlock,
Expand Down Expand Up @@ -83,7 +84,7 @@ const getTokenizers = () => {

// Description
(spec) => {
return descriptionTokenizer(getSpacer('preserve'))(spec);
return descriptionTokenizer(getJoiner('preserve'))(spec);
},
];
};
Expand Down
10 changes: 10 additions & 0 deletions test/rules/assertions/requireParamName.js
Expand Up @@ -161,5 +161,15 @@ export default {
*/
`,
},
{
code: `
/**
* @param {Function} [processor=data => data] A function to run
*/
function processData(processor) {
return processor(data)
}
`,
},
],
};
12 changes: 12 additions & 0 deletions test/rules/assertions/requirePropertyDescription.js
Expand Up @@ -89,5 +89,17 @@ export default {
*/
`,
},
{
code: `
/**
* Typedef with multi-line property type.
*
* @typedef {object} MyType
* @property {function(
* number
* )} numberEater Method which takes a number.
*/
`,
},
],
};

0 comments on commit 081d7eb

Please sign in to comment.