What's Changed
💥 Breaking Changes
Target Environment Updates: Now ESM and ESLint Flat Config Only
- Drop support for CommonJS (CJS) module format, packages are now distributed only as ECMAScript Modules (ESM)
- Drop support for ESLint legacy config system, packages now support only ESLint Flat Config (
eslint.config.js
) - Drop support for Node.js 18, minimum required version is now Node.js 20
- Drop support for ESLint 8, minimum required version is now ESLint 9.3.6
- Drop support for TypeScript 4, minimum required version is now TypeScript 5.9.2
The following rules have been removed:
react-x/no-complicated-conditional-rendering
(discontinued)
The following rules have been renamed:
react-x/ensure-forward-ref-using-ref
toreact-x/no-useless-forward-ref
react-x/no-comment-textnodes
toreact-x/jsx-no-comment-textnodes
react-x/no-duplicate-props
toreact-x/jsx-no-duplicate-props
react-x/no-nested-components
toreact-x/no-nested-component-definitions
react-x/prefer-react-namespace-import
toreact-x/prefer-namespace-import
react-x/use-jsx-vars
toreact-x/jsx-uses-vars
react-dom/no-children-in-void-dom-elements
toreact-dom/no-void-elements-with-children
The following rules have been consolidated into new rules:
react-x/jsx-shorthand-boolean
replacesavoid-shorthand-boolean
andprefer-shorthand-boolean
react-x/jsx-shorthand-fragment
replacesavoid-shorthand-fragment
andprefer-shorthand-fragment
react-hooks-extra/no-direct-set-state-in-use-effect
replacesno-direct-set-state-in-use-layout-effect
The following rules have been moved from react-hooks-extra
to react-x
:
react-hooks-extra/no-unnecessary-use-callback
toreact-x/no-unnecessary-use-callback
react-hooks-extra/no-unnecessary-use-memo
toreact-x/no-unnecessary-use-memo
react-hooks-extra/no-unnecessary-use-prefix
toreact-x/no-unnecessary-use-prefix
react-hooks-extra/prefer-use-state-lazy-initialization
toreact-x/prefer-use-state-lazy-initialization
The following presets have been removed:
core
(replaced byx
)off-dom
(replaced bydisable-dom
)
The following settings have been removed from settings["react-x"]
:
additionalComponents
(discontinued)additionalHooks
(discontinued)skipImportCheck
(discontinued)
Rules previously using these settings have been refactored to use improved heuristics and no longer require manual configuration.
Reference for Removed: https://eslint-react.xyz/docs/removed
✨ New Features
Added the following new rules:
react-x/jsx-shorthand-boolean
: Enforces a consistent style for boolean attributes (@Rel1cx)react-x/jsx-shorthand-fragment
: Enforces a consistent style for React Fragments (@Rel1cx)react-x/no-forbidden-props
: Disallows specific props on components (@reteps)react-x/no-unnecessary-key
: Reports unnecessarykey
props on elements (@Rel1cx, @kachkaev)react-x/no-unused-props
: Reports unused props in components (@ulrichstark)react-dom/no-string-style-prop
: Disallows string values for thestyle
prop (@Rel1cx, @karlhorky)react-dom/prefer-namespace-import
: Enforces using a namespace import forreact-dom
(@Rel1cx)
The following new rule has been added to the recommended-type-checked
preset:
react-x/no-unused-props
: Reports unused props in components
The following rules now support Codemod features:
react-x/no-component-did-update
(@Rel1cx)react-x/no-component-will-receive-props
(@Rel1cx)react-x/no-component-will-update
(@Rel1cx)react-x/no-context-provider
(@Rel1cx)react-x/no-forward-ref
(@Rel1cx)react-x/no-string-refs
(@Rel1cx)
The following rules now support auto-fix:
react-x/no-missing-context-display-name
(@k-yle)
The following rules now support suggestion fixes:
react-dom/no-missing-button-type
(@Rel1cx)react-dom/no-missing-iframe-sandbox
(@Rel1cx)react-dom/no-unsafe-target-blank
(@Rel1cx)
New configuration preset added:
disable-conflict-eslint-plugin-react
: Disables rules ineslint-plugin-react
that conflict with rules in our plugins (@reteps)
🐞 Bug Fixes
fix(react-x/no-unnecessary-use-prefix)
: Fixed a false positive for React Hooks defined within the callback function ofvi.mock(...)
in Vitest test files (@Rel1cx)fix(react-web-api/no-leaked-event-listener)
: Fixed theuseEffect
setup function check to correctly handleReact.useEffect()
calls (@Rel1cx)fix(react-naming-convention/filename)
: Fixed a false positive on well-known filenames like404.tsx
,_app.tsx
,[slug].tsx
(@Rel1cx)
🪄 Improvements
- refactor: Simplified the React API detection logic (@Rel1cx)
- refactor: Cleaned up utilities and simplified rule implementations (@Rel1cx)
- docs: Added a comparison table between
eslint-plugin-react
andeslint-react
rules (@reteps) - docs: Replaced
tseslint.config
withdefineConfig
in all examples (@Rel1cx) - build: Migrated the build system from
tsup
totsdown
for better performance (@Rel1cx)
Full Changelog: v1.53.1...v2.0.0
Thanks to all contributors who made this release possible!