Skip to content

Commit

Permalink
docs(no-restricted-syntax): require access modifiers example
Browse files Browse the repository at this point in the history
  • Loading branch information
brettz9 committed Jun 4, 2023
1 parent 9efe6d0 commit 483010a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/rules/no-restricted-syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -373,5 +373,11 @@ class Test {
abstract Test(): void;
}
// "jsdoc/no-restricted-syntax": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock:not(*:has(JsdocTag[tag=/returns/]))","context":"TSEmptyBodyFunctionExpression[returnType.typeAnnotation.type!=/TSVoidKeyword|TSUndefinedKeyword/]","message":"methods with non-void return types must have a @returns tag"}]}]

/**
* @private
*/
function quux () {}
// "jsdoc/no-restricted-syntax": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock:not(JsdocBlock:has(JsdocTag[tag=/private|protected|public/]))","context":"any","message":"Access modifier tags must be present"}]}]
````

19 changes: 19 additions & 0 deletions test/rules/assertions/noRestrictedSyntax.js
Original file line number Diff line number Diff line change
Expand Up @@ -1042,5 +1042,24 @@ export default {
],
parser: require.resolve('@typescript-eslint/parser'),
},
{
code: `
/**
* @private
*/
function quux () {}
`,
options: [
{
contexts: [
{
comment: 'JsdocBlock:not(JsdocBlock:has(JsdocTag[tag=/private|protected|public/]))',
context: 'any',
message: 'Access modifier tags must be present',
},
],
},
],
},
],
};

0 comments on commit 483010a

Please sign in to comment.