Skip to content

Commit f5a5c01

Browse files
authored
include recommended ts-eslint rules for gts (#2107)
* 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 typescript-eslint/typescript-eslint#8607 * copy rules
1 parent 4ea4459 commit f5a5c01

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

lib/config/recommended-gts.js

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,29 @@
11
const base = require('./base');
22
const gtsRules = require('../recommended-rules-gts');
33

4-
module.exports = [...base, { rules: gtsRules }];
4+
// see https://github.com/typescript-eslint/typescript-eslint/issues/8607
5+
// https://github.com/typescript-eslint/typescript-eslint/blob/v7.4.0/packages/eslint-plugin/src/configs/eslint-recommended-raw.ts
6+
const tsRecommended = {
7+
'constructor-super': 'off', // ts(2335) & ts(2377)
8+
'getter-return': 'off', // ts(2378)
9+
'no-const-assign': 'off', // ts(2588)
10+
'no-dupe-args': 'off', // ts(2300)
11+
'no-dupe-class-members': 'off', // ts(2393) & ts(2300)
12+
'no-dupe-keys': 'off', // ts(1117)
13+
'no-func-assign': 'off', // ts(2630)
14+
'no-import-assign': 'off', // ts(2632) & ts(2540)
15+
'no-new-symbol': 'off', // ts(7009)
16+
'no-obj-calls': 'off', // ts(2349)
17+
'no-redeclare': 'off', // ts(2451)
18+
'no-setter-return': 'off', // ts(2408)
19+
'no-this-before-super': 'off', // ts(2376) & ts(17009)
20+
'no-undef': 'off', // ts(2304) & ts(2552)
21+
'no-unreachable': 'off', // ts(7027)
22+
'no-unsafe-negation': 'off', // ts(2365) & ts(2322) & ts(2358)
23+
'no-var': 'error', // ts transpiles let/const to var, so no need for vars any more
24+
'prefer-const': 'error', // ts provides better types with const
25+
'prefer-rest-params': 'error', // ts provides better types with rest args over arguments
26+
'prefer-spread': 'error', // ts transpiles spread to apply, so no need for manual apply
27+
};
28+
29+
module.exports = [...base, { rules: { ...gtsRules, ...tsRecommended } }];

0 commit comments

Comments
 (0)