Skip to Content
logoESLint React

Migrating from eslint-plugin-react-hooks

Complete guide for migrating from eslint-plugin-react-hooks to ESLint React

This guide provides a comprehensive comparison between eslint-plugin-react-hooks and ESLint React rules to help you migrate your existing configuration.

Overview

ESLint React provides direct equivalents for the core rules in eslint-plugin-react-hooks, including both the classic hooks linting rules (exhaustive-deps, rules-of-hooks) and many of the newer React Compiler diagnostic rules introduced in the latest versions of the plugin.

Rules specific to the React Compiler runtime (such as config, gating, incompatible-library, and preserve-manual-memoization) do not have equivalents in ESLint React, as they validate compiler-specific configuration and behavior.

Rule Comparison Table

Legend

  • ๐Ÿ”ง Fully supported - Rule is supported, and has an auto-fix
  • ๐ŸŸข Mostly supported - Rule is supported but doesn't have an auto-fix
  • ๐ŸŸก Partial support - Similar but not identical functionality
  • ๐Ÿ”ด Not supported - No equivalent rule
  • ๐Ÿงช Experimental - Rule is supported but marked as experimental

Table

The following table compares all documented rules from eslint-plugin-react-hooks with their ESLint React equivalents (see Notes for the exact scope):

eslint-plugin-react-hooks Rule NameNew Rule NameStatus
exhaustive-depsexhaustive-deps๐Ÿ”ง
rules-of-hooksrules-of-hooks๐ŸŸข
config๐Ÿ”ด
error-boundarieserror-boundaries๐ŸŸก
gating๐Ÿ”ด
globalsglobals๐ŸŸก ๐Ÿงช
immutabilityimmutability๐ŸŸก ๐Ÿงช
incompatible-library๐Ÿ”ด
preserve-manual-memoization๐Ÿ”ด
puritypurity๐ŸŸก
refsrefs๐ŸŸก ๐Ÿงช
set-state-in-effectset-state-in-effect๐ŸŸก
set-state-in-renderset-state-in-render๐Ÿงช
static-componentsstatic-components๐Ÿงช
unsupported-syntaxunsupported-syntax๐ŸŸข
use-memouse-memo๐ŸŸก

ESLint React Column

  • Rule names link to ESLint React documentation
  • Multiple rules separated by + indicate that together they provide equivalent functionality
  • Rules marked ๐Ÿงช are experimental and their behavior may change in future releases
  • Rules marked ๐Ÿ”ด are React Compiler-specific and have no equivalent in ESLint React

Notes

  • This table covers the documented rules of eslint-plugin-react-hooks, i.e. the ones listed on react.dev and enabled by its recommended preset. The upstream package additionally ships void-use-memo (enabled only in its recommended-latest preset; partially covered by use-memo), a deprecated component-hook-factories alias of static-components, and several off-by-default internal diagnostic rules.
  • The ๐Ÿ”ง auto-fix of exhaustive-deps is gated behind the enableDangerousAutofixThisMayCauseInfiniteLoops option; by default the rule provides editor suggestions instead. See the rule documentation for details.
  • Rules marked ๐ŸŸก have verified behavioral divergences from their upstream counterparts, tracked in each rule's *.spec.diff.md comparison report in the repository.

Migration Preset

ESLint React provides a preset to disable conflicting rules from eslint-plugin-react-hooks:

  • disable-conflict-eslint-plugin-react-hooks - Disables all rules from eslint-plugin-react-hooks that have equivalents in ESLint React (e.g., react-hooks/exhaustive-deps, react-hooks/rules-of-hooks, etc.)

This preset is useful when migrating from eslint-plugin-react-hooks to ESLint React, as it prevents rule conflicts while you transition your configuration.