1const { jsExtensions, tsExtensions } = require('./extensions'); 2 3const allExtensions = [...jsExtensions, ...tsExtensions]; 4 5module.exports = { 6 overrides: [ 7 { 8 files: ['*.js', '*.jsx'], 9 settings: { 10 'import/parsers': { 11 '@typescript-eslint/parser': tsExtensions, 12 }, 13 }, 14 }, 15 { 16 files: ['*.ts', '*.tsx', '*.d.ts'], 17 extends: ['plugin:import/typescript'], 18 parser: '@typescript-eslint/parser', 19 parserOptions: { 20 // [email protected] accesses superTypeParameters, which is deprecated by 21 // typescript-estree and prints a warning by default 22 suppressDeprecatedPropertyWarnings: true, 23 }, 24 plugins: ['@typescript-eslint'], 25 rules: { 26 '@typescript-eslint/array-type': ['warn', { default: 'array' }], 27 '@typescript-eslint/ban-types': [ 28 'error', 29 { 30 types: { 31 Number: { 32 message: 'Use `number` instead.', 33 fixWith: 'number', 34 }, 35 Boolean: { 36 message: 'Use `boolean` instead.', 37 fixWith: 'boolean', 38 }, 39 Symbol: { 40 message: 'Use `symbol` instead.', 41 fixWith: 'symbol', 42 }, 43 Object: { 44 message: 'Use `object` instead.', 45 fixWith: 'object', 46 }, 47 String: { 48 message: 'Use `string` instead.', 49 fixWith: 'string', 50 }, 51 '{}': { 52 message: 'Use `object` instead.', 53 fixWith: 'object', 54 }, 55 }, 56 extendDefaults: false, 57 }, 58 ], 59 '@typescript-eslint/consistent-type-assertions': [ 60 'warn', 61 { assertionStyle: 'as', objectLiteralTypeAssertions: 'allow' }, 62 ], 63 '@typescript-eslint/no-extra-non-null-assertion': 'warn', 64 65 // Overrides 66 'no-dupe-class-members': 'off', 67 '@typescript-eslint/no-dupe-class-members': 'warn', 68 69 'no-redeclare': 'off', 70 '@typescript-eslint/no-redeclare': 'warn', 71 72 'no-unused-vars': 'off', 73 '@typescript-eslint/no-unused-vars': [ 74 'warn', 75 { vars: 'all', args: 'none', ignoreRestSiblings: true, caughtErrors: 'all' }, 76 ], 77 78 'no-useless-constructor': 'off', 79 '@typescript-eslint/no-useless-constructor': 'warn', 80 81 // The typescript-eslint FAQ recommends turning off "no-undef" in favor of letting tsc check for 82 // undefined variables, including types 83 'no-undef': 'off', 84 }, 85 settings: { 86 'import/extensions': allExtensions, 87 'import/parsers': { 88 '@typescript-eslint/parser': tsExtensions, 89 }, 90 'import/resolver': { 91 node: { extensions: allExtensions }, 92 }, 93 }, 94 }, 95 ], 96}; 97