|
| 1 | +import globals from 'globals'; |
| 2 | +import pluginJs from '@eslint/js'; |
| 3 | +import tseslint from 'typescript-eslint'; |
| 4 | +import importPlugin from 'eslint-plugin-import'; |
| 5 | +import prettierPlugin from 'eslint-plugin-prettier'; |
| 6 | +import jestPlugin from 'eslint-plugin-jest'; |
| 7 | + |
| 8 | +/** @type {import('eslint').Linter.Config[]} */ |
| 9 | +export default [ |
| 10 | + { |
| 11 | + files: ['**/*.{js,mjs,cjs,ts,tsx}', '**/*.{test,spec}.{js,ts,tsx}'], |
| 12 | + languageOptions: { |
| 13 | + globals: { |
| 14 | + ...globals.browser, |
| 15 | + ...globals.node, |
| 16 | + ...globals.jest |
| 17 | + }, |
| 18 | + parser: tseslint.parser, |
| 19 | + parserOptions: { |
| 20 | + ecmaVersion: 2021, |
| 21 | + sourceType: 'module', |
| 22 | + ecmaFeatures: { |
| 23 | + jsx: true |
| 24 | + }, |
| 25 | + project: './tsconfig.json' |
| 26 | + } |
| 27 | + }, |
| 28 | + plugins: { |
| 29 | + import: importPlugin, |
| 30 | + prettier: prettierPlugin, |
| 31 | + jest: jestPlugin, |
| 32 | + '@typescript-eslint': tseslint.plugin |
| 33 | + }, |
| 34 | + settings: { |
| 35 | + 'import/parsers': { |
| 36 | + '@typescript-eslint/parser': ['.ts', '.tsx'] |
| 37 | + }, |
| 38 | + 'import/resolver': { |
| 39 | + node: { |
| 40 | + extensions: ['.js', '.jsx', '.ts', '.tsx'], |
| 41 | + moduleDirectory: ['node_modules', 'src/'] |
| 42 | + }, |
| 43 | + typescript: { |
| 44 | + alwaysTryTypes: true |
| 45 | + } |
| 46 | + } |
| 47 | + }, |
| 48 | + rules: { |
| 49 | + ...jestPlugin.configs.recommended.rules, |
| 50 | + ...pluginJs.configs.recommended.rules, |
| 51 | + ...tseslint.configs.recommended.rules, |
| 52 | + 'import/order': [ |
| 53 | + 'warn', |
| 54 | + { |
| 55 | + groups: ['builtin', 'external', 'internal'], |
| 56 | + pathGroups: [ |
| 57 | + { |
| 58 | + pattern: 'react', |
| 59 | + group: 'external', |
| 60 | + position: 'before' |
| 61 | + } |
| 62 | + ], |
| 63 | + 'newlines-between': 'ignore', |
| 64 | + alphabetize: { |
| 65 | + order: 'asc', |
| 66 | + caseInsensitive: true |
| 67 | + } |
| 68 | + } |
| 69 | + ], |
| 70 | + 'prettier/prettier': ['error', { endOfLine: 'lf' }], |
| 71 | + '@typescript-eslint/indent': 'off', |
| 72 | + '@typescript-eslint/explicit-module-boundary-types': 'off', |
| 73 | + '@typescript-eslint/no-use-before-define': [ |
| 74 | + 'error', |
| 75 | + { functions: false, classes: false } |
| 76 | + ], |
| 77 | + '@typescript-eslint/no-explicit-any': 'off', |
| 78 | + '@typescript-eslint/no-empty-function': 'off', |
| 79 | + '@typescript-eslint/no-unused-vars': [ |
| 80 | + 'error', |
| 81 | + { |
| 82 | + argsIgnorePattern: '^_', |
| 83 | + caughtErrorsIgnorePattern: '^_' |
| 84 | + } |
| 85 | + ], |
| 86 | + '@typescript-eslint/no-var-requires': 'off', |
| 87 | + '@typescript-eslint/explicit-function-return-type': 'off', |
| 88 | + 'linebreak-style': ['error', 'unix'], |
| 89 | + quotes: ['error', 'single'], |
| 90 | + semi: ['error', 'always'], |
| 91 | + 'no-unused-vars': ['off'], |
| 92 | + 'no-prototype-builtins': 'off', |
| 93 | + 'jest/no-mocks-import': 'off', |
| 94 | + 'no-async-promise-executor': 'off', |
| 95 | + 'object-curly-newline': 'off', |
| 96 | + 'arrow-body-style': 'off', |
| 97 | + 'implicit-arrow-linebreak': 'off', |
| 98 | + 'func-names': 'off', |
| 99 | + curly: ['error', 'all'], |
| 100 | + 'operator-linebreak': 'off', |
| 101 | + 'function-paren-newline': 'off', |
| 102 | + 'no-shadow': 'off', |
| 103 | + '@typescript-eslint/no-shadow': 'off' |
| 104 | + } |
| 105 | + } |
| 106 | +]; |
0 commit comments