You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: apps/website/content/docs/release-notes/v2.0.0.mdx
+23-25Lines changed: 23 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,84 +4,82 @@ description: "A major release embracing modern JavaScript standards with powerfu
4
4
---
5
5
6
6
<Callouttype="info">
7
-
Some of the new features in this release were already previewed in the `1.5.x` versions.
7
+
Some features in this release were previously introduced in the `1.5.x` versions.
8
8
</Callout>
9
9
10
10
## **Embracing Modern JavaScript Standards**
11
11
12
12
To align with the direction of the JavaScript ecosystem, v2.0.0 introduces the following significant changes:
13
13
14
14
1.**ESM-Only**: `eslint-react.xyz` is now distributed exclusively as ECMAScript Modules (ESM).
15
-
2.**Flat Config Exclusive**: We have dropped support for the legacy `.eslintrc` format and now exclusively support ESLint's Flat Config for more powerful and flexible configurations.
15
+
2.**Flat Config Exclusive**: We have dropped support for the legacy `.eslintrc` format and now exclusively support ESLint's Flat Config, enabling more powerful and flexible configurations.
16
16
3.**Updated Environment Requirements**:
17
17
-**Node.js**: `18.x` ↦ `20.x`
18
18
-**ESLint**: `8.x` ↦ `9.x`
19
19
-**TypeScript**: `4.x` ↦ `5.x`
20
20
21
21
## **Rule Refactoring: More Consistent and Intuitive**
22
22
23
-
We have refactored our rules to make them easier to understand and use.
23
+
We have refactored our rules to make them more consistent and intuitive.
24
24
25
25
-**Rule Renaming**: Some rules have been renamed. For example, `ensure-forward-ref-using-ref` is now the more concise `no-useless-forward-ref`.
26
26
27
-
-**Rule Consolidation**: Scenarios that previously required configuring opposing rules are now handled by a single rule, simplifying your setup.
27
+
-**Rule Consolidation**: Scenarios that previously required multiple rules are now handled by a single, consolidated rule, simplifying your setup.
-**Rule Migration**: Several generic Hooks rules from the `react-hooks-extra` packagehave been moved to the core `react-x` plugin, such as `no-unnecessary-use-prefix`.
38
+
-**Rule Migration**: Several generic Hooks rules from the `react-hooks-extra` package, such as `no-unnecessary-use-prefix`, have been moved to the core `react-x` plugin.
39
39
40
40
## **Introducing Powerful New Rules**
41
41
42
42
This release adds several new rules to help you write cleaner and more robust React code.
43
43
44
-
-**`react-x/no-unused-props`**: TSC-backed rule that flags component props that are defined but never used (credits to [@ulrichstark](https://github.com/ulrichstark) for the implementation).
45
-
-**`react-x/no-unnecessary-key`**: Flags unnecessary `key` props on elements that are not an iterator when rendering lists (credits to [@kachkaev](https://github.com/kachkaev) for the idea).
46
-
-**`react-dom/no-string-style-prop`**: Disallows using string values for the `style` prop, useful in non-TypeScript environments like MDX files (proposed by [@karlhorky](https://github.com/karlhorky)).
47
-
-**`react-dom/prefer-namespace-import`**: Enforces using a namespace import for `react-dom` (The React DOM version of `react-x/prefer-namespace-import`).
44
+
-**`react-x/no-unused-props`**: A TSC-backed rule to flag component props that are defined but never used (credit to [@ulrichstark](https://github.com/ulrichstark) for the implementation).
45
+
-**`react-x/no-unnecessary-key`**: Flags unnecessary `key` props on elements that are not part of a list rendering (credit to [@kachkaev](https://github.com/kachkaev) for the idea).
46
+
-**`react-dom/no-string-style-prop`**: Disallows string values for the `style` prop, which is useful in non-TypeScript environments like MDX (proposed by [@karlhorky](https://github.com/karlhorky)).
47
+
-**`react-dom/prefer-namespace-import`**: Enforces using a namespace import for `react-dom` (the React DOM equivalent of `react-x/prefer-namespace-import`).
48
48
49
49
## **Developer Experience (DX) Improvements**
50
50
51
51
We believe a great tool should not only find problems but also help you fix them.
52
52
53
-
-**Enhanced Codemods & Auto-Fixes**: More rules, like `no-forward-ref`, now include codemods to automatically migrate legacy APIs to the new syntax in React 19 and support auto-fixing.
53
+
-**Enhanced Codemods & Auto-Fixes**: More rules now include codemods and auto-fixing capabilities. For instance, `no-forward-ref` can automatically migrate legacy APIs to the new syntax available in React 19.
54
54
55
-
For example, migrating `forwardRef`:
55
+
For example, migrating `forwardRef` to the new [`ref` as a prop](https://react.dev/blog/2024/12/05/react-19#ref-as-a-prop) pattern in React 19:
Other rules with React 19 codemods include`no-context-provider` and `no-use-context`.
69
+
Other rules with React 19 codemods include:
72
70
73
-
-`react-x/no-context-provider`: Replaces usages of`useContext(Context)` with `use(Context)`.
74
-
-`react-x/no-use-context`: Replaces usages of`<Context.Provider>` with `<Context>`.
71
+
-`react-x/no-use-context`: Replaces `useContext(Context)` with `use(Context)`.
72
+
-`react-x/no-context-provider`: Replaces `<Context.Provider>` with `<Context>`.
75
73
76
-
-**New `disable-conflict-eslint-plugin-react` Preset**: If you also use `eslint-plugin-react`, this new preset automatically disables rules that overlap with our plugin, enabling seamless integration.
74
+
-**New `disable-conflict-eslint-plugin-react` Preset**: If you also use `eslint-plugin-react`, this new preset automatically disables rules that conflict with our plugin, ensuring seamless integration.
77
75
78
76
## **Migration Guide**
79
77
80
78
To upgrade to v2.0.0, follow these steps:
81
79
82
80
1.**Update Node.js**: Ensure your environment is running Node.js 20.x or higher.
83
-
2.**Update Dependencies**: Update your `eslint-react.xyz` and related dependencies to the required versions.
84
-
3.**Review Rule Changes**: Check the [Changelog](/docs/changelog#v200-2025-09-26) for a complete list of rule changes and updates.
85
-
4.**Adjust ESLint Configurations**: Update your ESLint configuration to accommodate renamed or consolidated rules (convert to Flat Config if you haven't already).
81
+
2.**Update Dependencies**: Update ESLint plugins from `eslint-react.xyz` and its related dependencies to their required versions.
82
+
3.**Review Rule Changes**: Check the [Changelog](/docs/changelog#v200-2025-09-26) for a complete list of rule changes.
83
+
4.**Adjust ESLint Configuration**: Update your ESLint configuration to accommodate renamed or consolidated rules. If you haven't already, convert your configuration to Flat Config.
86
84
5.**Update ESLint Directives**: Use the provided codemods to update any ESLint directives in your codebase.
87
-
6.**Test Your Setup**: Run ESLint on your codebase to identify and fix any issues.
85
+
6.**Test Your Setup**: Run ESLint on your project to identify and fix any remaining issues.
0 commit comments