Skip to content

Commit cb4ab6f

Browse files
committed
fix: update recommended rules and fix rule names in eslint-plugin configurations
1 parent c5e4c2b commit cb4ab6f

File tree

5 files changed

+73
-60
lines changed

5 files changed

+73
-60
lines changed

apps/website/content/docs/rules/overview.mdx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ The `jsx-*` rules check for issues exclusive to JSX syntax, which are absent fro
3232
| Rule || 🌟 | Description | `react` |
3333
| :----------------------------------------------------------------------------------- | :-- | :-------: | :-------------------------------------------------------------------------------------------------- | :------: |
3434
| [`jsx-key-before-spread`](./jsx-key-before-spread) | 1️⃣ | | Enforces that the `key` attribute is placed before the spread attribute in JSX elements | |
35+
| [`jsx-no-comment-textnodes`](./jsx-no-comment-textnodes) | 1️⃣ | | Prevents comments from being inserted as text nodes | |
3536
| [`jsx-no-duplicate-props`](./jsx-no-duplicate-props) | 1️⃣ | | Disallow duplicate props in JSX elements | |
3637
| [`jsx-no-iife`](./jsx-no-iife) | 0️⃣ | `🧪` | Disallows `IIFE` in JSX elements | |
3738
| [`jsx-no-undef`](./jsx-no-undef) | 0️⃣ | | Disallow undefined variables in JSX elements | |
@@ -49,8 +50,6 @@ The `jsx-*` rules check for issues exclusive to JSX syntax, which are absent fro
4950
| [`no-children-to-array`](./no-children-to-array) | 1️⃣ | | Disallow `Children.toArray` | |
5051
| [`no-class-component`](./no-class-component) | 0️⃣ | | Disallow class components except for error boundaries | |
5152
| [`no-clone-element`](./no-clone-element) | 1️⃣ | | Disallow `cloneElement` | |
52-
| [`no-comment-textnodes`](./no-comment-textnodes) | 1️⃣ | | Prevents comments from being inserted as text nodes | |
53-
| [`no-complex-conditional-rendering`](./no-complex-conditional-rendering) | 0️⃣ | `🧪` | Disallow complex conditional rendering in JSX expressions | |
5453
| [`no-component-will-mount`](./no-component-will-mount) | 2️⃣ | `🔄` | Replaces usages of `componentWillMount` with `UNSAFE_componentWillMount` | >=16.3.0 |
5554
| [`no-component-will-receive-props`](./no-component-will-receive-props) | 2️⃣ | `🔄` | Replaces usages of `componentWillReceiveProps` with `UNSAFE_componentWillReceiveProps` | >=16.3.0 |
5655
| [`no-component-will-update`](./no-component-will-update) | 2️⃣ | `🔄` | Replaces usages of `componentWillUpdate` with `UNSAFE_componentWillUpdate` | >=16.3.0 |
@@ -88,7 +87,7 @@ The `jsx-*` rules check for issues exclusive to JSX syntax, which are absent fro
8887
| [`no-useless-forward-ref`](./no-useless-forward-ref) | 1️⃣ | | Disallow useless `forwardRef` calls on components that don't use `ref`s | |
8988
| [`no-useless-fragment`](./no-useless-fragment) | 0️⃣ | `🔧` `⚙️` | Disallow useless fragment elements | |
9089
| [`prefer-destructuring-assignment`](./prefer-destructuring-assignment) | 0️⃣ | | Enforces destructuring assignment for component props and context | |
91-
| [`prefer-react-namespace-import`](./prefer-react-namespace-import) | 0️⃣ | `🔧` | Enforces React is imported via a namespace import | |
90+
| [`prefer-namespace-import`](./prefer-namespace-import) | 0️⃣ | `🔧` | Enforces React is imported via a namespace import | |
9291
| [`prefer-read-only-props`](./prefer-read-only-props) | 0️⃣ | `💭` | Enforces read-only props in components | |
9392
| [`prefer-use-state-lazy-initialization`](./prefer-use-state-lazy-initialization) | 1️⃣ | | Enforces function calls made inside `useState` to be wrapped in an `initializer function` | |
9493

