Skip to content

Commit cd5cd90

Browse files
committed
docs(no-restricted-syntax): require access modifiers example
1 parent b7c72e3 commit cd5cd90

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

docs/rules/no-restricted-syntax.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,5 +373,11 @@ class Test {
373373
abstract Test(): void;
374374
}
375375
// "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"}]}]
376+
377+
/**
378+
* @private
379+
*/
380+
function quux () {}
381+
// "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"}]}]
376382
````
377383

test/rules/assertions/noRestrictedSyntax.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,5 +1042,24 @@ export default {
10421042
],
10431043
parser: require.resolve('@typescript-eslint/parser'),
10441044
},
1045+
{
1046+
code: `
1047+
/**
1048+
* @private
1049+
*/
1050+
function quux () {}
1051+
`,
1052+
options: [
1053+
{
1054+
contexts: [
1055+
{
1056+
comment: 'JsdocBlock:not(JsdocBlock:has(JsdocTag[tag=/private|protected|public/]))',
1057+
context: 'any',
1058+
message: 'Access modifier tags must be present',
1059+
},
1060+
],
1061+
},
1062+
],
1063+
},
10451064
],
10461065
};

0 commit comments

Comments
 (0)