Inline object/array/function literal in a dependency array
Part of Code Quality & Syntax, which counts for 20% of the overall score. When this check fires it deducts 4 points from that category, once per scan, no matter how many places it turns up.
What it detects
A fresh object, array, arrow, or new-expression inside a hook dependency array gets a new identity on every render, so the dependency always looks changed and the effect/memo re-runs every time, defeating its purpose. Heuristic: matches when the deps array closes on the same line.
Why it matters
A hook dependency array that contains an inline object, array, arrow function, or new expression gets a brand new value on every render, so the dependency always compares as changed and the effect, useMemo, or useCallback re-runs every time. That defeats the point of the dependency array and can cascade into extra renders. This is a heuristic that matches when the deps array closes on the same line.
How to fix it
Move the inline value out of the dependency array. Memoize objects and arrays with useMemo, memoize callbacks with useCallback, or depend on the primitive fields you actually need rather than the whole object. Keep only stable references in the array.
The paid report includes a ready-to-paste prompt for your AI coding agent for every check it finds, pointed at the exact findings from your scan. See pricing
Does your repo trip this check?
Paste a GitHub URL or drop a project folder. Scans run in your browser and take seconds.
Scan your repo