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 25, 2023
1 parent 42a97c8 commit 1008047
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 1008047

Please sign in to comment.