React Doctor
492 rules react-doctor@0.9.18
Complete effective rule inventory.
Rules
No enabled React Doctor rules match this search.
-
react-doctor/no-srcset-without-sizesAdd a sizes attribute that describes the image's rendered width at each responsive breakpoint.
: warning in React projects -
react-doctor/no-stale-timer-refReset the ref right after clearing (
clearTimeout(ref.current); ref.current = null) so truthiness checks on the ref keep meaning “timer still pending”.: warning in React projects -
react-doctor/no-static-element-interactionsGive clickable static elements a
role, or use a button or link.: warning in React projects -
react-doctor/no-static-motion-config-neverUse
reducedMotion="user", or derive the value from an explicit user preference instead of permanently disabling reduced-motion support.: warning in React projects -
react-doctor/no-string-false-on-boolean-attributeUse the boolean form on boolean attributes:
disabled/disabled={true}/disabled={false}, notdisabled="false". A non-empty string is truthy, so="false"actually turns the attribute ON.: warning in React projects -
react-doctor/no-string-refsUse a callback ref or
useRefso ref ownership is explicit and not tied to legacy string lookup.: warning in React projects -
react-doctor/no-sync-xhrNever open an XMLHttpRequest synchronously (
async=false). It blocks the main thread. Usefetch()or passtrueand handle the response asynchronously.: warning in React projects -
react-doctor/no-this-in-sfcRead from the
propsargument because function components do not have a React instancethis.: warning in React projects -
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