Skip to content

Commit

Permalink
chore: update jsdoccomment demonstrating alpha.2 fix and workaround for
Browse files Browse the repository at this point in the history
  • Loading branch information
brettz9 committed May 30, 2021
1 parent 4dee416 commit 6e9f4df
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 5 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8505,6 +8505,14 @@ function quux () {

}
// Message: Rule `no-restricted-syntax` is missing a `context` option.

/**
* @param opt_a
* @param opt_b
*/
function a () {}
// "jsdoc/no-restricted-syntax": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock:has(JsdocTag[name=/opt_/])","context":"FunctionDeclaration","message":"Only allowing names not matching `/^opt_/i`."}]}]
// Message: Only allowing names not matching `/^opt_/i`.
````

The following patterns are not considered problems:
Expand Down
10 changes: 5 additions & 5 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.8.0-alpha.1",
"@es-joy/jsdoccomment": "^0.8.0-alpha.2",
"comment-parser": "1.1.5",
"debug": "^4.3.1",
"esquery": "^1.4.0",
Expand All @@ -19,14 +19,14 @@
"devDependencies": {
"@babel/cli": "^7.14.3",
"@babel/core": "^7.14.3",
"@babel/eslint-parser": "^7.14.3",
"@babel/eslint-parser": "^7.14.4",
"@babel/node": "^7.14.2",
"@babel/plugin-syntax-class-properties": "^7.12.13",
"@babel/plugin-transform-flow-strip-types": "^7.13.0",
"@babel/preset-env": "^7.14.2",
"@babel/preset-env": "^7.14.4",
"@babel/register": "^7.13.16",
"@hkdobrev/run-if-changed": "^0.3.1",
"@typescript-eslint/parser": "^4.24.0",
"@typescript-eslint/parser": "^4.25.0",
"babel-plugin-add-module-exports": "^1.0.4",
"babel-plugin-istanbul": "^6.0.0",
"chai": "^4.3.4",
Expand All @@ -42,7 +42,7 @@
"open-editor": "^3.0.0",
"rimraf": "^3.0.2",
"semantic-release": "^17.4.3",
"typescript": "^4.2.4"
"typescript": "^4.3.2"
},
"engines": {
"node": ">=12"
Expand Down
22 changes: 22 additions & 0 deletions test/rules/assertions/noRestrictedSyntax.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,28 @@ export default {
},
],
},
{
code: `
/**
* @param opt_a
* @param opt_b
*/
function a () {}
`,
errors: [{
line: 2,
message: 'Only allowing names not matching `/^opt_/i`.',
}],
options: [{
contexts: [
{
comment: 'JsdocBlock:has(JsdocTag[name=/opt_/])',
context: 'FunctionDeclaration',
message: 'Only allowing names not matching `/^opt_/i`.',
},
],
}],
},
],
valid: [
{
Expand Down

0 comments on commit 6e9f4df

Please sign in to comment.