@@ -4,14 +4,16 @@ import eslintPluginReactHooks from "eslint-plugin-react-hooks";
4
4
import eslintPluginReactRefresh from "eslint-plugin-react-refresh" ;
5
5
import babelEslintParser from "@babel/eslint-parser" ;
6
6
import globals from "globals" ;
7
+ import { defineConfig } from "eslint/config" ;
7
8
8
9
import JSCONFIG from "./jsconfig.json" with { type : "json" } ;
9
10
import JSCONFIG_NODE from "./jsconfig.node.json" with { type : "json" } ;
10
11
11
- export default [
12
+ export default defineConfig ( [
12
13
// base configuration for browser environment source files
13
14
{
14
15
files : JSCONFIG . include ,
16
+ extends : [ eslintJs . configs . recommended ] ,
15
17
languageOptions : {
16
18
globals : {
17
19
...globals . browser ,
@@ -26,14 +28,12 @@ export default [
26
28
} ,
27
29
} ,
28
30
} ,
29
- rules : {
30
- ...eslintJs . configs . recommended . rules ,
31
- } ,
32
31
} ,
33
32
// base configuration for node environment source files (*.config.js, etc.)
34
33
{
35
34
files : JSCONFIG_NODE . include ,
36
35
ignores : JSCONFIG_NODE . exclude ,
36
+ extends : [ eslintJs . configs . recommended ] ,
37
37
languageOptions : {
38
38
globals : {
39
39
...globals . node ,
@@ -49,31 +49,21 @@ export default [
49
49
} ,
50
50
} ,
51
51
rules : {
52
- ...eslintJs . configs . recommended . rules ,
53
52
"no-console" : "off" ,
54
53
} ,
55
54
} ,
56
- // React configuration
57
- {
58
- files : JSCONFIG . include ,
59
- ...eslintReact . configs . recommended ,
60
- } ,
61
- // React Hooks configuration
55
+ // react specific configurations
62
56
{
63
57
files : JSCONFIG . include ,
58
+ extends : [
59
+ eslintReact . configs . recommended ,
60
+ eslintPluginReactRefresh . configs . recommended ,
61
+ ] ,
64
62
plugins : {
65
63
"react-hooks" : eslintPluginReactHooks ,
66
64
} ,
67
- rules : eslintPluginReactHooks . configs . recommended . rules ,
68
- } ,
69
- // React Refresh configuration
70
- {
71
- files : JSCONFIG . include ,
72
- plugins : {
73
- "react-refresh" : eslintPluginReactRefresh ,
74
- } ,
75
65
rules : {
76
- "react-refresh/only-export-components" : "warn" ,
66
+ ... eslintPluginReactHooks . configs . recommended . rules ,
77
67
} ,
78
68
} ,
79
- ] ;
69
+ ] ) ;
0 commit comments