@@ -5,6 +5,7 @@ import {setFilesIfUndef} from './util.js';
5
5
/** @var {Linter.Config[]} */
6
6
const reactConfig = [
7
7
pluginReact . configs . flat . recommended ,
8
+ pluginReact . configs . flat [ 'jsx-runtime' ] ,
8
9
{
9
10
plugins : {
10
11
'react-hooks' : {
@@ -17,9 +18,13 @@ const reactConfig = [
17
18
} ,
18
19
} ,
19
20
{
21
+ settings : {
22
+ react : {
23
+ version : 'detect' ,
24
+ } ,
25
+ } ,
20
26
rules : {
21
27
'react/button-has-type' : 'error' ,
22
- 'react/jsx-child-element-spacing' : 'error' ,
23
28
'react/default-props-match-prop-types' : 'error' ,
24
29
'react/function-component-definition' : [
25
30
'error' ,
@@ -75,42 +80,6 @@ const reactConfig = [
75
80
] ,
76
81
'react/void-dom-elements-no-children' : 'error' ,
77
82
'react/jsx-boolean-value' : 'error' ,
78
- 'react/jsx-closing-bracket-location' : [
79
- 'error' ,
80
- {
81
- nonEmpty : 'tag-aligned' ,
82
- selfClosing : false ,
83
- } ,
84
- ] ,
85
- 'react/jsx-closing-tag-location' : 'error' ,
86
- 'react/jsx-curly-newline' : [
87
- 'error' ,
88
- {
89
- multiline : 'consistent' ,
90
- singleline : 'forbid' ,
91
- } ,
92
- ] ,
93
- 'react/jsx-curly-spacing' : [
94
- 'error' ,
95
- 'never' ,
96
- ] ,
97
- 'react/jsx-equals-spacing' : [
98
- 'error' ,
99
- 'never' ,
100
- ] ,
101
- 'react/jsx-first-prop-new-line' : 'error' ,
102
- 'react/jsx-indent' : [
103
- 'error' ,
104
- 'tab' ,
105
- {
106
- checkAttributes : true ,
107
- indentLogicalExpressions : true ,
108
- } ,
109
- ] ,
110
- 'react/jsx-indent-props' : [
111
- 'error' ,
112
- 'tab' ,
113
- ] ,
114
83
'react/jsx-key' : [
115
84
'error' ,
116
85
{
@@ -119,13 +88,6 @@ const reactConfig = [
119
88
warnOnDuplicates : true ,
120
89
} ,
121
90
] ,
122
- 'react/jsx-max-props-per-line' : [
123
- 'error' ,
124
- {
125
- maximum : 3 ,
126
- when : 'multiline' ,
127
- } ,
128
- ] ,
129
91
'react/jsx-no-bind' : [
130
92
'error' ,
131
93
{
@@ -152,14 +114,6 @@ const reactConfig = [
152
114
'react/jsx-no-useless-fragment' : 'error' ,
153
115
// Disabled for now as it produces too many errors
154
116
// 'react/jsx-one-expression-per-line': ['error', {allow: 'single-child'}],
155
- 'react/jsx-curly-brace-presence' : [
156
- 'error' ,
157
- {
158
- props : 'never' ,
159
- children : 'never' ,
160
- propElementValues : 'always' ,
161
- } ,
162
- ] ,
163
117
'react/jsx-fragments' : [
164
118
'error' ,
165
119
'syntax' ,
@@ -175,29 +129,8 @@ const reactConfig = [
175
129
reservedFirst : true ,
176
130
} ,
177
131
] ,
178
- 'react/jsx-tag-spacing' : [
179
- 'error' ,
180
- {
181
- closingSlash : 'never' ,
182
- beforeSelfClosing : 'never' ,
183
- afterOpening : 'never' ,
184
- beforeClosing : 'never' ,
185
- } ,
186
- ] ,
187
132
'react/jsx-uses-react' : 'error' ,
188
133
'react/jsx-uses-vars' : 'error' ,
189
- 'react/jsx-wrap-multilines' : [
190
- 'error' ,
191
- {
192
- declaration : 'parens-new-line' ,
193
- assignment : 'parens-new-line' ,
194
- return : 'parens-new-line' ,
195
- arrow : 'parens-new-line' ,
196
- condition : 'ignore' ,
197
- logical : 'ignore' ,
198
- prop : 'ignore' ,
199
- } ,
200
- ] ,
201
134
202
135
'react-hooks/rules-of-hooks' : 'error' ,
203
136
'react-hooks/exhaustive-deps' : 'warn' ,
@@ -214,6 +147,66 @@ const reactConfig = [
214
147
// Not so convenient in significant amount of cases to
215
148
// prefix boolean prop with `is` or `has`.
216
149
'react/boolean-prop-naming' : 'off' ,
150
+
151
+ // name is taken from constant name or function name
152
+ 'react/display-name' : 'off' ,
153
+
154
+ // controlled by stylistic
155
+ 'react/jsx-indent' : 'off' ,
156
+ 'react/jsx-closing-bracket-location' : 'off' ,
157
+ 'react/jsx-closing-tag-location' : 'off' ,
158
+ 'react/jsx-curly-brace-presence' : 'off' ,
159
+ 'react/jsx-curly-newline' : 'off' ,
160
+ 'react/jsx-curly-spacing' : 'off' ,
161
+ 'react/jsx-equals-spacing' : 'off' ,
162
+ 'react/jsx-first-prop-new-line' : 'off' ,
163
+ 'react/jsx-function-call-newline' : 'off' ,
164
+ 'react/jsx-indent-props' : 'off' ,
165
+ 'react/jsx-max-props-per-line' : 'off' ,
166
+ 'react/jsx-one-expression-per-line' : 'off' ,
167
+ 'react/jsx-quotes' : 'off' ,
168
+ 'react/jsx-tag-spacing' : 'off' ,
169
+ 'react/jsx-wrap-multilines' : 'off' ,
170
+ 'react/jsx-child-element-spacing' : 'off' ,
171
+
172
+ '@stylistic/jsx-indent' : [ 'error' , 'tab' , {
173
+ indentLogicalExpressions : true ,
174
+ checkAttributes : false ,
175
+ } ] ,
176
+ '@stylistic/jsx-closing-bracket-location' : [ 'error' , 'after-props' ] ,
177
+ '@stylistic/jsx-closing-tag-location' : 'error' ,
178
+ '@stylistic/jsx-curly-brace-presence' : [ 'error' , { propElementValues : 'always' } ] ,
179
+ '@stylistic/jsx-curly-newline' : 'error' ,
180
+ '@stylistic/jsx-curly-spacing' : [ 'error' , 'never' ] ,
181
+ '@stylistic/jsx-equals-spacing' : 'error' ,
182
+ '@stylistic/jsx-first-prop-new-line' : 'error' ,
183
+ '@stylistic/jsx-function-call-newline' : [ 'error' , 'multiline' ] ,
184
+ '@stylistic/jsx-indent-props' : [ 'error' , 'tab' ] ,
185
+ '@stylistic/jsx-max-props-per-line' : [ 'error' , { maximum : 1 , when : 'multiline' } ] ,
186
+ '@stylistic/jsx-one-expression-per-line' : [ 'error' , { allow : 'non-jsx' } ] ,
187
+ '@stylistic/jsx-quotes' : 'error' ,
188
+ '@stylistic/jsx-tag-spacing' : [
189
+ 'error' ,
190
+ {
191
+ afterOpening : 'never' ,
192
+ beforeClosing : 'never' ,
193
+ beforeSelfClosing : 'always' ,
194
+ closingSlash : 'never' ,
195
+ } ,
196
+ ] ,
197
+ '@stylistic/jsx-wrap-multilines' : [
198
+ 'error' ,
199
+ {
200
+ arrow : 'parens-new-line' ,
201
+ assignment : 'parens-new-line' ,
202
+ condition : 'parens-new-line' ,
203
+ declaration : 'parens-new-line' ,
204
+ logical : 'parens-new-line' ,
205
+ prop : 'parens-new-line' ,
206
+ propertyValue : 'parens-new-line' ,
207
+ return : 'parens-new-line' ,
208
+ } ,
209
+ ] ,
217
210
} ,
218
211
} ,
219
212
] ;
0 commit comments