Skip to content

Commit

Permalink
docs(no-restricted-syntax): add example for insisting on a tag in a…
Browse files Browse the repository at this point in the history
… block; fixes #936
  • Loading branch information
brettz9 committed Dec 9, 2022
1 parent 462f96d commit 686305d
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9656,6 +9656,12 @@ const MyComponent = ({ children }) => {
* @param sth Param text followed by no newline */
// "jsdoc/no-restricted-syntax": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock[descriptionStartLine=0][hasPreterminalTagDescription=1]","context":"any","message":"Requiring descriptive text on 0th line but no preterminal description"}]}]
// Message: Requiring descriptive text on 0th line but no preterminal description

/**
*
*/
// "jsdoc/no-restricted-syntax": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock:not(*:has(JsdocTag[tag=see]))","context":"any","message":"@see required on each block"}]}]
// Message: @see required on each block
````

The following patterns are not considered problems:
Expand Down
24 changes: 24 additions & 0 deletions test/rules/assertions/noRestrictedSyntax.js
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,30 @@ export default {
},
],
},
{
code: `
/**
*
*/
`,
errors: [
{
line: 2,
message: '@see required on each block',
},
],
options: [
{
contexts: [
{
comment: 'JsdocBlock:not(*:has(JsdocTag[tag=see]))',
context: 'any',
message: '@see required on each block',
},
],
},
],
},
],
valid: [
{
Expand Down

0 comments on commit 686305d

Please sign in to comment.