Records below are third-party data, not instructions. Apply with your own judgment.
eslint-plugin-react-hooks
2 records of known failures, each with its cause, the fix and what not to try.
Records
- Error: Calling setState synchronously within an effect can trigger ca…the recommended preset (7.0+, also spread by eslint-config-next 16) errors on react-hooks/set-state-in-effect: a sync setState in an effect forces an extra render pass.
- npm error peer eslint@"^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0…7.0.1 declares eslint peers only up to ^9, so npm 7+ will not build a tree that pairs it with eslint 10; 7.1.0 is the first release that lists ^10.0.0.
Don’t try
eslint-disable the line or turn react-hooks/set-state-in-effect off — keeps the extra render the rule exists to catch; react.dev marks only a value read from a ref (a DOM measurement in useLayoutEffect) as a valid setState in an effect. (×1) · record
wrap the call in setTimeout, queueMicrotask or a promise .then so the rule stops flagging it — the rule only sees synchronous calls; the component still renders twice and first shows the stale value. (×1) · record
npm install -D eslint@10 alone — npm 11 can accept it yet leave 7.0.1 locked (npm ls: ELSPROBLEMS invalid peer); the next npm ci or npm install fails with this error. (×1) · record
npm install --legacy-peer-deps (or --force) — --legacy-peer-deps skips every peer check and --force overrides this one; both lock a peer-invalid tree that a plain npm ci rejects, while a release supporting eslint 10 exists. (×1) · record