Skip to content

Commit

Permalink
test: demo disabling param tags with name props
Browse files Browse the repository at this point in the history
  • Loading branch information
brettz9 committed Oct 27, 2022
1 parent beb169c commit 36f6f9c
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14850,6 +14850,15 @@ function quux (foo) {
}
// Settings: {"jsdoc":{"tagNamePreference":{"param":false}}}
// Message: Unexpected tag `@param`

/**
* @param foo
*/
function quux (foo) {

}
// "jsdoc/require-param-description": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock:has(JsdocTag:not([name=props]))","context":"FunctionDeclaration"}]}]
// Message: Missing JSDoc @param "foo" description.
````

The following patterns are not considered problems:
Expand Down Expand Up @@ -14886,6 +14895,14 @@ function quux (foo) {
* @callback
* @param foo
*/

/**
* @param props
*/
function quux (props) {

}
// "jsdoc/require-param-description": ["error"|"warn", {"contexts":[{"comment":"JsdocBlock:has(JsdocTag:not([name=props]))","context":"FunctionDeclaration"}]}]
````


Expand Down
46 changes: 46 additions & 0 deletions test/rules/assertions/requireParamDescription.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,32 @@ export default {
},
},
},
{
code: `
/**
* @param foo
*/
function quux (foo) {
}
`,
errors: [
{
line: 3,
message: 'Missing JSDoc @param "foo" description.',
},
],
options: [
{
contexts: [
{
comment: 'JsdocBlock:has(JsdocTag:not([name=props]))',
context: 'FunctionDeclaration',
},
],
},
],
},
],
valid: [
{
Expand Down Expand Up @@ -196,5 +222,25 @@ export default {
`,
ignoreReadme: true,
},
{
code: `
/**
* @param props
*/
function quux (props) {
}
`,
options: [
{
contexts: [
{
comment: 'JsdocBlock:has(JsdocTag:not([name=props]))',
context: 'FunctionDeclaration',
},
],
},
],
},
],
};

0 comments on commit 36f6f9c

Please sign in to comment.