|
| 1 | +import eslint from '@eslint/js'; |
| 2 | +import tseslint from 'typescript-eslint'; |
| 3 | +import react from 'eslint-plugin-react'; |
| 4 | +import { fixupPluginRules } from '@eslint/compat'; |
| 5 | +import eslintPluginReactHooks from 'eslint-plugin-react-hooks'; |
| 6 | +import jest from 'eslint-plugin-jest'; |
| 7 | +import eslintConfigPrettier from 'eslint-config-prettier'; |
| 8 | + |
| 9 | +export default (tsconfigRootDir) => [ |
| 10 | + { |
| 11 | + files: ['test/**/*.ts', 'test/**/*.tsx'], |
| 12 | + ...eslint.configs.recommended, |
| 13 | + }, |
| 14 | + ...tseslint.configs.recommendedTypeChecked.map((config) => ({ |
| 15 | + files: ['test/**/*.ts', 'test/**/*.tsx'], |
| 16 | + ...config, |
| 17 | + })), |
| 18 | + ...tseslint.configs.stylisticTypeChecked.map((config) => ({ |
| 19 | + files: ['test/**/*.ts', 'test/**/*.tsx'], |
| 20 | + ...config, |
| 21 | + })), |
| 22 | + { |
| 23 | + files: ['test/**/*.ts', 'test/**/*.tsx'], |
| 24 | + languageOptions: { |
| 25 | + parserOptions: { |
| 26 | + project: ['./tsconfig.test.json'], |
| 27 | + tsconfigRootDir, |
| 28 | + }, |
| 29 | + }, |
| 30 | + }, |
| 31 | + { |
| 32 | + files: ['test/**/*.ts', 'test/**/*.tsx'], |
| 33 | + ...react.configs.flat.recommended, |
| 34 | + }, |
| 35 | + { |
| 36 | + files: ['test/**/*.ts', 'test/**/*.tsx'], |
| 37 | + settings: { |
| 38 | + react: { |
| 39 | + version: 'detect', |
| 40 | + }, |
| 41 | + }, |
| 42 | + }, |
| 43 | + { |
| 44 | + files: ['test/**/*.ts', 'test/**/*.tsx'], |
| 45 | + plugins: { |
| 46 | + 'react-hooks': fixupPluginRules(eslintPluginReactHooks), |
| 47 | + }, |
| 48 | + }, |
| 49 | + { |
| 50 | + files: ['test/**/*.ts', 'test/**/*.tsx'], |
| 51 | + ...jest.configs['flat/recommended'], |
| 52 | + }, |
| 53 | + { |
| 54 | + files: ['test/**/*.ts', 'test/**/*.tsx'], |
| 55 | + ...jest.configs['jest/style'], |
| 56 | + }, |
| 57 | + { |
| 58 | + files: ['test/**/*.ts', 'test/**/*.tsx'], |
| 59 | + ...eslintConfigPrettier, |
| 60 | + }, |
| 61 | + { |
| 62 | + files: ['test/**/*.ts', 'test/**/*.tsx'], |
| 63 | + rules: { |
| 64 | + '@typescript-eslint/no-unsafe-return': 'off', |
| 65 | + '@typescript-eslint/no-unsafe-assignment': 'off', |
| 66 | + '@typescript-eslint/no-unsafe-call': 'off', |
| 67 | + '@typescript-eslint/no-unsafe-member-access': 'off', |
| 68 | + '@typescript-eslint/prefer-optional-chain': 'off', |
| 69 | + '@typescript-eslint/no-base-to-string': 'off', |
| 70 | + '@typescript-eslint/consistent-indexed-object-style': 'off', |
| 71 | + '@typescript-eslint/prefer-nullish-coalescing': 'off', |
| 72 | + '@typescript-eslint/consistent-type-definitions': 'off', |
| 73 | + '@typescript-eslint/no-unused-vars': 'off', |
| 74 | + '@typescript-eslint/no-explicit-any': 'off', |
| 75 | + '@typescript-eslint/prefer-for-of': 'off', |
| 76 | + '@typescript-eslint/non-nullable-type-assertion-style': 'off', |
| 77 | + '@typescript-eslint/class-literal-property-style': 'off', |
| 78 | + '@typescript-eslint/no-redundant-type-constituents': 'off', |
| 79 | + '@typescript-eslint/prefer-string-starts-ends-with': 'off', |
| 80 | + '@typescript-eslint/no-duplicate-type-constituents': 'off', |
| 81 | + '@typescript-eslint/array-type': 'off', |
| 82 | + '@typescript-eslint/prefer-function-type': 'off', |
| 83 | + }, |
| 84 | + }, |
| 85 | +]; |
0 commit comments