|
| 1 | +import eslint from '@eslint/js'; |
| 2 | +import eslintPluginImport from 'eslint-plugin-import'; |
| 3 | +import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'; |
| 4 | +import eslintPluginReact from 'eslint-plugin-react'; |
| 5 | +import eslintPluginReactHooks from 'eslint-plugin-react-hooks'; |
| 6 | +// eslint-disable-next-line import/no-unresolved |
| 7 | +import tseslint from 'typescript-eslint'; |
| 8 | + |
| 9 | +export default tseslint.config( |
| 10 | + eslint.configs.recommended, |
| 11 | + // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access |
| 12 | + eslintPluginImport.flatConfigs.recommended, |
| 13 | + ...tseslint.configs.strictTypeChecked, |
| 14 | + ...tseslint.configs.stylisticTypeChecked, |
| 15 | + { |
| 16 | + languageOptions: { |
| 17 | + parserOptions: { |
| 18 | + projectService: true, |
| 19 | + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment |
| 20 | + tsconfigRootDir: import.meta.name, |
| 21 | + }, |
| 22 | + }, |
| 23 | + }, |
| 24 | + { |
| 25 | + files: ['**/*.{js,ts,tsx}'], |
| 26 | + ignores: ['!.*', 'node_modules', 'dist', 'compiled', 'build', '.docusaurus'], |
| 27 | + |
| 28 | + plugins: { |
| 29 | + react: eslintPluginReact, |
| 30 | + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment |
| 31 | + 'react-hooks': eslintPluginReactHooks, |
| 32 | + prettier: eslintPluginPrettierRecommended, |
| 33 | + }, |
| 34 | + |
| 35 | + rules: { |
| 36 | + 'react/prop-types': 'off', |
| 37 | + 'no-undef': 'off', |
| 38 | + |
| 39 | + 'prefer-template': 'error', |
| 40 | + 'no-nested-ternary': 'error', |
| 41 | + 'no-unneeded-ternary': 'error', |
| 42 | + |
| 43 | + '@typescript-eslint/ban-ts-comment': ['error', { 'ts-expect-error': 'allow-with-description' }], |
| 44 | + '@typescript-eslint/consistent-type-definitions': ['error', 'type'], |
| 45 | + '@typescript-eslint/array-type': ['error', { default: 'generic' }], |
| 46 | + '@typescript-eslint/prefer-nullish-coalescing': 'error', |
| 47 | + '@typescript-eslint/no-unnecessary-condition': 'error', |
| 48 | + '@typescript-eslint/no-confusing-void-expression': ['error', { ignoreArrowShorthand: true }], |
| 49 | + '@typescript-eslint/restrict-plus-operands': 'off', |
| 50 | + |
| 51 | + 'import/no-default-export': 'error', |
| 52 | + 'import/no-unresolved': 'off', |
| 53 | + }, |
| 54 | + |
| 55 | + settings: { |
| 56 | + react: { version: 'detect' }, |
| 57 | + }, |
| 58 | + }, |
| 59 | +); |
0 commit comments