Skip to content

Commit 7a56064

Browse files
committed
feat: add new React linting rules and update existing ones
1 parent 6e80115 commit 7a56064

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/configs/react.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ export async function react(
8484
name: 'coderwyd/react/rules',
8585
rules: {
8686
// recommended rules from eslint-plugin-react-x https://eslint-react.xyz/docs/rules/overview#core-rules
87+
'react/jsx-no-comment-textnodes': 'warn',
88+
'react/jsx-no-duplicate-props': 'warn',
89+
'react/jsx-uses-vars': 'warn',
8790
'react/no-access-state-in-setstate': 'error',
8891
'react/no-array-index-key': 'warn',
8992
'react/no-children-count': 'warn',
@@ -92,15 +95,13 @@ export async function react(
9295
'react/no-children-only': 'warn',
9396
'react/no-children-to-array': 'warn',
9497
'react/no-clone-element': 'warn',
95-
'react/no-comment-textnodes': 'warn',
9698
'react/no-component-will-mount': 'error',
9799
'react/no-component-will-receive-props': 'error',
98100
'react/no-component-will-update': 'error',
99101
'react/no-context-provider': 'warn',
100102
'react/no-create-ref': 'error',
101103
'react/no-default-props': 'error',
102104
'react/no-direct-mutation-state': 'error',
103-
'react/no-duplicate-jsx-props': 'warn',
104105
'react/no-duplicate-key': 'warn',
105106
'react/no-forward-ref': 'warn',
106107
'react/no-implicit-key': 'warn',
@@ -112,6 +113,7 @@ export async function react(
112113
'react/no-set-state-in-component-did-update': 'warn',
113114
'react/no-set-state-in-component-will-update': 'warn',
114115
'react/no-string-refs': 'error',
116+
'react/no-unnecessary-use-prefix': 'warn',
115117
'react/no-unsafe-component-will-mount': 'warn',
116118
'react/no-unsafe-component-will-receive-props': 'warn',
117119
'react/no-unsafe-component-will-update': 'warn',
@@ -121,7 +123,7 @@ export async function react(
121123
'react/no-unused-state': 'warn',
122124
'react/no-use-context': 'warn',
123125
'react/no-useless-forward-ref': 'warn',
124-
'react/use-jsx-vars': 'warn',
126+
'react/prefer-use-state-lazy-initialization': 'warn',
125127

126128
// recommended rules from eslint-plugin-react-dom https://eslint-react.xyz/docs/rules/overview#dom-rules
127129
'react-dom/no-dangerously-set-innerhtml': 'warn',
@@ -143,11 +145,9 @@ export async function react(
143145
// recommended rules eslint-plugin-react-hooks https://github.com/facebook/react/tree/main/packages/eslint-plugin-react-hooks/src/rules
144146
'react-hooks/exhaustive-deps': 'warn',
145147
'react-hooks/rules-of-hooks': 'error',
146-
'react-hooks/react-compiler': 'warn',
147148

148149
// recommended rules from eslint-plugin-react-hooks-extra https://eslint-react.xyz/docs/rules/overview#hooks-extra-rules
149150
'react-hooks-extra/no-direct-set-state-in-use-effect': 'warn',
150-
'react-hooks-extra/no-unnecessary-use-prefix': 'warn',
151151

152152
// recommended rules from eslint-plugin-react-web-api https://eslint-react.xyz/docs/rules/overview#web-api-rules
153153
'react-web-api/no-leaked-event-listener': 'warn',
@@ -204,7 +204,7 @@ export async function react(
204204
{
205205
files: filesTypeAware,
206206
ignores: ignoresTypeAware,
207-
name: 'antfu/react/type-aware-rules',
207+
name: 'coderwyd/react/type-aware-rules',
208208
rules: {
209209
...typeAwareRules,
210210
},

0 commit comments

Comments
 (0)