react-doctor/forbid-component-props
Configure forbidden props per component via the `forbidComponentProps.forbid` setting.
- Category: Architecture
- Severity: warn
- Source:
oxlint-plugin-react-doctor - Framework: global
- Enabled when: off by default (opt-in)
- Documentation: https://oxc.rs/docs/guide/usage/linter/rules/react/forbid-component-props
Validation prompt
Use this to decide whether a fired diagnostic is real or a false positive.
Fires when a configured prop appears on a user-defined JSX component — a PascalCase tag or a member-expression name like Module.Foo (HTML tags and namespaced shapes such as <fbt:param> pass through). With no config it forbids className and style; otherwise it matches each attribute against forbid entries (exact propName or propNamePattern glob) and reports unless the tag is exempted via allowedFor/allowedForPatterns or excluded from disallowedFor/disallowedForPatterns. False positive: a wrapper component that deliberately re-exposes className/style as part of its public API (the common Tailwind/shadcn/Radix pattern) — add that component to allowedFor rather than stripping the prop.
Fix prompt
Use this once validation confirms the diagnostic is real.
Pass the styling/behavior through the component's intended API instead of the forbidden prop — e.g. a variant/size prop or a design-system token rather than <Card className="p-4" />. If a component is legitimately meant to accept the prop, allowlist it in config ({ propName: "className", allowedFor: ["Card"] } or allowedForPatterns: ["*Icon"]) instead of suppressing each call site. See https://oxc.rs/docs/guide/usage/linter/rules/react/forbid-component-props
Related rules
More Architecture rules from the rules reference:
react-doctor/forbid-dom-props: Configure forbidden DOM props via the `forbidDomProps.forbid` setting to keep disallowed attributes off DOM nodes.react-doctor/forbid-elements: Replace each configured forbidden element with its sanctioned component or wrapper.react-doctor/forward-ref-uses-ref: Either accept a `ref` parameter in the forwardRef render function, or drop the forwardRef wrapper entirely.react-doctor/hook-use-state: Destructure useState as `const [thing, setThing] = useState(…)`.react-doctor/jsx-boolean-value: Pick one boolean-attribute style codebase-wide (default: omit `={true}`, e.g. write `<C foo />`).