react-doctor/no-stale-timer-ref
Cleared timer ref keeps the stale id
- 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 Cleared timer ref keeps the stale id. Check the framework context and diagnostic message before suppressing it.
Fix prompt
Use this once validation confirms the diagnostic is real.
Reset the ref right after clearing (clearTimeout(ref.current); ref.current = null) so truthiness checks on the ref keep meaning “timer still pending”.
Related rules
More Bugs rules from the rules reference:
react-doctor/no-string-false-on-boolean-attribute: String true/false on a boolean attributereact-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.