|
1 | | -import { defineConfig } from 'eslint/config'; |
2 | 1 | import jsxA11y from 'eslint-plugin-jsx-a11y'; |
3 | 2 | import react from 'eslint-plugin-react'; |
4 | 3 | import reactHooks from 'eslint-plugin-react-hooks'; |
5 | 4 | import reactRefresh from 'eslint-plugin-react-refresh'; |
| 5 | +import { defineConfig } from 'eslint/config'; |
6 | 6 | import globals from 'globals'; |
7 | | - |
8 | 7 | import { PERFECTIONIST_SETTINGS, SORT_IMPORTS_GROUPS } from '../lib/eslint-plugin-perfectionist.js'; |
9 | 8 | import base from './base.js'; |
10 | 9 |
|
| 10 | +const reactRecommendedConfig = react.configs.flat.recommended; |
| 11 | + |
| 12 | +if (!reactRecommendedConfig) { |
| 13 | + throw new Error( |
| 14 | + 'Expected to find the "flat/recommended" configuration in the eslint-plugin-react plugin, but it was not found.', |
| 15 | + ); |
| 16 | +} |
| 17 | + |
| 18 | +const reactJsxRuntimeConfig = react.configs.flat['jsx-runtime']; |
| 19 | + |
| 20 | +if (!reactJsxRuntimeConfig) { |
| 21 | + throw new Error( |
| 22 | + 'Expected to find the "flat/jsx-runtime" configuration in the eslint-plugin-react plugin, but it was not found.', |
| 23 | + ); |
| 24 | +} |
| 25 | + |
11 | 26 | export default defineConfig( |
12 | 27 | ...base, |
13 | 28 | jsxA11y.flatConfigs.recommended, |
14 | | - react.configs.flat.recommended!, |
15 | | - react.configs.flat['jsx-runtime']!, |
| 29 | + reactRecommendedConfig, |
| 30 | + reactJsxRuntimeConfig, |
16 | 31 | reactRefresh.configs.recommended, |
17 | 32 | { |
18 | 33 | languageOptions: { |
|
0 commit comments