Skip to content

Commit

Permalink
test(require-jsdoc): avoid test example with :has() and demonstra…
Browse files Browse the repository at this point in the history
…te differential behavior of selectors; gajus#662

`:has()` is a selector only available to esquery, not to the current selector engine in ESLint.
  • Loading branch information
brettz9 committed Feb 1, 2021
1 parent 4e8d735 commit 9de8977
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 9 deletions.
11 changes: 8 additions & 3 deletions README.md
Expand Up @@ -10652,11 +10652,16 @@ export interface Foo {
// Options: [{"contexts":["TSPropertySignature","TSMethodSignature"],"publicOnly":true}]
// Message: Missing JSDoc comment.

export class User {
export class MyComponentComponent {
@Output()
public changed = new EventEmitter();

public test = 'test';

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

Expand Down
22 changes: 16 additions & 6 deletions test/rules/assertions/requireJsdoc.js
Expand Up @@ -2716,29 +2716,39 @@ function quux (foo) {
},
{
code: `
export class User {
export class MyComponentComponent {
@Output()
public changed = new EventEmitter();
public test = 'test';
@Input()
public name: string;
public value = new EventEmitter();
}
`,
errors: [
{
line: 3,
line: 8,
message: 'Missing JSDoc comment.',
},
],
options: [{
contexts: [
'ClassProperty:has(Decorator[expression.callee.name="Input"])',
'ClassProperty > Decorator[expression.callee.name="Input"]',
],
}],
output: `
export class User {
export class MyComponentComponent {
@Output()
public changed = new EventEmitter();
public test = 'test';
/**
*
*/
@Input()
public name: string;
public value = new EventEmitter();
}
`,
parser: require.resolve('@typescript-eslint/parser'),
Expand Down

0 comments on commit 9de8977

Please sign in to comment.