Skip to content

Commit

Permalink
test(require-jsdoc): show example with ClassProperty
Browse files Browse the repository at this point in the history
  • Loading branch information
brettz9 committed Jun 2, 2020
1 parent ca97fcf commit 3c03616
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 0 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8604,6 +8604,20 @@ module.exports.foo = (bar) => {
}
// Options: [{"publicOnly":false,"require":{"ArrowFunctionExpression":true,"FunctionDeclaration":true,"FunctionExpression":true,"MethodDefinition":true}}]
// Message: Missing JSDoc comment.
class Animal {
#name: string;
private species: string;
public color: string;
@SomeAnnotation('optionalParameter')
tail: boolean;
}
// Options: [{"contexts":["ClassProperty"]}]
// Message: Missing JSDoc comment.
````
The following patterns are not considered problems:
Expand Down
67 changes: 67 additions & 0 deletions test/rules/assertions/requireJsdoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2174,6 +2174,73 @@ export default {
}
`,
},
{
code: `
class Animal {
#name: string;
private species: string;
public color: string;
@SomeAnnotation('optionalParameter')
tail: boolean;
}
`,
errors: [
{
line: 4,
message: 'Missing JSDoc comment.',
},
{
line: 6,
message: 'Missing JSDoc comment.',
},
{
line: 8,
message: 'Missing JSDoc comment.',
},
{
line: 10,
message: 'Missing JSDoc comment.',
},
],
options: [
{
contexts: ['ClassProperty'],
},
],
output: `
class Animal {
/**
*
*/
#name: string;
/**
*
*/
private species: string;
/**
*
*/
public color: string;
/**
*
*/
@SomeAnnotation('optionalParameter')
tail: boolean;
}
`,
parser: require.resolve('@typescript-eslint/parser'),
parserOptions: {
sourceType: 'module',
},
},
],
valid: [{
code: `
Expand Down

0 comments on commit 3c03616

Please sign in to comment.