File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -39,16 +39,19 @@ import reactX from 'eslint-plugin-react-x'
3939import reactDom from ' eslint-plugin-react-dom'
4040
4141export default tseslint .config ({
42- plugins: {
43- // Add the react-x and react-dom plugins
44- ' react-x' : reactX,
45- ' react-dom' : reactDom,
46- },
47- rules: {
48- // other rules...
49- // Enable its recommended typescript rules
50- ... reactX .configs [' recommended-typescript' ].rules ,
51- ... reactDom .configs .recommended .rules ,
42+ extends: [
43+ // other configs...
44+ // Enable lint rules for React
45+ reactX .configs [' recommended-typescript' ],
46+ // Enable lint rules for React DOM
47+ reactDom .configs .recommended ,
48+ ],
49+ languageOptions: {
50+ // other options...
51+ parserOptions: {
52+ project: [' ./tsconfig.node.json' , ' ./tsconfig.app.json' ],
53+ tsconfigRootDir: import .meta.dirname,
54+ },
5255 },
5356})
5457```
Original file line number Diff line number Diff line change @@ -2,11 +2,13 @@ import js from '@eslint/js'
22import globals from 'globals'
33import reactHooks from 'eslint-plugin-react-hooks'
44import reactRefresh from 'eslint-plugin-react-refresh'
5+ import { defineConfig } from 'eslint/config'
56
6- export default [
7+ export default defineConfig ( [
78 { ignores : [ 'dist' ] } ,
89 {
910 files : [ '**/*.{js,jsx}' ] ,
11+ extends : [ js . configs . recommended ] ,
1012 languageOptions : {
1113 ecmaVersion : 2020 ,
1214 globals : globals . browser ,
@@ -21,7 +23,6 @@ export default [
2123 'react-refresh' : reactRefresh ,
2224 } ,
2325 rules : {
24- ...js . configs . recommended . rules ,
2526 ...reactHooks . configs . recommended . rules ,
2627 'no-unused-vars' : [ 'error' , { varsIgnorePattern : '^[A-Z_]' } ] ,
2728 'react-refresh/only-export-components' : [
@@ -30,4 +31,4 @@ export default [
3031 ] ,
3132 } ,
3233 } ,
33- ]
34+ ] )
You can’t perform that action at this time.
0 commit comments