React
React TSX rules. Bundles rules from eslint-plugin-react, eslint-plugin-react-hooks, and eslint-plugin-react-refresh under one namespace, matching Oxlintβs react/* plugin layout. Performance-only rules live separately in the React performance family because they are opt-in toggles rather than correctness checks.
Source: eslint-plugin-react (MIT), eslint-plugin-react-hooks (MIT), eslint-plugin-react-refresh (MIT).
react/button-has-type: Require explicit, validtypevalues on JSX<button>elements ("button","submit","reset"), the HTML default of"submit"causes accidental form submissions.react/component-hook-factories: Reject declaring a component or custom Hook inside another component or Hook body.react/display-name: require components wrapped inReact.memo(...)orReact.forwardRef(...)to be named, either by passing a named function, assigning the call to a named binding, or setting an explicitdisplayName.react/exhaustive-deps: Detect high-confidence missing identifiers in React Hook dependency arrays (useEffect,useLayoutEffect,useInsertionEffect,useMemo,useCallback).react/iframe-missing-sandbox: Require JSX<iframe>elements to declare asandboxattribute, which restricts what embedded content can do (scripts, forms, navigation).react/immutability: Reject mutating props, state, or Hook return values inside a component or Hook.react/jsx-key: Requirekeyprops on JSX elements produced from arrays or.map(...)calls, React uses the key to track list identity across renders.react/jsx-no-duplicate-props: Reject duplicate JSX prop names on the same element, later occurrences silently overwrite earlier ones.react/jsx-no-script-url: Rejectjavascript:URLs in JSX URL-like props such ashrefandsrc.react/jsx-no-target-blank: Reject<a target="_blank">(or any JSX element withtarget="_blank") that does not also carryrel="noreferrer"(orrel="noopener noreferrer").react/jsx-no-undef: reject JSX elements whose tag is an uppercase identifier with no value-level declaration anywhere in the source file.react/jsx-no-useless-fragment: reject JSX fragments that wrap exactly one element child or have no meaningful content. The child (or nothing) can be returned directly.react/no-array-index-key: Rejectkey={index}patterns inside JSX lists, array index keys reorder incorrectly on insertion.react/no-children-prop: Reject passing children through an explicitchildrenJSX prop.react/no-danger: RejectdangerouslySetInnerHTMLaltogether.react/no-danger-with-children: Reject combiningdangerouslySetInnerHTMLwith JSX children, React throws at runtime in this case.react/no-direct-mutation-state: Reject direct writes tothis.stateoutside constructor initialization.react/no-find-dom-node: RejectfindDOMNode(...)calls.react/no-is-mounted: Rejectthis.isMounted()calls on class components.react/no-string-refs: Reject string-form JSX refs (ref="myInput").react/no-unescaped-entities: Reject unescaped>,",', and}characters in JSX text content, they render literally and almost always come from forgotten HTML escaping.react/only-export-components: Keep React Fast Refresh component modules from exporting non-component values.react/refs: Reject reading or writingref.currentduring render.react/rules-of-hooks: Enforce the Rules of Hooks: only call Hooks at the top level of a component or custom Hook, never inside conditionals, loops, or nested functions.react/set-state-in-effect: Reject unconditionalsetStatecalls inuseEffectbodies.react/set-state-in-render: Reject callingsetStateduring render.react/style-prop-object: Reject string-formstylevalues such asstyle="color: red".react/use-memo: RejectuseMemocalculation callbacks that do not return a value.react/void-dom-elements-no-children: RejectchildrenordangerouslySetInnerHTMLon void DOM elements (<img>,<br>,<input>, etc.).
Last updated on