Skip to main content
These rules help you avoid common performance pitfalls in React applications, from unnecessary re-renders to expensive animations.

Rules

Severity: warn
Rule ID: react-doctor/no-inline-prop-on-memo-component
Detects inline functions, objects, arrays, or JSX passed as props to components wrapped in React.memo(). These create new references every render, breaking memoization.Bad:
Good:
Severity: warn
Rule ID: react-doctor/no-usememo-simple-expression
Flags useMemo wrapping trivially cheap expressions. The overhead of useMemo (function call, dependency comparison) exceeds the computation cost.Bad:
Good:
Severity: error
Rule ID: react-doctor/no-layout-property-animation
Prevents animating CSS properties that trigger layout recalculation: width, height, top, left, padding, margin, etc. These cause expensive reflows on every frame.Bad:
Good:
Layout properties detected: width, height, top, left, right, bottom, padding, margin, border, fontSize, lineHeight, gap.
Severity: warn
Rule ID: react-doctor/no-transition-all
Flags transition: "all" which animates every property including expensive layout properties.Bad:
Good:
Severity: error
Rule ID: react-doctor/no-global-css-variable-animation
Prevents updating CSS variables in requestAnimationFrame or setInterval. This forces style recalculation on all inheriting elements every frame.Bad:
Good:
Severity: warn
Rule ID: react-doctor/no-large-animated-blur
Warns on blur() filters over 10px. Blur is GPU-intensive and cost escalates with radius and layer size. Can exceed GPU memory on mobile.Bad:
Good:
Severity: warn
Rule ID: react-doctor/no-scale-from-zero
Suggests using scale: 0.95 with opacity: 0 instead of scale: 0 for more natural entrance animations.Bad:
Good:
Severity: warn
Rule ID: react-doctor/no-permanent-will-change
Detects permanent will-change declarations. will-change wastes GPU memory and should only be applied during active animations.Bad:
Good:
Severity: warn
Rule ID: react-doctor/rerender-memo-with-default-value
Catches default prop values {} or [] in destructured props. These create new references every render.Bad:
Good:
Severity: warn
Rule ID: react-doctor/rendering-hydration-no-flicker
Prevents useEffect(() => setState(...), []) pattern that causes a flash during hydration. The effect runs after the initial render, causing a second render.Bad:
Good:

JavaScript Performance Rules

React Doctor also includes general JavaScript performance rules:
  • react-doctor/async-parallel - Use Promise.all() for independent async operations
  • react-doctor/js-combine-iterations - Combine chained map/filter calls
  • react-doctor/js-tosorted-immutable - Use toSorted() instead of […arr].sort()
  • react-doctor/js-hoist-regexp - Hoist RegExp out of loops
  • react-doctor/js-set-map-lookups - Use Set/Map for O(1) lookups in loops