react-hooks-js/globals

Validates against assignment/mutation of globals during render, part of ensuring that [side effects must render outside of render](https://react.dev/reference/rules/components-and-hooks-must-be-pure#side-effects-must-run-outside-of-render)

Validation prompt

Use this to decide whether a fired diagnostic is real or a false positive.

Fires on assignments or mutations to module-scope let/var bindings, frozen const-object properties, or window/globalThis/document.X writes during the synchronous body of a component or hook — e.g. let renderCount; renderCount++ at the top of a component, or window.user = id mid-render. False positive: the mutation lives inside a useEffect, event handler, or async callback rather than executing during render itself.

Fix prompt

Use this once validation confirms the diagnostic is real.

Move mutable per-component state into useState/useReducer (or useRef for non-rendering scratchpads); move DOM and window writes into useEffect (or useLayoutEffect when the write must precede paint, e.g. document.title). For cross-component values, lift to context via createContext + useContext. Globals mutated during render break Fast Refresh, StrictMode double-invocation, and the React Compiler. See https://react.dev/reference/eslint-plugin-react-hooks/lints/globals