|
| 1 | +import { fixupConfigRules, fixupPluginRules } from '@eslint/compat'; |
| 2 | +import { FlatCompat } from '@eslint/eslintrc'; |
| 3 | +import js from '@eslint/js'; |
| 4 | +import typescriptEslint from '@typescript-eslint/eslint-plugin'; |
| 5 | +import tsParser from '@typescript-eslint/parser'; |
| 6 | +import prettier from 'eslint-plugin-prettier'; |
| 7 | +import react from 'eslint-plugin-react'; |
| 8 | +import globals from 'globals'; |
| 9 | +import path from 'node:path'; |
| 10 | +import { fileURLToPath } from 'node:url'; |
| 11 | + |
| 12 | +const __filename = fileURLToPath(import.meta.url); |
| 13 | +const __dirname = path.dirname(__filename); |
| 14 | +const compat = new FlatCompat({ |
| 15 | + baseDirectory: __dirname, |
| 16 | + recommendedConfig: js.configs.recommended, |
| 17 | + allConfig: js.configs.all, |
| 18 | +}); |
| 19 | + |
| 20 | +export default [ |
| 21 | + { |
| 22 | + ignores: ['scripts/*', 'vite.config.ts'], |
| 23 | + }, |
| 24 | + ...fixupConfigRules( |
| 25 | + compat.extends( |
| 26 | + 'airbnb', |
| 27 | + 'airbnb-typescript', |
| 28 | + 'airbnb/hooks', |
| 29 | + 'plugin:react/recommended', |
| 30 | + 'plugin:@typescript-eslint/recommended', |
| 31 | + 'plugin:prettier/recommended', |
| 32 | + ), |
| 33 | + ), |
| 34 | + { |
| 35 | + plugins: { |
| 36 | + react: fixupPluginRules(react), |
| 37 | + '@typescript-eslint': fixupPluginRules(typescriptEslint), |
| 38 | + prettier: fixupPluginRules(prettier), |
| 39 | + }, |
| 40 | + |
| 41 | + languageOptions: { |
| 42 | + globals: { |
| 43 | + ...globals.browser, |
| 44 | + }, |
| 45 | + |
| 46 | + parser: tsParser, |
| 47 | + ecmaVersion: 'latest', |
| 48 | + sourceType: 'module', |
| 49 | + |
| 50 | + parserOptions: { |
| 51 | + project: './tsconfig.json', |
| 52 | + }, |
| 53 | + }, |
| 54 | + |
| 55 | + rules: { |
| 56 | + 'react/react-in-jsx-scope': 0, |
| 57 | + 'react/prop-types': 0, |
| 58 | + 'react/jsx-props-no-spreading': 0, |
| 59 | + 'react/require-default-props': 'off', |
| 60 | + 'react/display-name': 'off', |
| 61 | + |
| 62 | + 'react/jsx-no-useless-fragment': [ |
| 63 | + 'warn', |
| 64 | + { |
| 65 | + allowExpressions: true, |
| 66 | + }, |
| 67 | + ], |
| 68 | + |
| 69 | + 'import/no-extraneous-dependencies': [ |
| 70 | + 'off', |
| 71 | + { |
| 72 | + devDependencies: true, |
| 73 | + }, |
| 74 | + ], |
| 75 | + |
| 76 | + 'no-restricted-exports': 'off', |
| 77 | + 'react/function-component-definition': 'off', |
| 78 | + |
| 79 | + '@typescript-eslint/naming-convention': [ |
| 80 | + 'warn', |
| 81 | + { |
| 82 | + selector: 'enum', |
| 83 | + format: ['PascalCase', 'UPPER_CASE', 'camelCase'], |
| 84 | + }, |
| 85 | + ], |
| 86 | + }, |
| 87 | + }, |
| 88 | + { |
| 89 | + files: ['**/*.test.ts', '**/*.test.tsx', '**/*.spec.ts', '**/*.spec.tsx', '**/*.steps.ts', '**/*.steps.tsx', 'src/shared/testsUtils/**/*'], |
| 90 | + |
| 91 | + rules: { |
| 92 | + 'import/no-extraneous-dependencies': ['off'], |
| 93 | + 'react/display-name': 0, |
| 94 | + }, |
| 95 | + }, |
| 96 | +]; |
0 commit comments