Skip to content

Commit

Permalink
typescript recommended rules turn off eslint rules that do not work f…
Browse files Browse the repository at this point in the history
…or ts/gts

but they only to that for known extensions, therefore we need to reapply them in our
recommended config
see issue typescript-eslint/typescript-eslint#8607
  • Loading branch information
patricklx committed Mar 11, 2024
1 parent 4ea4459 commit 5aee9fc
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion lib/config/recommended-gts.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
const base = require('./base');
const gtsRules = require('../recommended-rules-gts');

module.exports = [...base, { rules: gtsRules }];
let typescriptRecommendedRules = {};
try {
// typescript recommended rules turn off eslint rules that do not work for ts/gts
// but they only to that for known extensions, therefore we need to reapply them in our
// recommended config
// see issue https://github.com/typescript-eslint/typescript-eslint/issues/8607
const recommended = // eslint-disable-next-line n/no-extraneous-require
require('@typescript-eslint/eslint-plugin').configs['eslint-recommended'];
typescriptRecommendedRules = recommended.overrides[0].rules;
} catch {
// not available
}

module.exports = [...base, { rules: { ...gtsRules, ...typescriptRecommendedRules } }];

0 comments on commit 5aee9fc

Please sign in to comment.