|
1 | 1 | import eslint from '@eslint/js'; |
2 | 2 | import tseslint from 'typescript-eslint'; |
3 | 3 | import jsxA11y from 'eslint-plugin-jsx-a11y'; |
| 4 | +import reactPlugin from 'eslint-plugin-react'; |
4 | 5 | import reactHooks from 'eslint-plugin-react-hooks'; |
5 | 6 | import reactRefresh from 'eslint-plugin-react-refresh'; |
6 | 7 | import globals from 'globals'; |
7 | 8 |
|
8 | | -export default tseslint.config({ |
| 9 | +export default tseslint.config(eslint.configs.recommended, ...tseslint.configs.recommended, { |
9 | 10 | languageOptions: { |
10 | 11 | globals: { |
11 | 12 | ...globals.browser, |
12 | 13 | ...globals.es2025 |
13 | 14 | }, |
14 | 15 | parserOptions: { ecmaVersion: 'latest', sourceType: 'module' } |
15 | 16 | }, |
16 | | - extends: [eslint.configs.recommended, tseslint.configs.recommended], |
17 | 17 | files: ['**/*.{js,jsx,ts,tsx}'], |
18 | 18 | plugins: { |
19 | 19 | 'jsx-a11y': jsxA11y, |
| 20 | + react: reactPlugin, |
20 | 21 | 'react-hooks': reactHooks, |
21 | 22 | 'react-refresh': reactRefresh |
22 | 23 | }, |
23 | 24 | rules: { |
24 | 25 | ...jsxA11y.flatConfigs.recommended.rules, |
| 26 | + ...reactPlugin.configs.recommended.rules, |
| 27 | + ...reactPlugin.configs['jsx-runtime'].rules, // React >=17 |
25 | 28 | ...reactHooks.configs.recommended.rules, |
26 | 29 | 'react-refresh/only-export-components': 'warn', |
27 | 30 | '@typescript-eslint/ban-ts-comment': 'off', |
28 | 31 | '@typescript-eslint/no-explicit-any': 'warn', |
29 | 32 | '@typescript-eslint/no-empty-object-type': 'off', |
30 | 33 | 'no-debugger': 'warn', |
31 | 34 | 'no-console': 'warn' |
| 35 | + }, |
| 36 | + settings: { |
| 37 | + react: { |
| 38 | + version: 'detect' // reactPlugin trenger å vite dette |
| 39 | + } |
32 | 40 | } |
33 | 41 | }); |
0 commit comments