react-doctor/no-string-false-on-boolean-attribute
String true/false on a boolean attribute
- Category: Bugs
- Severity: warn
- Source:
oxlint-plugin-react-doctor - Framework: global
- Enabled when: react
- Default: Enabled
Validation prompt
Use this to decide whether a fired diagnostic is real or a false positive.
Confirm the reported code matches String true/false on a boolean attribute. Check the framework context and diagnostic message before suppressing it.
Fix prompt
Use this once validation confirms the diagnostic is real.
Use the boolean form on boolean attributes: disabled / disabled={true} / disabled={false}, not disabled="false". A non-empty string is truthy, so ="false" actually turns the attribute ON.
Related rules
More Bugs rules from the rules reference:
react-doctor/no-string-refs: Disallow legacy string refs like ref='node' — use createRef, useRef, or callback refs.react-doctor/no-this-in-sfc: Use the function's `props` parameter instead of `this.props` in stateless function components.react-doctor/no-uncontrolled-input: Pass an explicit initial value to `useState` (e.g. `useState("")` instead of `useState()`), add `onChange` (or `readOnly` to opt out) when you supply `value`, and drop `defaultValue` on controlled inputs — React ignores itreact-doctor/no-unescaped-entities: Replace bare ' / " / > / } characters in JSX text with HTML entities.react-doctor/no-unguarded-browser-global-in-render-or-hook-init: Browser global read during server render