Skip to content

Commit

Permalink
test(require-description): context: 'any' checks
Browse files Browse the repository at this point in the history
  • Loading branch information
brettz9 committed May 30, 2021
1 parent dc641cc commit 4216249
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 0 deletions.
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10632,6 +10632,16 @@ class quux {
// Settings: {"jsdoc":{"implementsReplacesDocs":false}}
// "jsdoc/require-description": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock[postDelimiter=\"\"]:has(JsdocTag[tag=\"implements\"])","context":"ClassDeclaration"}],"descriptionStyle":"tag"}]
// Message: Missing JSDoc @description declaration.

/**
* @implements {Bar}
*/
class quux {

}
// Settings: {"jsdoc":{"implementsReplacesDocs":false}}
// "jsdoc/require-description": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock[postDelimiter=\"\"]:has(JsdocTag[tag=\"implements\"])","context":"any"}],"descriptionStyle":"tag"}]
// Message: Missing JSDoc @description declaration.
````

The following patterns are not considered problems:
Expand Down Expand Up @@ -10847,6 +10857,21 @@ class quux {

}
// "jsdoc/require-description": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock[postDelimiter=\"\"]:has(JsdocTag[rawType=\"{Bar}\"])","context":"ClassDeclaration"}],"descriptionStyle":"tag"}]

/**
* Has some
* description already.
*/
class quux {

}
// "jsdoc/require-description": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock[postDelimiter=\"\"]:has(JsdocTag[rawType=\"{Bar}\"])","context":"any"}],"descriptionStyle":"tag"}]

/**
* Has some
* description already.
*/
// "jsdoc/require-description": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock[postDelimiter=\"\"]:has(JsdocTag[rawType=\"{Bar}\"])","context":"any"}],"descriptionStyle":"tag"}]
````


Expand Down
73 changes: 73 additions & 0 deletions test/rules/assertions/requireDescription.js
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,38 @@ export default {
},
},
},
{
code: `
/**
* @implements {Bar}
*/
class quux {
}
`,
errors: [
{
line: 2,
message: 'Missing JSDoc @description declaration.',
},
],
options: [
{
contexts: [
{
comment: 'JsdocBlock[postDelimiter=""]:has(JsdocTag[tag="implements"])',
context: 'any',
},
],
descriptionStyle: 'tag',
},
],
settings: {
jsdoc: {
implementsReplacesDocs: false,
},
},
},
],
valid: [
{
Expand Down Expand Up @@ -1059,5 +1091,46 @@ export default {
},
],
},
{
code: `
/**
* Has some
* description already.
*/
class quux {
}
`,
options: [
{
contexts: [
{
comment: 'JsdocBlock[postDelimiter=""]:has(JsdocTag[rawType="{Bar}"])',
context: 'any',
},
],
descriptionStyle: 'tag',
},
],
},
{
code: `
/**
* Has some
* description already.
*/
`,
options: [
{
contexts: [
{
comment: 'JsdocBlock[postDelimiter=""]:has(JsdocTag[rawType="{Bar}"])',
context: 'any',
},
],
descriptionStyle: 'tag',
},
],
},
],
};

0 comments on commit 4216249

Please sign in to comment.