Skip to content

Commit

Permalink
fix(no-restricted-syntax, no-missing-syntax): update jsdoccomment…
Browse files Browse the repository at this point in the history
… to avoid breaking on bad types (at least until jsdoc-type-pratt-parser may support all expected); fixes #842

Also updates devDep.
  • Loading branch information
brettz9 committed Feb 18, 2022
1 parent 51b58ce commit 06c3163
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9261,6 +9261,12 @@ const MY_ENUM = Object.freeze({
VAL_A: "myvala"
} as const);
// "jsdoc/no-restricted-syntax": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock[postDelimiter=\"\"]:has(JsdocTag ~ JsdocTag[tag=/private|protected/])","context":"any","message":"Access modifier tags must come first"},{"comment":"JsdocBlock[postDelimiter=\"\"]:has(JsdocTag[tag=\"enum\"])","context":":declaration:not(TSEnumDeclaration):not(:has(ObjectExpression)), :function","message":"@enum is only allowed on potential enum types"}]}]
/**
* @param {(...args: any[]) => any} fn
* @returns {(...args: any[]) => any}
*/
// "jsdoc/no-restricted-syntax": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock:has(JsdocTag[tag=\"type\"]:has([value=/FunctionComponent/]))","context":"any","message":"The `FunctionComponent` type is not allowed. Please use `FC` instead."}]}]
````
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"url": "http://gajus.com"
},
"dependencies": {
"@es-joy/jsdoccomment": "~0.20.0",
"@es-joy/jsdoccomment": "~0.20.1",
"comment-parser": "1.3.0",
"debug": "^4.3.3",
"escape-string-regexp": "^4.0.0",
Expand All @@ -17,7 +17,7 @@
"description": "JSDoc linting rules for ESLint.",
"devDependencies": {
"@babel/cli": "^7.17.3",
"@babel/core": "^7.17.4",
"@babel/core": "^7.17.5",
"@babel/eslint-parser": "^7.17.0",
"@babel/node": "^7.16.8",
"@babel/plugin-syntax-class-properties": "^7.12.13",
Expand Down
19 changes: 19 additions & 0 deletions test/rules/assertions/noRestrictedSyntax.js
Original file line number Diff line number Diff line change
Expand Up @@ -471,5 +471,24 @@ export default {
],
parser: require.resolve('@typescript-eslint/parser'),
},
{
code: `
/**
* @param {(...args: any[]) => any} fn
* @returns {(...args: any[]) => any}
*/
`,
options: [
{
contexts: [
{
comment: 'JsdocBlock:has(JsdocTag[tag="type"]:has([value=/FunctionComponent/]))',
context: 'any',
message: 'The `FunctionComponent` type is not allowed. Please use `FC` instead.',
},
],
},
],
},
],
};

0 comments on commit 06c3163

Please sign in to comment.