react-doctor/no-many-boolean-props
Split into compound components or named variants: `<Button.Primary />`, `<DialogConfirm />` instead of stacking `isPrimary`, `isConfirm` flags
- Category: Architecture
- Severity: warn
- Source:
oxlint-plugin-react-doctor - Framework: global
- Enabled when: always
Validation prompt
Use this to decide whether a fired diagnostic is real or a false positive.
Fires when a component accepts 4 or more props whose names match is|has|should|can|show|hide|enable|disable|with followed by an uppercase letter (e.g. isPrimary, hasIcon, showHeader, canEdit). Both destructured ({ isPrimary }) and props.isPrimary member-access forms are detected. The name-based heuristic can catch non-boolean props using those prefixes (e.g. withIconSize: number), so confirm they really are mutually-exclusive booleans.
Fix prompt
Use this once validation confirms the diagnostic is real.
Replace the flags with a discriminated variant prop (variant: "primary" | "danger") or split into compound subcomponents (<Button.Primary />, <DialogConfirm />) so consumers select one explicit shape rather than juggling mutually-exclusive booleans. Compound components fit best when variants share most internals but differ in slot composition. See https://kentcdodds.com/blog/compound-components-with-react-hooks
Related rules
More Architecture rules from the rules reference:
react-doctor/no-multi-comp: Move secondary components into their own files.react-doctor/no-polymorphic-children: Expose explicit subcomponents (`<Button.Text>`, `<Button.Icon>`) so consumers don't need to switch on `typeof children`react-doctor/no-prop-types: Move propTypes to TypeScript types: `type Props = { value: number }; function Component(props: Props)` — React 19 ignores runtime propTypesreact-doctor/no-pure-black-background: Tint the background slightly toward your brand hue — e.g. `#0a0a0f` or Tailwind's `bg-gray-950`. Pure black looks harsh on modern displaysreact-doctor/no-react-children: Pass children as props or render them directly instead of calling React.Children methods.