React Doctor
492 rules react-doctor@0.9.14
Complete effective rule inventory.
Rules
No enabled React Doctor rules match this search.
-
react-doctor/no-unguarded-browser-global-at-module-scopeReading
window/navigator/localStorageat module scope throwsReferenceError: window is not definedwhen the module is imported during SSR. Move the read inside a function/effect, or guard it withtypeof window !== "undefined".: warning in React projects -
react-doctor/no-unguarded-browser-global-in-render-or-hook-initMove browser-only reads into an effect or event, guard them behind a client-only render path, or use useSyncExternalStore with a stable server snapshot.
: error in React projects -
react-doctor/no-unguarded-numeric-input-parseGuard
Number(e.target.value)/parseInt(e.target.value)against empty and NaN before storing it.Number('')is0andNumber('abc')isNaN, both of which silently ship a wrong value.: warning in React projects -
react-doctor/no-uninformative-aria-labelName the action, not the element type:
aria-label="Search", notaria-label="icon"oraria-label="button".: warning in React projects -
react-doctor/no-unknown-propertyUse the prop name React expects, like
className,htmlFor, ortabIndex, so the attribute is applied correctly.: warning in React projects -
react-doctor/no-unowned-async-error-clearGuard async completion by request identity, perform an ownership-aware functional state update, or key the state-owning component by request ID.
: warning in React projects -
react-doctor/no-unsafeMove setup to
constructororcomponentDidMount, prop-derived state togetDerivedStateFromProps, and update side effects tocomponentDidUpdateso React does not rely on deprecated unsafe lifecycles.: warning in React projects -
react-doctor/no-unstable-nested-componentsMove nested components to module scope so React does not remount them and lose state on every render.
: warning in React projects -
react-doctor/no-unthrottled-scroll-mutationUse a scroll or view timeline, IntersectionObserver, or a real timer throttle so animation work does not run for every scroll event.
: warning in React projects -
react-doctor/no-will-update-set-stateAvoid setState in componentWillUpdate because it can loop forever; derive state before render or move guarded updates to componentDidUpdate.
: warning in React projects -
react-doctor/nosql-injection-riskCoerce scalar fields before querying, reject operator keys from client input, and avoid
$whereor request-derived regexes.: warning in React projects -
react-doctor/only-export-componentsMove non-component exports out of component files so Fast Refresh can preserve component state instead of full-reloading.
: warning in React projects -
react-doctor/package-metadata-secretKeep secrets out of package metadata and generated reports; they are often published to registries, logs, or browser artifacts.
: warning in React projects -
react-doctor/path-traversal-riskResolve paths against a fixed base directory, reject traversal after normalization, and map user-visible identifiers to server-owned paths.
: warning in React projects -
react-doctor/plugin-update-trust-riskRequire signed updates/plugins, pin trusted repositories, verify hashes before execution, and keep custom repository installs behind explicit warnings.
: warning in React projects -
react-doctor/pointer-capture-needs-cancel-handlerHandle
onPointerCanceloronLostPointerCapturewith the same cleanup used for pointer-up so interrupted drags cannot stay active.: warning in React projects -
react-doctor/postmessage-origin-riskValidate
event.originagainst an exact allowlist before usingevent.data, especially when an iframe or parent window can be attacker-controlled.: warning in React projects -
react-doctor/preact-no-children-lengthWrap with
toChildArray(children)because Preact'sprops.childrenis not always an array and array methods can crash.: warning in Preact projects -
react-doctor/preact-no-react-hooks-importImport hooks from
preact/hooksso they share Preact's renderer state instead of loading a second hook implementation.: warning in Preact projects -
react-doctor/preact-no-render-argumentsRead from
this.propsandthis.statebecausepreact/compatuses React's parameterlessrender()and positional props/state become undefined.: warning in Preact projects -
react-doctor/preact-prefer-ondblclickRename
onDoubleClicktoonDblClickbecause Preact core listens for the DOMdblclickevent name andonDoubleClicknever fires.: warning in Preact projects -
react-doctor/preact-prefer-oninputReplace
onChangewithonInputon text-like inputs, or usepreact/compatwhich remapsonChangeautomatically.: warning in Preact projects -
react-doctor/prefer-html-dialogReplace the wrapper with
<dialog>and open it withdialog.showModal(). For the trigger, prefer<button commandfor="id" command="show-modal">(Chrome 135+), or auseRefwithdialogRef.current?.showModal().: warning in React projects -
react-doctor/prefer-tag-over-roleUse the matching HTML element when one exists so browsers and assistive tech get native semantics.
: warning in React projects -
react-doctor/public-debug-artifactRemove debug artifacts from public output; logs and dumps often reveal source paths, internal routes, tokens, or environment snapshots.
: warning in React projects -
react-doctor/public-env-secret-namePublic env prefixes are inlined into browser bundles. Rename public values to non-secret names, and keep tokens, passwords, private keys, and service-role credentials server-only.
: warning in React projects -
react-doctor/r3f-cap-device-pixel-ratioCap devicePixelRatio, commonly at 2, or pass an explicit DPR range so high-density displays do not multiply rendering work without a bound
: warning in React projects -
react-doctor/r3f-limit-shadowed-point-lightsKeep at most two shadow-casting point lights in one scene, or replace them with cheaper directional, spot, baked, or fake shadows
: warning in React projects -
react-doctor/r3f-no-advancing-clock-in-use-frameUse the delta argument supplied to useFrame or read clock.elapsedTime without advancing the shared clock
: warning in React projects -
react-doctor/r3f-no-allocation-in-pointer-moveReuse component-owned vectors and Three.js objects while handling pointer movement
: warning in React projects -
react-doctor/r3f-no-async-use-frameKeep useFrame synchronous; start asynchronous work outside the render loop and consume its completed state from the callback
: warning in React projects -
react-doctor/r3f-no-clone-in-use-frameClone once outside the frame loop or reuse a scratch vector, quaternion, matrix, or object allocated with useMemo or useRef
: warning in React projects -
react-doctor/r3f-no-compile-in-use-framePrecompile scene materials outside useFrame before they are first displayed
: error in React projects -
react-doctor/r3f-no-deep-use-three-selectorSelect the stable R3F store object, then read its mutable Three.js fields where they are consumed
: warning in React projects -
react-doctor/r3f-no-dispose-loader-cacheDo not dispose assets returned by cached R3F and Drei loader hooks
: warning in React projects -
react-doctor/r3f-no-duplicate-primitive-objectMount a Three.js object through one <primitive>, or clone it deliberately when two independent instances are required
: warning in React projects -
react-doctor/r3f-no-extend-in-renderCall extend at module scope so React renders and Strict Mode replays do not repeatedly mutate R3F's global catalogue
: warning in React projects -
react-doctor/r3f-no-extend-three-namespacePass extend an object containing only the Three.js constructors used by JSX so bundlers can tree-shake the rest of the namespace
: warning in React projects -
react-doctor/r3f-no-fresh-portal-containerKeep the createPortal container stable with module scope, lazy state, or useMemo so R3F can preserve the portal store and event layer
: warning in React projects -
react-doctor/r3f-no-fresh-use-three-selectorSelect one stable store field at a time, or provide an equality function when returning an object or array from useThree
: warning in React projects