New
Introducing React Bench, see how different models perform on React code

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”.

More Bugs rules from the rules reference: