|
| 1 | +/** |
| 2 | + * The goal of this ruleset is to update the eslint:recommended config to better |
| 3 | + * suit Typescript. There are two main reasons to change the configuration: |
| 4 | + * 1. The Typescript compiler natively checks some things that therefore don't |
| 5 | + * need extra rules anymore. |
| 6 | + * 2. Typescript allows for more modern Javascript code that can thus be |
| 7 | + * enabled. |
| 8 | + */ |
| 9 | +export default { |
| 10 | + overrides: [ |
| 11 | + { |
| 12 | + files: ['*.ts', '*.tsx'], |
| 13 | + rules: { |
| 14 | + /** |
| 15 | + * 1. Disable things that are checked by Typescript |
| 16 | + */ |
| 17 | + //Checked by Typescript - ts(2378) |
| 18 | + 'getter-return': false, |
| 19 | + // Checked by Typescript - ts(2300) |
| 20 | + 'no-dupe-args': false, |
| 21 | + // Checked by Typescript - ts(1117) |
| 22 | + 'no-dupe-keys': false, |
| 23 | + // Checked by Typescript - ts(7027) |
| 24 | + 'no-unreachable': false, |
| 25 | + // Checked by Typescript - ts(2367) |
| 26 | + 'valid-typeof': false, |
| 27 | + // Checked by Typescript - ts(2588) |
| 28 | + 'no-const-assign': false, |
| 29 | + // Checked by Typescript - ts(2588) |
| 30 | + 'no-new-symbol': false, |
| 31 | + // Checked by Typescript - ts(2376) |
| 32 | + 'no-this-before-super': false, |
| 33 | + // This is checked by Typescript using the option `strictNullChecks`. |
| 34 | + 'no-undef': false, |
| 35 | + /** |
| 36 | + * 2. Enable more ideomatic code |
| 37 | + */ |
| 38 | + // Typescript allows const and let instead of var. |
| 39 | + 'no-var': 'error', |
| 40 | + 'prefer-const': 'error', |
| 41 | + // The spread operator/rest parameters should be prefered in Typescript. |
| 42 | + 'prefer-rest-params': 'error', |
| 43 | + 'prefer-spread': 'error', |
| 44 | + // This is already checked by Typescript. |
| 45 | + 'no-dupe-class-members': 'error', |
| 46 | + }, |
| 47 | + }, |
| 48 | + ], |
| 49 | +}; |
0 commit comments