1+ /* eslint-disable perfectionist/sort-objects */
12import {
23 GLOB_ASTRO_TS ,
34 GLOB_MARKDOWN ,
@@ -88,23 +89,79 @@ export async function react(
8889 name : 'coderwyd/react/rules' ,
8990 rules : {
9091 'react-compiler/react-compiler' : 'warn' ,
91- // recommended rules from @eslint -react/dom
92- 'react-dom/no-children-in-void-dom-elements' : 'warn' ,
92+
93+ // recommended rules from eslint-plugin-react-x https://eslint-react.xyz/docs/rules/overview#core-rules
94+ 'react/no-access-state-in-setstate' : 'error' ,
95+ 'react/no-array-index-key' : 'warn' ,
96+ 'react/no-children-count' : 'warn' ,
97+ 'react/no-children-for-each' : 'warn' ,
98+ 'react/no-children-map' : 'warn' ,
99+ 'react/no-children-only' : 'warn' ,
100+ 'react/no-children-to-array' : 'warn' ,
101+ 'react/no-clone-element' : 'warn' ,
102+ 'react/no-comment-textnodes' : 'warn' ,
103+ 'react/no-component-will-mount' : 'error' ,
104+ 'react/no-component-will-receive-props' : 'error' ,
105+ 'react/no-component-will-update' : 'error' ,
106+ 'react/no-context-provider' : 'warn' ,
107+ 'react/no-create-ref' : 'error' ,
108+ 'react/no-default-props' : 'error' ,
109+ 'react/no-direct-mutation-state' : 'error' ,
110+ 'react/no-duplicate-jsx-props' : 'warn' ,
111+ 'react/no-duplicate-key' : 'warn' ,
112+ 'react/no-forward-ref' : 'warn' ,
113+ 'react/no-implicit-key' : 'warn' ,
114+ 'react/no-missing-key' : 'error' ,
115+ 'react/no-nested-component-definitions' : 'error' ,
116+ 'react/no-prop-types' : 'error' ,
117+ 'react/no-redundant-should-component-update' : 'error' ,
118+ 'react/no-set-state-in-component-did-mount' : 'warn' ,
119+ 'react/no-set-state-in-component-did-update' : 'warn' ,
120+ 'react/no-set-state-in-component-will-update' : 'warn' ,
121+ 'react/no-string-refs' : 'error' ,
122+ 'react/no-unsafe-component-will-mount' : 'warn' ,
123+ 'react/no-unsafe-component-will-receive-props' : 'warn' ,
124+ 'react/no-unsafe-component-will-update' : 'warn' ,
125+ 'react/no-unstable-context-value' : 'warn' ,
126+ 'react/no-unstable-default-props' : 'warn' ,
127+ 'react/no-unused-class-component-members' : 'warn' ,
128+ 'react/no-unused-state' : 'warn' ,
129+ 'react/no-use-context' : 'warn' ,
130+ 'react/no-useless-forward-ref' : 'warn' ,
131+ 'react/use-jsx-vars' : 'warn' ,
132+
133+ // recommended rules from eslint-plugin-react-dom https://eslint-react.xyz/docs/rules/overview#dom-rules
93134 'react-dom/no-dangerously-set-innerhtml' : 'warn' ,
94135 'react-dom/no-dangerously-set-innerhtml-with-children' : 'error' ,
95-
96136 'react-dom/no-find-dom-node' : 'error' ,
137+ 'react-dom/no-flush-sync' : 'error' ,
138+ 'react-dom/no-hydrate' : 'error' ,
97139 'react-dom/no-missing-button-type' : 'warn' ,
98140 'react-dom/no-missing-iframe-sandbox' : 'warn' ,
99141 'react-dom/no-namespace' : 'error' ,
142+ 'react-dom/no-render' : 'error' ,
100143 'react-dom/no-render-return-value' : 'error' ,
101144 'react-dom/no-script-url' : 'warn' ,
102145 'react-dom/no-unsafe-iframe-sandbox' : 'warn' ,
103146 'react-dom/no-unsafe-target-blank' : 'warn' ,
104- // recommended rules react-hooks
147+ 'react-dom/no-use-form-state' : 'error' ,
148+ 'react-dom/no-void-elements-with-children' : 'error' ,
149+
150+ // recommended rules eslint-plugin-react-hooks https://github.com/facebook/react/tree/main/packages/eslint-plugin-react-hooks/src/rules
105151 'react-hooks/exhaustive-deps' : 'warn' ,
106152 'react-hooks/rules-of-hooks' : 'error' ,
107- // react refresh
153+
154+ // recommended rules from eslint-plugin-react-hooks-extra https://eslint-react.xyz/docs/rules/overview#hooks-extra-rules
155+ 'react-hooks-extra/no-direct-set-state-in-use-effect' : 'warn' ,
156+ 'react-hooks-extra/no-unnecessary-use-prefix' : 'warn' ,
157+
158+ // recommended rules from eslint-plugin-react-web-api https://eslint-react.xyz/docs/rules/overview#web-api-rules
159+ 'react-web-api/no-leaked-event-listener' : 'warn' ,
160+ 'react-web-api/no-leaked-interval' : 'warn' ,
161+ 'react-web-api/no-leaked-resize-observer' : 'warn' ,
162+ 'react-web-api/no-leaked-timeout' : 'warn' ,
163+
164+ // preconfigured rules from eslint-plugin-react-refresh https://github.com/ArnaudBarre/eslint-plugin-react-refresh/tree/main/src
108165 'react-refresh/only-export-components' : [
109166 'warn' ,
110167 {
@@ -134,56 +191,6 @@ export async function react(
134191 } ,
135192 ] ,
136193
137- // recommended rules from @eslint -react/web-api
138- 'react-web-api/no-leaked-event-listener' : 'warn' ,
139-
140- 'react-web-api/no-leaked-interval' : 'warn' ,
141- 'react-web-api/no-leaked-resize-observer' : 'warn' ,
142-
143- 'react-web-api/no-leaked-timeout' : 'warn' ,
144-
145- // recommended rules from @eslint -react
146- 'react/ensure-forward-ref-using-ref' : 'warn' ,
147- 'react/jsx-no-duplicate-props' : 'warn' ,
148- 'react/jsx-uses-vars' : 'warn' ,
149- 'react/no-access-state-in-setstate' : 'error' ,
150- 'react/no-array-index-key' : 'warn' ,
151- 'react/no-children-count' : 'warn' ,
152- 'react/no-children-for-each' : 'warn' ,
153- 'react/no-children-map' : 'warn' ,
154- 'react/no-children-only' : 'warn' ,
155- 'react/no-children-to-array' : 'warn' ,
156- 'react/no-clone-element' : 'warn' ,
157- 'react/no-comment-textnodes' : 'warn' ,
158- 'react/no-component-will-mount' : 'error' ,
159- 'react/no-component-will-receive-props' : 'error' ,
160- 'react/no-component-will-update' : 'error' ,
161- 'react/no-context-provider' : 'warn' ,
162- 'react/no-create-ref' : 'error' ,
163- 'react/no-default-props' : 'error' ,
164- 'react/no-direct-mutation-state' : 'error' ,
165- 'react/no-duplicate-key' : 'error' ,
166- 'react/no-forward-ref' : 'warn' ,
167- 'react/no-implicit-key' : 'warn' ,
168- 'react/no-missing-key' : 'error' ,
169- 'react/no-nested-components' : 'error' ,
170- 'react/no-prop-types' : 'error' ,
171- 'react/no-redundant-should-component-update' : 'error' ,
172- 'react/no-set-state-in-component-did-mount' : 'warn' ,
173- 'react/no-set-state-in-component-did-update' : 'warn' ,
174- 'react/no-set-state-in-component-will-update' : 'warn' ,
175- 'react/no-string-refs' : 'error' ,
176- 'react/no-unsafe-component-will-mount' : 'warn' ,
177- 'react/no-unsafe-component-will-receive-props' : 'warn' ,
178- 'react/no-unsafe-component-will-update' : 'warn' ,
179- 'react/no-unstable-context-value' : 'warn' ,
180- 'react/no-unstable-default-props' : 'warn' ,
181- 'react/no-unused-class-component-members' : 'warn' ,
182- 'react/no-unused-state' : 'warn' ,
183- 'react/prefer-destructuring-assignment' : 'warn' ,
184- 'react/prefer-shorthand-boolean' : 'warn' ,
185- 'react/prefer-shorthand-fragment' : 'warn' ,
186-
187194 // overrides
188195 ...overrides ,
189196 } ,
@@ -193,7 +200,7 @@ export async function react(
193200 {
194201 files : filesTypeAware ,
195202 ignores : ignoresTypeAware ,
196- name : 'coderwyd /react/type-aware-rules' ,
203+ name : 'antfu /react/type-aware-rules' ,
197204 rules : {
198205 ...typeAwareRules ,
199206 } ,
0 commit comments