React Doctor
492 rules react-doctor@0.9.14
Complete effective rule inventory.
Rules
No enabled React Doctor rules match this search.
-
react-doctor/jsx-no-comment-textnodesWrap JSX comments in
{/* … */}so users do not see comment text rendered as children.: warning in React projects -
react-doctor/jsx-no-constructed-context-valuesWrap the context value in
useMemoor move it outside the component so consumers do not redraw every render.: warning in React projects -
react-doctor/jsx-no-duplicate-propsRemove or rename one of the duplicate props so the later value does not silently override the earlier one.
: error in React projects -
react-doctor/jsx-no-jsx-as-propMove the JSX outside the component or wrap it in
useMemoso memoized children do not redraw every render.: warning in React projects -
react-doctor/jsx-no-new-array-as-propWrap the array in
useMemoor move it outside the component so memoized children do not redraw every render.: warning in React projects -
react-doctor/jsx-no-new-function-as-propWrap the callback in
useCallbackor move it outside the component so memoized children do not redraw every render.: warning in React projects -
react-doctor/jsx-no-new-object-as-propWrap the object in
useMemoor move it outside the component so memoized children do not redraw every render.: warning in React projects -
react-doctor/jsx-no-script-urlUse real event handlers instead of
javascript:URLs so injected URL text cannot execute as code.: error in React projects -
react-doctor/jsx-no-target-blankAdd
rel="noreferrer"(or"noopener") when usingtarget="_blank".: warning in React projects -
react-doctor/jsx-no-undefImport the component or fix the typo so React can resolve the JSX identifier at runtime.
: error in React projects -
react-doctor/jsx-numeric-and-leaked-renderIn
{items.length && <List/>}React renders a literal0when the count is 0. Compare explicitly (items.length > 0 && <List/>) or use a ternary (items.length ? <List/> : null).: warning in React projects -
react-doctor/jsx-props-no-spread-multiSpread each value at most once so later props cannot silently override earlier props from the same object.
: warning in React projects -
react-doctor/jwt-insecure-verificationNever accept the
nonealgorithm; it disables signature verification and lets any forged token through. Pin the real algorithm(s) explicitly (jwt.verify(token, key, { algorithms: ['RS256'] })).: error in React projects -
react-doctor/key-lifecycle-riskRemove private keys from source, rotate exposed credentials, prefer short-lived deploy credentials, and document revocation/expiry for release keys.
: error in React projects -
react-doctor/label-has-associated-controlTie every label to a control with
htmlFor, or by nesting the input.: warning in React projects -
react-doctor/langUse a valid language code like
enoren-USso screen readers choose the right pronunciation rules.: warning in React projects -
react-doctor/local-rpc-native-bridge-riskUse exact origin allowlists after URL parsing, per-request nonces, narrow methods, and never expose install/update commands to arbitrary web pages.
: warning in React projects -
react-doctor/mdx-ssr-execution-riskUse a constrained compiler for untrusted content, disable expressions/raw HTML, sandbox renderers, and avoid caching attacker-controlled output across tenants.
: warning in React projects -
react-doctor/media-has-captionAdd
<track kind="captions">inside every<audio>/<video>.: warning in React projects -
react-doctor/mobx-no-make-auto-observable-in-inheritanceReplace inheritance with composition, or annotate inherited members explicitly with
makeObservable.: error in React projects -
react-doctor/mobx-no-observer-wrapped-memoPass the component directly to
observer, or apply Reactmemooutside the resulting observer component.: error in React projects -
react-doctor/mobx-reaction-disposer-discardedKeep the disposer returned by
reactionorautorunand invoke it during teardown.: warning in React projects -
react-doctor/motion-animate-presence-must-outlive-childKeep AnimatePresence mounted and place the condition around its child so Motion can observe and animate the child leaving.
: warning in React projects -
react-doctor/motion-animate-presence-requires-keyGive every direct AnimatePresence child a stable key derived from its identity so Motion can track which element exits.
: warning in React projects -
react-doctor/motion-animate-presence-wait-single-childRender one direct child at a time in
mode="wait", or usesyncorpopLayoutwhen several children can be present.: warning in React projects -
react-doctor/motion-create-in-renderCreate Motion components at module scope, or memoize a genuinely dynamic component factory so its identity remains stable.
: warning in React projects -
react-doctor/motion-drag-axis-constraint-mismatchConstrain horizontal drags with left or right bounds and vertical drags with top or bottom bounds, keeping paired bounds in ascending order.
: warning in React projects -
react-doctor/motion-imperative-animation-in-renderStart imperative animations from an effect or user interaction, and derive render output declaratively from props and state.
: error in React projects -
react-doctor/motion-keyframe-times-mismatchProvide one transition time for each keyframe so Motion can place every value on the animation timeline.
: error in React projects -
react-doctor/motion-layout-on-inline-elementUse inline-block, block, flex, or grid so the browser can apply Motion's transform-based layout animation.
: warning in React projects -
react-doctor/motion-unstable-layout-id-in-iterationDerive repeated layout IDs from stable item identity, or scope each repeated component with a LayoutGroup ID derived from the item.
: warning in React projects -
react-doctor/motion-use-transform-range-lengthGive useTransform input and output ranges the same number of entries so every input stop has an output value.
: error in React projects -
react-doctor/motion-value-constructor-in-renderUse useMotionValue inside React components, or create a manual motionValue outside the render path.
: warning in React projects -
react-doctor/motion-value-subscription-in-renderSubscribe with useMotionValueEvent, or create the subscription in an effect and return its cleanup function.
: error in React projects -
react-doctor/mouse-events-have-key-eventsPair mouse events with keyboard ones so keyboard users are not left out.
: warning in React projects -
react-doctor/nextjs-metadata-url-consistencyUse the same preferred page URL for alternates.canonical and openGraph.url so search and social previews identify one page.
: warning in Next.js projects -
react-doctor/no-access-keyDo not use
accessKey. It conflicts with assistive tech shortcuts.: warning in React projects -
react-doctor/no-aria-hidden-on-focusableRemove
aria-hiddenfrom focusable elements, or stop them being focusable, so keyboard users do not land on content screen readers hide.: warning in React projects -
react-doctor/no-arithmetic-on-optional-chained-operandAn optional chain is
undefinedwhen it short-circuits, so*///%on it producesNaN, which silently corrupts formatting and comparisons. Provide a?? fallbackor guard the chain root before the arithmetic.: warning in React projects -
react-doctor/no-array-index-as-keyUse a stable id from the item, like
key={item.id}orkey={item.slug}. Index keys break when the list reorders or filters.: error in React projects