@@ -6,7 +6,7 @@ import eslintPluginReactHooks from 'eslint-plugin-react-hooks';
6
6
import simpleImportSort from 'eslint-plugin-simple-import-sort' ;
7
7
import tseslint from 'typescript-eslint' ;
8
8
9
- export default tseslint . config (
9
+ export const baseConfig = tseslint . config (
10
10
{
11
11
extends : [
12
12
eslint . configs . recommended ,
@@ -15,26 +15,8 @@ export default tseslint.config(
15
15
plugins : {
16
16
'@stylistic' : stylistic ,
17
17
'simple-import-sort' : simpleImportSort ,
18
- 'jsx-a11y' : pluginJsxA11y ,
19
- react,
20
- 'react-hooks' : eslintPluginReactHooks , // TODO Check if eslint/compat is needed here
21
- } ,
22
- languageOptions : {
23
- parserOptions : {
24
- ecmaFeatures : {
25
- jsx : true ,
26
- } ,
27
- } ,
28
- } ,
29
- settings : {
30
- react : {
31
- version : 'detect'
32
- }
33
18
} ,
34
19
rules : {
35
- ...pluginJsxA11y . configs . recommended . rules ,
36
- ...eslintPluginReactHooks . configs . recommended . rules ,
37
-
38
20
'@stylistic/arrow-parens' : 'error' ,
39
21
'@stylistic/arrow-spacing' : 'error' ,
40
22
'@stylistic/block-spacing' : 'error' ,
@@ -77,8 +59,6 @@ export default tseslint.config(
77
59
} ] ,
78
60
79
61
// Disabled rules from presets
80
- 'react/display-name' : [ 'off' , { 'ignoreTranspilerName' : false } ] ,
81
- 'react/prop-types' : 'off' ,
82
62
'@typescript-eslint/ban-types' : 'off' ,
83
63
'@typescript-eslint/no-explicit-any' : 'off' ,
84
64
} ,
@@ -88,8 +68,48 @@ export default tseslint.config(
88
68
rules : {
89
69
'prefer-promise-reject-errors' : 'off' ,
90
70
'no-param-reassign' : 'off' ,
71
+ '@typescript-eslint/no-shadow' : 'off' ,
72
+ } ,
73
+ } ,
74
+ ) ;
75
+
76
+ export const reactConfig = tseslint . config (
77
+ {
78
+ plugins : {
79
+ 'jsx-a11y' : pluginJsxA11y ,
80
+ react,
81
+ 'react-hooks' : eslintPluginReactHooks ,
82
+ } ,
83
+ languageOptions : {
84
+ parserOptions : {
85
+ ecmaFeatures : {
86
+ jsx : true ,
87
+ } ,
88
+ } ,
89
+ } ,
90
+ settings : {
91
+ react : {
92
+ version : 'detect'
93
+ }
94
+ } ,
95
+ rules : {
96
+ ...pluginJsxA11y . configs . recommended . rules ,
97
+ ...eslintPluginReactHooks . configs . recommended . rules ,
98
+
99
+ // Disabled rules from presets
100
+ 'react/display-name' : [ 'off' , { 'ignoreTranspilerName' : false } ] ,
101
+ 'react/prop-types' : 'off' ,
102
+ } ,
103
+ } ,
104
+ {
105
+ files : [ '*.test.*' , '*.spec.*' ] ,
106
+ rules : {
91
107
'react/no-children-prop' : 'off' ,
92
- '@typescript-eslint/no-shadow' : 'off'
93
- }
108
+ } ,
94
109
} ,
95
110
) ;
111
+
112
+ export default tseslint . config (
113
+ ...baseConfig ,
114
+ ...reactConfig ,
115
+ ) ;
0 commit comments