github Rel1cx/eslint-react v2.0.0
v2.0.0 (2025-09-26)

4 hours ago

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 to react-x/no-useless-forward-ref
  • react-x/no-comment-textnodes to react-x/jsx-no-comment-textnodes
  • react-x/no-duplicate-props to react-x/jsx-no-duplicate-props
  • react-x/no-nested-components to react-x/no-nested-component-definitions
  • react-x/prefer-react-namespace-import to react-x/prefer-namespace-import
  • react-x/use-jsx-vars to react-x/jsx-uses-vars
  • react-dom/no-children-in-void-dom-elements to react-dom/no-void-elements-with-children

The following rules have been consolidated into new rules:

  • react-x/jsx-shorthand-boolean replaces avoid-shorthand-boolean and prefer-shorthand-boolean
  • react-x/jsx-shorthand-fragment replaces avoid-shorthand-fragment and prefer-shorthand-fragment
  • react-hooks-extra/no-direct-set-state-in-use-effect replaces no-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 to react-x/no-unnecessary-use-callback
  • react-hooks-extra/no-unnecessary-use-memo to react-x/no-unnecessary-use-memo
  • react-hooks-extra/no-unnecessary-use-prefix to react-x/no-unnecessary-use-prefix
  • react-hooks-extra/prefer-use-state-lazy-initialization to react-x/prefer-use-state-lazy-initialization

The following presets have been removed:

  • core (replaced by x)
  • off-dom (replaced by disable-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 unnecessary key 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 the style prop (@Rel1cx, @karlhorky)
  • react-dom/prefer-namespace-import: Enforces using a namespace import for react-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 in eslint-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 of vi.mock(...) in Vitest test files (@Rel1cx)
  • fix(react-web-api/no-leaked-event-listener): Fixed the useEffect setup function check to correctly handle React.useEffect() calls (@Rel1cx)
  • fix(react-naming-convention/filename): Fixed a false positive on well-known filenames like 404.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 and eslint-react rules (@reteps)
  • docs: Replaced tseslint.config with defineConfig in all examples (@Rel1cx)
  • build: Migrated the build system from tsup to tsdown for better performance (@Rel1cx)

Full Changelog: v1.53.1...v2.0.0

Thanks to all contributors who made this release possible!

Don't miss a new eslint-react release

NewReleases is sending notifications on new releases.