|
1 | 1 | import js from '@eslint/js' |
2 | 2 | import globals from 'globals' |
3 | | -import reactHooks from 'eslint-plugin-react-hooks' |
4 | | -import reactRefresh from 'eslint-plugin-react-refresh' |
5 | 3 | import tseslint from 'typescript-eslint' |
6 | | -import eslintConfigPrettier from 'eslint-config-prettier' |
| 4 | +import pluginReact from 'eslint-plugin-react' |
| 5 | +import json from '@eslint/json' |
| 6 | +import { defineConfig } from 'eslint/config' |
| 7 | +import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended' |
7 | 8 |
|
8 | | -export default tseslint.config( |
9 | | - { ignores: ['dist'] }, |
10 | | - { |
11 | | - extends: [js.configs.recommended, ...tseslint.configs.recommended], |
12 | | - files: ['**/*.{ts,tsx}'], |
13 | | - languageOptions: { |
14 | | - ecmaVersion: 2020, |
15 | | - globals: globals.browser, |
16 | | - }, |
17 | | - plugins: { |
18 | | - 'react-hooks': reactHooks, |
19 | | - 'react-refresh': reactRefresh, |
20 | | - }, |
21 | | - rules: { |
22 | | - ...reactHooks.configs.recommended.rules, |
23 | | - 'react-refresh/only-export-components': ['warn', { allowConstantExport: true }], |
24 | | - }, |
| 9 | +export default defineConfig([ |
| 10 | + { files: ['**/*.{js,mjs,cjs,ts,jsx,tsx}'], plugins: { js }, extends: ['js/recommended'] }, |
| 11 | + { files: ['**/*.{js,mjs,cjs,ts,jsx,tsx}'], languageOptions: { globals: globals.browser } }, |
| 12 | + tseslint.configs.recommended, |
| 13 | + { |
| 14 | + ...pluginReact.configs.flat.recommended, |
| 15 | + settings: { |
| 16 | + react: { |
| 17 | + version: 'detect', |
| 18 | + }, |
25 | 19 | }, |
26 | | - eslintConfigPrettier, |
27 | | -) |
| 20 | + }, |
| 21 | + { |
| 22 | + rules: { |
| 23 | + 'react/react-in-jsx-scope': 'off', |
| 24 | + 'react/prop-types': 'off', |
| 25 | + }, |
| 26 | + }, |
| 27 | + { files: ['**/*.json'], plugins: { json }, language: 'json/json', extends: ['json/recommended'] }, |
| 28 | + eslintPluginPrettierRecommended, |
| 29 | +]) |
0 commit comments