@@ -5,6 +5,7 @@ import {setFilesIfUndef} from './util.js';
55/** @var {Linter.Config[]} */
66const reactConfig = [
77 pluginReact . configs . flat . recommended ,
8+ pluginReact . configs . flat [ 'jsx-runtime' ] ,
89 {
910 plugins : {
1011 'react-hooks' : {
@@ -17,9 +18,13 @@ const reactConfig = [
1718 } ,
1819 } ,
1920 {
21+ settings : {
22+ react : {
23+ version : 'detect' ,
24+ } ,
25+ } ,
2026 rules : {
2127 'react/button-has-type' : 'error' ,
22- 'react/jsx-child-element-spacing' : 'error' ,
2328 'react/default-props-match-prop-types' : 'error' ,
2429 'react/function-component-definition' : [
2530 'error' ,
@@ -75,42 +80,6 @@ const reactConfig = [
7580 ] ,
7681 'react/void-dom-elements-no-children' : 'error' ,
7782 '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- ] ,
11483 'react/jsx-key' : [
11584 'error' ,
11685 {
@@ -119,13 +88,6 @@ const reactConfig = [
11988 warnOnDuplicates : true ,
12089 } ,
12190 ] ,
122- 'react/jsx-max-props-per-line' : [
123- 'error' ,
124- {
125- maximum : 3 ,
126- when : 'multiline' ,
127- } ,
128- ] ,
12991 'react/jsx-no-bind' : [
13092 'error' ,
13193 {
@@ -152,14 +114,6 @@ const reactConfig = [
152114 'react/jsx-no-useless-fragment' : 'error' ,
153115 // Disabled for now as it produces too many errors
154116 // '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- ] ,
163117 'react/jsx-fragments' : [
164118 'error' ,
165119 'syntax' ,
@@ -175,29 +129,8 @@ const reactConfig = [
175129 reservedFirst : true ,
176130 } ,
177131 ] ,
178- 'react/jsx-tag-spacing' : [
179- 'error' ,
180- {
181- closingSlash : 'never' ,
182- beforeSelfClosing : 'never' ,
183- afterOpening : 'never' ,
184- beforeClosing : 'never' ,
185- } ,
186- ] ,
187132 'react/jsx-uses-react' : 'error' ,
188133 '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- ] ,
201134
202135 'react-hooks/rules-of-hooks' : 'error' ,
203136 'react-hooks/exhaustive-deps' : 'warn' ,
@@ -214,6 +147,66 @@ const reactConfig = [
214147 // Not so convenient in significant amount of cases to
215148 // prefix boolean prop with `is` or `has`.
216149 '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+ ] ,
217210 } ,
218211 } ,
219212] ;
0 commit comments