|
| 1 | +module.exports = { |
| 2 | + parser: '@typescript-eslint/parser', // Specifies the ESLint parser |
| 3 | + extends: [ |
| 4 | + 'airbnb-base', |
| 5 | + 'plugin:@typescript-eslint/recommended', |
| 6 | + 'plugin:prettier/recommended', // Enables eslint-plugin-prettier and displays prettier errors as ESLint errors. Make sure this is always the last configuration in the extends array. |
| 7 | + ], |
| 8 | + plugins: ['jest'], |
| 9 | + parserOptions: { |
| 10 | + ecmaVersion: 2023, // Allows for the parsing of modern ECMAScript features |
| 11 | + sourceType: 'module', // Allows for the use of imports |
| 12 | + }, |
| 13 | + settings: { |
| 14 | + 'import/resolver': { |
| 15 | + node: { |
| 16 | + extensions: ['.js', '.ts'], |
| 17 | + }, |
| 18 | + typescript: {}, // This loads <rootdir>/tsconfig.json to eslint |
| 19 | + }, |
| 20 | + }, |
| 21 | + rules: { |
| 22 | + 'prettier/prettier': 'error', // Add Prettier errors as ESLint errors |
| 23 | + 'arrow-parens': ['error', 'as-needed'], |
| 24 | + 'import/no-named-as-default': 0, |
| 25 | + 'import/prefer-default-export': 0, |
| 26 | + quotes: ['error', 'single', { avoidEscape: true, allowTemplateLiterals: true }], |
| 27 | + 'comma-dangle': 0, |
| 28 | + 'object-curly-newline': ['error', { ObjectPattern: { multiline: true } }], |
| 29 | + eqeqeq: [1, 'allow-null'], |
| 30 | + 'no-console': 'off', |
| 31 | + 'no-continue': 0, |
| 32 | + 'no-cond-assign': 1, |
| 33 | + 'no-constant-condition': 0, |
| 34 | + 'no-control-regex': 1, |
| 35 | + 'no-debugger': 1, |
| 36 | + 'no-dupe-keys': 1, |
| 37 | + 'no-ex-assign': 1, |
| 38 | + 'no-extra-boolean-cast': 1, |
| 39 | + 'no-func-assign': 1, |
| 40 | + 'no-regex-spaces': 1, |
| 41 | + 'no-unreachable': 1, |
| 42 | + 'no-fallthrough': 1, |
| 43 | + 'no-lone-blocks': 1, |
| 44 | + 'no-delete-var': 1, |
| 45 | + 'no-shadow': 1, |
| 46 | + 'no-shadow-restricted-names': 1, |
| 47 | + 'no-undef': 2, |
| 48 | + 'no-undef-init': 1, |
| 49 | + 'no-use-before-define': 0, |
| 50 | + 'no-unused-vars': [1, { vars: 'all', args: 'none' }], |
| 51 | + 'no-underscore-dangle': 0, |
| 52 | + 'no-restricted-syntax': ['error', 'LabeledStatement', 'WithStatement'], |
| 53 | + 'no-await-in-loop': 'off', |
| 54 | + 'no-plusplus': 'off', |
| 55 | + 'guard-for-in': 'off', |
| 56 | + 'no-bitwise': 'off', |
| 57 | + 'import/extensions': [ |
| 58 | + 'error', |
| 59 | + 'ignorePackages', |
| 60 | + { |
| 61 | + js: 'never', |
| 62 | + ts: 'never', |
| 63 | + }, |
| 64 | + ], |
| 65 | + }, |
| 66 | + overrides: [ |
| 67 | + { |
| 68 | + files: ['*.ts'], |
| 69 | + parserOptions: { |
| 70 | + project: ['./tsconfig.json'], // Specify it only for TypeScript files |
| 71 | + }, |
| 72 | + }, |
| 73 | + { |
| 74 | + // Apply Jest global variables only to test files |
| 75 | + files: ['__tests__/**/*.{js,ts}'], |
| 76 | + env: { |
| 77 | + jest: true, |
| 78 | + }, |
| 79 | + plugins: ['jest'], |
| 80 | + extends: ['plugin:jest/recommended'], // Use recommended Jest rules |
| 81 | + }, |
| 82 | + ], |
| 83 | +}; |
0 commit comments