Skip to content

Commit

Permalink
fix(no-defaults): adjust fixed AST to fully unset default as new …
Browse files Browse the repository at this point in the history
…`comment-parser` adjustment would otherwise not wholly remove the default; also updates devDeps and tests use of opening jsdoc; fixes #568
  • Loading branch information
brettz9 committed Aug 16, 2020
1 parent 3b643de commit 5cbc823
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
8 changes: 8 additions & 0 deletions README.md
Expand Up @@ -11854,6 +11854,14 @@ function quux ({"foo": bar}) {
function quux ({foo: bar}) {

}

/**
* Description.
* @param {string} b Description `/**`.
*/
module.exports = function a(b) {
console.info(b);
};
````


Expand Down
6 changes: 3 additions & 3 deletions package.json
Expand Up @@ -5,10 +5,10 @@
"url": "http://gajus.com"
},
"dependencies": {
"comment-parser": "^0.7.5",
"comment-parser": "^0.7.6",
"debug": "^4.1.1",
"jsdoctypeparser": "^9.0.0",
"lodash": "^4.17.19",
"lodash": "^4.17.20",
"regextras": "^0.7.1",
"semver": "^7.3.2",
"spdx-expression-parse": "^3.0.1"
Expand All @@ -27,7 +27,7 @@
"babel-plugin-istanbul": "^6.0.0",
"chai": "^4.2.0",
"cross-env": "^7.0.2",
"eslint": "7.6.0",
"eslint": "7.7.0",
"eslint-config-canonical": "^23.0.0",
"gitdown": "^3.1.3",
"glob": "^7.1.6",
Expand Down
4 changes: 2 additions & 2 deletions src/rules/noDefaults.js
Expand Up @@ -9,12 +9,12 @@ export default iterateJsdoc(({
paramTags.forEach((tag) => {
if (noOptionalParamNames && tag.optional) {
utils.reportJSDoc(`Optional param names are not permitted on @${tag.tag}.`, tag, () => {
tag.default = '';
tag.default = undefined;
tag.optional = false;
});
} else if (tag.default) {
utils.reportJSDoc(`Defaults are not permitted on @${tag.tag}.`, tag, () => {
tag.default = '';
tag.default = undefined;
});
}
});
Expand Down
11 changes: 11 additions & 0 deletions test/rules/assertions/requireParam.js
Expand Up @@ -2843,5 +2843,16 @@ export default {
}
`,
},
{
code: `
/**
* Description.
* @param {string} b Description \`/**\`.
*/
module.exports = function a(b) {
console.info(b);
};
`,
},
],
};

0 comments on commit 5cbc823

Please sign in to comment.