|
1 |
| -import js from '@eslint/js' |
| 1 | +import pluginJs from '@eslint/js' |
| 2 | +import vitest from '@vitest/eslint-plugin' |
| 3 | +import jsxA11y from 'eslint-plugin-jsx-a11y' |
| 4 | +import pluginReact from 'eslint-plugin-react' |
| 5 | +import pluginReactHooks from 'eslint-plugin-react-hooks' |
| 6 | +import pluginPromise from 'eslint-plugin-promise' |
2 | 7 | import globals from 'globals'
|
3 |
| -import reactHooks from 'eslint-plugin-react-hooks' |
4 |
| -import reactRefresh from 'eslint-plugin-react-refresh' |
| 8 | +// eslint-disable-next-line import/no-unresolved |
5 | 9 | import tseslint from 'typescript-eslint'
|
| 10 | +import pluginImport from 'eslint-plugin-import'; |
6 | 11 |
|
7 |
| -export default tseslint.config( |
8 |
| - { ignores: ['dist'] }, |
| 12 | + |
| 13 | +export default [ |
| 14 | + { files: ['**/*.{js,mjs,cjs,ts,jsx,tsx}'] }, |
| 15 | + { languageOptions: { globals: { ...globals.browser, ...globals.node } } }, |
| 16 | + pluginJs.configs.recommended, |
| 17 | + ...tseslint.configs.recommended, |
| 18 | + pluginPromise.configs['flat/recommended'], |
| 19 | + pluginReact.configs.flat.recommended, |
| 20 | + pluginReact.configs.flat['jsx-runtime'], |
| 21 | + pluginImport.flatConfigs.recommended, |
| 22 | + { |
| 23 | + files: ['src/**/*.{ts,tsx}'], |
| 24 | + plugins: { 'react-hooks': pluginReactHooks }, |
| 25 | + rules: { 'react-hooks/rules-of-hooks': 'error', 'react-hooks/exhaustive-deps': 'warn' }, |
| 26 | + }, |
| 27 | + { |
| 28 | + ignores: ['dist/', 'public/', 'history/'], |
| 29 | + }, |
| 30 | + { |
| 31 | + files: ['**/*.test.{tsx,ts}'], |
| 32 | + plugins: { |
| 33 | + vitest, |
| 34 | + }, |
| 35 | + rules: vitest.configs.recommended.rules, |
| 36 | + }, |
9 | 37 | {
|
10 |
| - extends: [js.configs.recommended, ...tseslint.configs.recommended], |
11 |
| - files: ['**/*.{ts,tsx}'], |
| 38 | + ...jsxA11y.flatConfigs.recommended, |
| 39 | + plugins: { 'jsx-a11y': jsxA11y }, |
12 | 40 | languageOptions: {
|
13 |
| - ecmaVersion: 2020, |
14 |
| - globals: globals.browser, |
| 41 | + ...jsxA11y.flatConfigs.recommended.languageOptions, |
| 42 | + globals: { ...globals.serviceworker, ...globals.browser }, |
15 | 43 | },
|
16 |
| - plugins: { |
17 |
| - 'react-hooks': reactHooks, |
18 |
| - 'react-refresh': reactRefresh, |
| 44 | + }, |
| 45 | + { |
| 46 | + settings: { |
| 47 | + react: { version: 'detect' }, |
19 | 48 | },
|
20 | 49 | rules: {
|
21 |
| - ...reactHooks.configs.recommended.rules, |
22 |
| - 'react-refresh/only-export-components': [ |
23 |
| - 'warn', |
24 |
| - { allowConstantExport: true }, |
25 |
| - ], |
| 50 | + 'no-console': ['error', { allow: ['warn', 'error', 'info'] }], |
| 51 | + 'prefer-const': 'error', |
| 52 | + eqeqeq: 'error', |
| 53 | + 'no-duplicate-imports': 'error', |
| 54 | + 'react/prop-types': 0, |
| 55 | + 'react/forbid-dom-props': ['error', { forbid: ['style'] }], |
26 | 56 | },
|
27 | 57 | },
|
28 |
| -) |
| 58 | +] |
0 commit comments