Capítulo 47 de 116
Each rule in the plugin targets one specific way component/Hook code can violate the Rules of React — from the classic "don't call Hooks conditionally" to newer checks for purity, immutability, and correct effect timing that React Compiler also depends on.
| Rule | What it flags |
|---|---|
rules-of-hooks | Hooks called conditionally, in loops, or after an early return — violates the fixed-call-order requirement (Ch 116). |
exhaustive-deps | An Effect/callback dependency array missing a reactive value the function body actually reads (Ch 38, Ch 40). |
purity | Component or Hook bodies that perform side effects or non-deterministic reads during render, violating Ch 18's purity rule. |
immutability | Code that mutates props, state, or other values React expects to be treated as read-only (Ch 25/26). |
set-state-in-render | Calling a state setter unconditionally during the render body itself, rather than in a handler/Effect. |
set-state-in-effect | An Effect whose only job is setting state that could instead be computed directly during render — the Ch 37 anti-pattern, caught mechanically. |
refs | Reading or writing ref.current during render instead of in an event handler/Effect (Ch 34). |
static-components | Defining a component function inside another component's body (Ch 11's "never nest component definitions" rule). |
component-hook-factories | Functions that dynamically generate components or Hooks at runtime in ways that break the Rules of React's static-structure assumptions. |
error-boundaries | Patterns around error boundary components that don't follow the required class-component error-boundary contract. |
incompatible-library | Usage patterns from libraries known to conflict with the Rules of React or with compiler optimization assumptions. |
preserve-manual-memoization | Existing manual useMemo/useCallback that the compiler can't safely preserve/subsume as-is. |
unsupported-syntax | Language syntax the compiler's static analysis can't yet handle, flagged so the affected code is excluded from optimization rather than silently mishandled. |
use-memo | Checks specific to correct useMemo usage patterns (e.g. dependency correctness, no side effects inside the memoized calculation). |
exhaustive-deps and rules-of-hooks are the two long-standing, must-never-disable rules; the rest are largely about the newer, broader Rules-of-React surface.