packages/plugins/eslint-plugin-react-hooks-extra/README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ export default tseslint.config({
3535
},
3636
rules: {
3737
// Put rules you want to override here
38-
"react-hooks-extra/no-unnecessary-use-prefix": "warn",
39-
"react-hooks-extra/prefer-use-state-lazy-initialization": "warn",
4038
},
4139
});
4240
```

packages/plugins/eslint-plugin-react-hooks-extra/src/configs/recommended.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@ export const name = "react-hooks-extra/recommended";
44

55
export const rules = {
66
"react-hooks-extra/no-direct-set-state-in-use-effect": "warn",
7-
"react-hooks-extra/no-unnecessary-use-prefix": "warn",
87
} as const satisfies RulePreset;

packages/plugins/eslint-plugin-react-x/src/configs/recommended.ts

Lines changed: 61 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -4,58 +4,67 @@ import { DEFAULT_ESLINT_REACT_SETTINGS } from "@eslint-react/shared";
44
export const name = "react-x/recommended";
55

66
export const rules = {
7-
"react-x/jsx-key-before-spread": "warn",
8-
"react-x/jsx-no-comment-textnodes": "warn",
9-
"react-x/jsx-no-duplicate-props": "warn",
10-
// "react-x/jsx-no-undef": "error",
11-
"react-x/jsx-uses-react": "warn",
12-
"react-x/jsx-uses-vars": "warn",
13-
"react-x/no-access-state-in-setstate": "error",
14-
"react-x/no-array-index-key": "warn",
15-
"react-x/no-children-count": "warn",
16-
"react-x/no-children-for-each": "warn",
17-
"react-x/no-children-map": "warn",
18-
"react-x/no-children-only": "warn",
19-
// "react-x/no-children-prop": "warn",
20-
"react-x/no-children-to-array": "warn",
21-
// "react-x/no-class-component": "warn",
22-
"react-x/no-clone-element": "warn",
23-
"react-x/no-component-will-mount": "error",
24-
"react-x/no-component-will-receive-props": "error",
25-
"react-x/no-component-will-update": "error",
26-
"react-x/no-context-provider": "warn",
27-
"react-x/no-create-ref": "error",
28-
"react-x/no-default-props": "error",
29-
"react-x/no-direct-mutation-state": "error",
30-
// "react-x/prefer-destructuring-assignment": "warn",
31-
// "react-x/prefer-namespace-import": "warn",
32-
// "react-x/prefer-read-only-props": "error",
33-
"react-x/no-duplicate-key": "warn",
34-
"react-x/no-forward-ref": "warn",
35-
"react-x/no-implicit-key": "warn",
36-
// "react-x/no-missing-component-display-name": "warn",
37-
// "react-x/no-missing-context-display-name": "warn",
38-
"react-x/no-missing-key": "error",
39-
// "react-x/no-misused-capture-owner-stack": "error",
40-
"react-x/no-nested-component-definitions": "error",
41-
"react-x/no-nested-lazy-component-declarations": "warn",
42-
"react-x/no-prop-types": "error",
43-
"react-x/no-redundant-should-component-update": "error",
44-
"react-x/no-set-state-in-component-did-mount": "warn",
45-
"react-x/no-set-state-in-component-did-update": "warn",
46-
"react-x/no-set-state-in-component-will-update": "warn",
47-
"react-x/no-string-refs": "error",
48-
"react-x/no-unnecessary-use-prefix": "warn",
49-
"react-x/no-unsafe-component-will-mount": "warn",
50-
"react-x/no-unsafe-component-will-receive-props": "warn",
51-
"react-x/no-unsafe-component-will-update": "warn",
52-
"react-x/no-unstable-context-value": "warn",
53-
"react-x/no-unstable-default-props": "warn",
54-
"react-x/no-unused-class-component-members": "warn",
55-
"react-x/no-unused-state": "warn",
56-
"react-x/no-use-context": "warn",
57-
"react-x/no-useless-forward-ref": "warn",
58-
"react-x/prefer-use-state-lazy-initialization": "warn",
7+
"@eslint-react/jsx-key-before-spread": "warn",
8+
"@eslint-react/jsx-no-comment-textnodes": "warn",
9+
"@eslint-react/jsx-no-duplicate-props": "warn",
10+
// "@eslint-react/jsx-no-iife": "warn",
11+
// "@eslint-react/jsx-no-undef": "error",
12+
// "@eslint-react/jsx-shorthand-boolean": "warn",
13+
// "@eslint-react/jsx-shorthand-fragment": "warn",
14+
"@eslint-react/jsx-uses-react": "warn",
15+
"@eslint-react/jsx-uses-vars": "warn",
16+
17+
"@eslint-react/no-access-state-in-setstate": "error",
18+
"@eslint-react/no-array-index-key": "warn",
19+
"@eslint-react/no-children-count": "warn",
20+
"@eslint-react/no-children-for-each": "warn",
21+
"@eslint-react/no-children-map": "warn",
22+
"@eslint-react/no-children-only": "warn",
23+
// "@eslint-react/no-children-prop": "warn",
24+
"@eslint-react/no-children-to-array": "warn",
25+
// "@eslint-react/no-class-component": "warn",
26+
"@eslint-react/no-clone-element": "warn",
27+
"@eslint-react/no-comment-textnodes": "warn",
28+
"@eslint-react/no-component-will-mount": "error",
29+
"@eslint-react/no-component-will-receive-props": "error",
30+
"@eslint-react/no-component-will-update": "error",
31+
"@eslint-react/no-context-provider": "warn",
32+
"@eslint-react/no-create-ref": "error",
33+
"@eslint-react/no-default-props": "error",
34+
"@eslint-react/no-direct-mutation-state": "error",
35+
"@eslint-react/no-duplicate-key": "error",
36+
"@eslint-react/no-forward-ref": "warn",
37+
"@eslint-react/no-implicit-key": "warn",
38+
// "@eslint-react/no-leaked-conditional-rendering": "warn",
39+
// "@eslint-react/no-missing-component-display-name": "warn",
40+
// "@eslint-react/no-missing-context-display-name": "warn",
41+
"@eslint-react/no-missing-key": "error",
42+
// "@eslint-react/no-misused-capture-owner-stack": "error",
43+
"@eslint-react/no-nested-component-definitions": "error",
44+
"@eslint-react/no-nested-lazy-component-declarations": "error",
45+
"@eslint-react/no-prop-types": "error",
46+
"@eslint-react/no-redundant-should-component-update": "error",
47+
"@eslint-react/no-set-state-in-component-did-mount": "warn",
48+
"@eslint-react/no-set-state-in-component-did-update": "warn",
49+
"@eslint-react/no-set-state-in-component-will-update": "warn",
50+
"@eslint-react/no-string-refs": "error",
51+
// "@eslint-react/no-unnecessary-use-callback": "warn",
52+
// "@eslint-react/no-unnecessary-use-memo": "warn",
53+
"@eslint-react/no-unnecessary-use-prefix": "warn",
54+
"@eslint-react/no-unsafe-component-will-mount": "warn",
55+
"@eslint-react/no-unsafe-component-will-receive-props": "warn",
56+
"@eslint-react/no-unsafe-component-will-update": "warn",
57+
"@eslint-react/no-unstable-context-value": "warn",
58+
"@eslint-react/no-unstable-default-props": "warn",
59+
"@eslint-react/no-unused-class-component-members": "warn",
60+
"@eslint-react/no-unused-state": "warn",
61+
"@eslint-react/no-use-context": "warn",
62+
"@eslint-react/no-useless-forward-ref": "warn",
63+
// "@eslint-react/no-useless-fragment": "warn",
64+
// "@eslint-react/prefer-destructuring-assignment": "warn",
65+
// "@eslint-react/prefer-namespace-import": "warn",
66+
// "@eslint-react/prefer-read-only-props": "error",
67+
"@eslint-react/prefer-use-state-lazy-initialization": "warn",
5968
} as const satisfies RulePreset;
6069

6170
export const settings = {

packages/plugins/eslint-plugin/src/configs/all.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,16 @@ import * as x from "./x";
1010
export const name = "@eslint-react/all";
1111

1212
export const rules = {
13+
"@eslint-react/jsx-key-before-spread": "warn",
1314
"@eslint-react/jsx-no-comment-textnodes": "warn",
1415
"@eslint-react/jsx-no-duplicate-props": "warn",
1516
"@eslint-react/jsx-no-iife": "warn",
1617
"@eslint-react/jsx-no-undef": "error",
18+
"@eslint-react/jsx-shorthand-boolean": "warn",
19+
"@eslint-react/jsx-shorthand-fragment": "warn",
1720
"@eslint-react/jsx-uses-react": "warn",
1821
"@eslint-react/jsx-uses-vars": "warn",
22+
1923
"@eslint-react/no-access-state-in-setstate": "error",
2024
"@eslint-react/no-array-index-key": "warn",
2125
"@eslint-react/no-children-count": "warn",
@@ -26,22 +30,24 @@ export const rules = {
2630
"@eslint-react/no-children-to-array": "warn",
2731
"@eslint-react/no-class-component": "warn",
2832
"@eslint-react/no-clone-element": "warn",
33+
"@eslint-react/no-comment-textnodes": "warn",
2934
"@eslint-react/no-component-will-mount": "error",
3035
"@eslint-react/no-component-will-receive-props": "error",
3136
"@eslint-react/no-component-will-update": "error",
3237
"@eslint-react/no-context-provider": "warn",
3338
"@eslint-react/no-create-ref": "error",
3439
"@eslint-react/no-default-props": "error",
3540
"@eslint-react/no-direct-mutation-state": "error",
36-
"@eslint-react/no-duplicate-key": "warn",
41+
"@eslint-react/no-duplicate-key": "error",
3742
"@eslint-react/no-forward-ref": "warn",
3843
"@eslint-react/no-implicit-key": "warn",
44+
// "@eslint-react/no-leaked-conditional-rendering": "warn",
3945
"@eslint-react/no-missing-component-display-name": "warn",
4046
"@eslint-react/no-missing-context-display-name": "warn",
4147
"@eslint-react/no-missing-key": "error",
4248
"@eslint-react/no-misused-capture-owner-stack": "error",
4349
"@eslint-react/no-nested-component-definitions": "error",
44-
"@eslint-react/no-nested-lazy-component-declarations": "warn",
50+
"@eslint-react/no-nested-lazy-component-declarations": "error",
4551
"@eslint-react/no-prop-types": "error",
4652
"@eslint-react/no-redundant-should-component-update": "error",
4753
"@eslint-react/no-set-state-in-component-did-mount": "warn",
@@ -60,8 +66,10 @@ export const rules = {
6066
"@eslint-react/no-unused-state": "warn",
6167
"@eslint-react/no-use-context": "warn",
6268
"@eslint-react/no-useless-forward-ref": "warn",
69+
"@eslint-react/no-useless-fragment": "warn",
6370
"@eslint-react/prefer-destructuring-assignment": "warn",
6471
"@eslint-react/prefer-namespace-import": "warn",
72+
// "@eslint-react/prefer-read-only-props": "error",
6573
"@eslint-react/prefer-use-state-lazy-initialization": "warn",
6674

6775
"@eslint-react/hooks-extra/no-direct-set-state-in-use-effect": "warn",

0 commit comments

Comments
 (0)