|
10 | 10 | - Drop support for ESLint 8, minimum required version is now ESLint 9.3.6 |
11 | 11 | - Drop support for TypeScript 4, minimum required version is now TypeScript 5.9.2 |
12 | 12 |
|
13 | | -**Removed Rules** |
14 | | - |
15 | | -| Rule | Replaced by | Reason | |
16 | | -| :----------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------- | :----------- | |
17 | | -| `react-x/avoid-shorthand-boolean` | [`react-x/jsx-shorthand-boolean`](https://eslint-react.xyz/docs/rules/jsx-shorthand-boolean) | consolidated | |
18 | | -| `react-x/avoid-shorthand-fragment` | [`react-x/jsx-shorthand-fragment`](https://eslint-react.xyz/docs/rules/jsx-shorthand-fragment) | consolidated | |
19 | | -| `react-x/ensure-forward-ref-using-ref` | [`react-x/no-useless-forward-ref`](https://eslint-react.xyz/docs/rules/no-useless-forward-ref) | renamed | |
20 | | -| `react-x/jsx-no-duplicate-props` | [`react-x/jsx-no-duplicate-props`](https://eslint-react.xyz/docs/rules/jsx-no-duplicate-props) | renamed | |
21 | | -| `react-x/no-comment-textnodes` | [`react-x/jsx-no-comment-textnodes`](https://eslint-react.xyz/docs/rules/jsx-no-comment-textnodes) | renamed | |
22 | | -| `react-x/no-complicated-conditional-rendering` | | discontinued | |
23 | | -| `react-x/no-nested-components` | [`react-x/no-nested-component-definitions`](https://eslint-react.xyz/docs/rules/no-nested-component-definitions) | renamed | |
24 | | -| `react-x/prefer-react-namespace-import` | [`react-x/prefer-namespace-import`](https://eslint-react.xyz/docs/rules/prefer-namespace-import) | renamed | |
25 | | -| `react-x/prefer-shorthand-boolean` | [`react-x/jsx-shorthand-boolean`](https://eslint-react.xyz/docs/rules/jsx-shorthand-boolean) | consolidated | |
26 | | -| `react-x/prefer-shorthand-fragment` | [`react-x/jsx-shorthand-fragment`](https://eslint-react.xyz/docs/rules/jsx-shorthand-fragment) | consolidated | |
27 | | -| `react-x/use-jsx-vars` | [`react-x/jsx-uses-vars`](https://eslint-react.xyz/docs/rules/jsx-uses-vars) | renamed | |
28 | | -| `react-dom/no-children-in-void-dom-elements` | [`react-dom/no-void-elements-with-children`](https://eslint-react.xyz/docs/rules/dom-no-void-elements-with-children) | renamed | |
29 | | -| `react-hooks-extra/no-direct-set-state-in-use-layout-effect` | [`react-hooks-extra/no-direct-set-state-in-use-effect`](/docs/rules/hooks-extra-no-direct-set-state-in-use-effect) | consolidated | |
30 | | -| `react-hooks-extra/no-unnecessary-use-callback` | [`react-x/no-unnecessary-use-callback`](https://eslint-react.xyz/docs/rules/no-unnecessary-use-callback) | relocated | |
31 | | -| `react-hooks-extra/no-unnecessary-use-memo` | [`react-x/no-unnecessary-use-memo`](https://eslint-react.xyz/docs/rules/no-unnecessary-use-memo) | relocated | |
32 | | -| `react-hooks-extra/no-unnecessary-use-prefix` | [`react-x/no-unnecessary-use-prefix`](https://eslint-react.xyz/docs/rules/no-unnecessary-use-prefix) | relocated | |
33 | | -| `react-hooks-extra/prefer-use-state-lazy-initialization` | [`react-x/prefer-use-state-lazy-initialization`](https://eslint-react.xyz/docs/rules/prefer-use-state-lazy-initialization) | relocated | |
34 | | - |
35 | | -**Removed Presets** |
36 | | - |
37 | | -| Preset | Replaced by | Reason | |
38 | | -| :-------------------------------- | :------------ | :----------- | |
39 | | -| `core` | `x` | renamed | |
40 | | -| `core-legacy` | | discontinued | |
41 | | -| `off-dom` | `disable-dom` | renamed | |
42 | | -| `off-dom-legacy` | | discontinued | |
43 | | -| `x-legacy` | | discontinued | |
44 | | -| `dom-legacy` | | discontinued | |
45 | | -| `web-api-legacy` | | discontinued | |
46 | | -| `recommended-legacy` | | discontinued | |
47 | | -| `recommended-typescript-legacy` | | discontinued | |
48 | | -| `recommended-type-checked-legacy` | | discontinued | |
49 | | - |
50 | | -**Removed Settings** |
51 | | - |
52 | | -| Setting | Replaced by | Reason | |
53 | | -| :--------------------- | :---------- | :----------- | |
54 | | -| `additionalComponents` | | discontinued | |
55 | | -| `additionalHooks` | | discontinued | |
56 | | -| `skipImportCheck` | | discontinued | |
57 | | - |
58 | | -The rule implementations have been refactored to improve performance and maintainability. |
| 13 | +**The following rules have been removed:** |
59 | 14 |
|
60 | | -### ✨ New |
| 15 | +- `react-x/no-complicated-conditional-rendering` (discontinued) |
| 16 | + |
| 17 | +**The following rules have been renamed:** |
| 18 | + |
| 19 | +- `react-x/ensure-forward-ref-using-ref` to `react-x/no-useless-forward-ref` |
| 20 | +- `react-x/no-comment-textnodes` to `react-x/jsx-no-comment-textnodes` |
| 21 | +- `react-x/no-duplicate-props` to `react-x/jsx-no-duplicate-props` |
| 22 | +- `react-x/no-nested-components` to `react-x/no-nested-component-definitions` |
| 23 | +- `react-x/prefer-react-namespace-import` to `react-x/prefer-namespace-import` |
| 24 | +- `react-x/use-jsx-vars` to `react-x/jsx-uses-vars` |
| 25 | +- `react-dom/no-children-in-void-dom-elements` to `react-dom/no-void-elements-with-children` |
| 26 | + |
| 27 | +**The following rules have been consolidated into new rules:** |
| 28 | + |
| 29 | +- `react-x/jsx-shorthand-boolean` replaces `avoid-shorthand-boolean` and `prefer-shorthand-boolean` |
| 30 | +- `react-x/jsx-shorthand-fragment` replaces `avoid-shorthand-fragment` and `prefer-shorthand-fragment` |
| 31 | +- `react-hooks-extra/no-direct-set-state-in-use-effect` replaces `no-direct-set-state-in-use-layout-effect` |
| 32 | + |
| 33 | +**The following rules have been moved from `react-hooks-extra` to `react-x`:** |
| 34 | + |
| 35 | +- `react-hooks-extra/no-unnecessary-use-callback` to `react-x/no-unnecessary-use-callback` |
| 36 | +- `react-hooks-extra/no-unnecessary-use-memo` to `react-x/no-unnecessary-use-memo` |
| 37 | +- `react-hooks-extra/no-unnecessary-use-prefix` to `react-x/no-unnecessary-use-prefix` |
| 38 | +- `react-hooks-extra/prefer-use-state-lazy-initialization` to `react-x/prefer-use-state-lazy-initialization` |
| 39 | + |
| 40 | +**The following presets have been removed:** |
| 41 | + |
| 42 | +- `core` (replaced by `x`) |
| 43 | +- `off-dom` (replaced by `disable-dom`) |
| 44 | + |
| 45 | +**The following settings have been removed from `settings["react-x"]`:** |
| 46 | + |
| 47 | +- `additionalComponents` (discontinued) |
| 48 | +- `additionalHooks` (discontinued) |
| 49 | +- `skipImportCheck` (discontinued) |
| 50 | + |
| 51 | +Rules previously using these settings have been refactored to use improved heuristics and no longer require manual configuration. |
| 52 | + |
| 53 | +**Reference for Removed**: [https://eslint-react.xyz/docs/removed](https://eslint-react.xyz/docs/removed) |
| 54 | + |
| 55 | +### ✨ New Features |
61 | 56 |
|
62 | 57 | **Added the following new rules:** |
63 | 58 |
|
64 | | -- `react-x/jsx-shorthand-boolean`: Enforces a consistent style for boolean attributes by @Rel1cx |
65 | | -- `react-x/jsx-shorthand-fragment`: Enforces a consistent style for React Fragments by @Rel1cx |
66 | | -- `react-x/no-forbidden-props`: Disallows specific props on components by @reteps |
67 | | -- `react-x/no-unnecessary-key`: Reports unnecessary `key` props on elements by @Rel1cx @kachkaev |
68 | | -- `react-x/no-unused-props`: Reports unused props in components by @ulrichstark |
69 | | -- `react-dom/no-string-style-prop`: Disallows string values for the `style` prop by @Rel1cx @karlhorky |
70 | | -- `react-dom/prefer-namespace-import`: Enforces using a namespace import for `react-dom` by @Rel1cx |
| 59 | +- `react-x/jsx-shorthand-boolean`: Enforces a consistent style for boolean attributes (@Rel1cx) |
| 60 | +- `react-x/jsx-shorthand-fragment`: Enforces a consistent style for React Fragments (@Rel1cx) |
| 61 | +- `react-x/no-forbidden-props`: Disallows specific props on components (@reteps) |
| 62 | +- `react-x/no-unnecessary-key`: Reports unnecessary `key` props on elements (@Rel1cx, @kachkaev) |
| 63 | +- `react-x/no-unused-props`: Reports unused props in components (@ulrichstark) |
| 64 | +- `react-dom/no-string-style-prop`: Disallows string values for the `style` prop (@Rel1cx, @karlhorky) |
| 65 | +- `react-dom/prefer-namespace-import`: Enforces using a namespace import for `react-dom` (@Rel1cx) |
71 | 66 |
|
72 | | -**Added the following new rule to the `recommended-type-checked` preset:** |
| 67 | +**The following new rule has been added to the `recommended-type-checked` preset:** |
73 | 68 |
|
74 | 69 | - `react-x/no-unused-props`: Reports unused props in components |
75 | 70 |
|
76 | 71 | **The following rules now support Codemod features:** |
77 | 72 |
|
78 | | -- `react-x/no-component-did-update` by @Rel1cx |
79 | | -- `react-x/no-component-will-receive-props` by @Rel1cx |
80 | | -- `react-x/no-component-will-update` by @Rel1cx |
81 | | -- `react-x/no-context-provider` by @Rel1cx |
82 | | -- `react-x/no-forward-ref` by @Rel1cx |
83 | | -- `react-x/no-string-refs` by @Rel1cx |
| 73 | +- `react-x/no-component-did-update` (@Rel1cx) |
| 74 | +- `react-x/no-component-will-receive-props` (@Rel1cx) |
| 75 | +- `react-x/no-component-will-update` (@Rel1cx) |
| 76 | +- `react-x/no-context-provider` (@Rel1cx) |
| 77 | +- `react-x/no-forward-ref` (@Rel1cx) |
| 78 | +- `react-x/no-string-refs` (@Rel1cx) |
84 | 79 |
|
85 | 80 | **The following rules now support auto-fix:** |
86 | 81 |
|
87 | | -- `react-x/no-missing-context-display-name` by @k-yle |
| 82 | +- `react-x/no-missing-context-display-name` (@k-yle) |
88 | 83 |
|
89 | 84 | **The following rules now support suggestion fixes:** |
90 | 85 |
|
91 | | -- `react-dom/no-missing-button-type` by @Rel1cx |
92 | | -- `react-dom/no-missing-iframe-sandbox` by @Rel1cx |
93 | | -- `react-dom/no-unsafe-target-blank` by @Rel1cx |
| 86 | +- `react-dom/no-missing-button-type` (@Rel1cx) |
| 87 | +- `react-dom/no-missing-iframe-sandbox` (@Rel1cx) |
| 88 | +- `react-dom/no-unsafe-target-blank` (@Rel1cx) |
94 | 89 |
|
95 | 90 | **New configuration preset added:** |
96 | 91 |
|
97 | | -- `disable-conflict-eslint-plugin-react`: Disable rules in `eslint-plugin-react` that conflict with rules in our plugins by @reteps |
| 92 | +- `disable-conflict-eslint-plugin-react`: Disables rules in `eslint-plugin-react` that conflict with rules in our plugins (@reteps) |
98 | 93 |
|
99 | | -### 🐞 Fixes |
| 94 | +### 🐞 Bug Fixes |
100 | 95 |
|
101 | | -- fix(react-x/no-unnecessary-use-prefix): fix false positive of React Hooks defined within the callback function of `vi.mock(...)` in Vitest test files by @Rel1cx |
102 | | -- fix(react-web-api/no-leaked-event-listener): fix `useEffect` setup function check to handle `React.useEffect()` calls correctly by @Rel1cx |
103 | | -- fix(react-naming-convention/filename): fix false positive on well-known filenames like `404.tsx`, `_app.tsx`, `[slug].tsx` by @Rel1cx |
| 96 | +- `fix(react-x/no-unnecessary-use-prefix)`: Fixed a false positive for React Hooks defined within the callback function of `vi.mock(...)` in Vitest test files (@Rel1cx) |
| 97 | +- `fix(react-web-api/no-leaked-event-listener)`: Fixed the `useEffect` setup function check to correctly handle `React.useEffect()` calls (@Rel1cx) |
| 98 | +- `fix(react-naming-convention/filename)`: Fixed a false positive on well-known filenames like `404.tsx`, `_app.tsx`, `[slug].tsx` (@Rel1cx) |
104 | 99 |
|
105 | 100 | ### 🪄 Improvements |
106 | 101 |
|
107 | | -- refactor: simplify React APIs detection logic by @Rel1cx |
108 | | -- refactor: cleanup utilities and simplify rule implementations by @Rel1cx |
109 | | -- docs: add comparison table between `eslint-plugin-react` and `eslint-react` rules by @reteps |
110 | | -- docs: replace `tseslint.config` with `defineConfig` in all examples by @Rel1cx |
111 | | -- build: migrate build system from `tsup` to `tsdown` for better performance by @Rel1cx |
| 102 | +- refactor: Simplified the React API detection logic (@Rel1cx) |
| 103 | +- refactor: Cleaned up utilities and simplified rule implementations (@Rel1cx) |
| 104 | +- docs: Added a comparison table between `eslint-plugin-react` and `eslint-react` rules (@reteps) |
| 105 | +- docs: Replaced `tseslint.config` with `defineConfig` in all examples (@Rel1cx) |
| 106 | +- build: Migrated the build system from `tsup` to `tsdown` for better performance (@Rel1cx) |
112 | 107 |
|
113 | 108 | **Full Changelog**: https://github.com/Rel1cx/eslint-react/compare/v1.53.1...v2.0.0 |
114 | 109 |
|
|
0 commit comments