Skip to content

Commit

Permalink
test(require-jsdoc): fix for CI where has:() doesn't work with TS…
Browse files Browse the repository at this point in the history
… on ESLint 6 (only latest ESLint 7)
  • Loading branch information
brettz9 committed Feb 16, 2021
1 parent b07f0bf commit ea30830
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion test/rules/assertions/requireJsdoc.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
* @see https://github.com/eslint/eslint/blob/master/tests/lib/rules/require-jsdoc.js
*/

import {
CLIEngine,
} from 'eslint';

export default {
invalid: [
{
Expand Down Expand Up @@ -2942,7 +2946,13 @@ function quux (foo) {
],
options: [{
contexts: [
'ClassProperty:has(Decorator[expression.callee.name="Input"])',
// Only fixed to support `:has()` with TS later in ESLint 7, but
// for our testing of ESLint 6, we use `>` which is equivalent in
// this case; after having peerDeps. to ESLint 7+, we can remove
// this check and use of `CLIEngine`
CLIEngine.version.startsWith('6') ?
'ClassProperty > Decorator[expression.callee.name="Input"]' :
'ClassProperty:has(Decorator[expression.callee.name="Input"])',
],
}],
output: `
Expand Down

0 comments on commit ea30830

Please sign in to comment.