Skip to content

Commit

Permalink
docs(require-jsdoc); add decorator example per gajus#662
Browse files Browse the repository at this point in the history
  • Loading branch information
brettz9 committed Jan 3, 2021
1 parent 19f68a0 commit a4d48ba
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.md
Expand Up @@ -10281,6 +10281,13 @@ export interface Foo {
}
// Options: [{"contexts":["TSPropertySignature","TSMethodSignature"],"publicOnly":true}]
// Message: Missing JSDoc comment.

export class User {
@Input()
public name: string;
}
// Options: [{"contexts":["ClassProperty:has(Decorator[expression.callee.name=\"Input\"])"]}]
// Message: Missing JSDoc comment.
````

The following patterns are not considered problems:
Expand Down
29 changes: 29 additions & 0 deletions test/rules/assertions/requireJsdoc.js
Expand Up @@ -2694,6 +2694,35 @@ export default {
sourceType: 'module',
},
},
{
code: `
export class User {
@Input()
public name: string;
}
`,
errors: [
{
line: 3,
message: 'Missing JSDoc comment.',
},
],
options: [{
contexts: [
'ClassProperty:has(Decorator[expression.callee.name="Input"])',
],
}],
output: `
export class User {
/**
*
*/
@Input()
public name: string;
}
`,
parser: require.resolve('@typescript-eslint/parser'),
},
],
valid: [{
code: `
Expand Down

0 comments on commit a4d48ba

Please sign in to comment.