Skip to content

React rules ​

These 4 rules layer on top of SAFE-TS's core rules, which also apply inside .tsx/.jsx components and custom hooks (.ts files importing react). All React rules default to errors in the oxlint preset.

Not duplicated here because eslint-plugin-react-hooks and standard JSX lint rules already cover them: rules of hooks, effect dependency arrays, state updates during render, and list key props. Reading potentially undefined values in JSX is already type-checked by tsc, and React 19 blocks javascript: URLs in href and src directly (Security).

Core rules you'll meet in React components ​

RuleIn a component
must-use-resulta Result returned to an event prop (onClick={save}) (Errors)
uncaught-propagationa PropagateError leaving an event handler (Errors)
floating-rejectionan async handler that can reject (Errors)
no-param-mutationchanging props (State)
no-mutable-globalstate at the top of a module (State)
unhandled-failureJSON.parse in JSX (Setup)
listener-cleanuplisteners, intervals and observers an effect starts and never stops (Cleanup)

MIT OR Apache-2.0 · Docs by Gemini 4 Neon Extra