Skip to main content

React Hooks

Off by default (modules.react = true to enable). Detects Rules of Hooks violations and common React anti-patterns. Prefix: HOOKS-

FindingSeverityWhat it matches
HOOKS-001ErrorHook called inside a condition or loop
HOOKS-002WarninguseEffect without dependency array
HOOKS-003WarningDirect DOM manipulation in component
HOOKS-004WarningMissing key prop in .map()
HOOKS-005WarningdangerouslySetInnerHTML usage
HOOKS-006InfoInline arrow function in event handler
HOOKS-007InfoEmpty dependency array [] in useEffect
// Bad — hook in condition (HOOKS-001)
if (condition) {
const [value, setValue] = useState(null);
}

// Bad — missing deps (HOOKS-002)
useEffect(() => {
fetchData();
});

// Good
useEffect(() => {
fetchData();
}, [userId]);