Skip to content

[eslint-miner] eslint-factory: add no-unhandled-async-timer-callback rule - #65292

Closed
github-actions[bot] wants to merge 1 commit into
mainfrom
eslint-miner/no-unhandled-async-timer-callback-71294abb37a9f78f
Closed

github-actions[bot] wants to merge 1 commit into
mainfrom
eslint-miner/no-unhandled-async-timer-callback-71294abb37a9f78f

Conversation

@github-actions

@github-actions github-actions Bot commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

New rule: no-unhandled-async-timer-callback

Flags await outside a try/catch inside async setTimeout/setInterval/setImmediate callbacks (including globalThis./global. forms). Timers discard the returned promise, so a rejection becomes an unhandled rejection that can crash the Node process.

Evidence

  • actions/setup/js/process_runner.cjs (~L430) uses setInterval(async () => ...) with the await correctly wrapped in try/catch/finally. The rule enforces that pattern for future timer callbacks.
  • Other timer sites in actions/setup/js are synchronous, so there are no false positives today (npm run lint:setup-js reports 0 hits).
  • Complements no-async-foreach-callback (same discarded-promise class of bug).
  • Note: no strong recurring issue/discussion was found for this specific pattern in the last 14 days; the rule is preventive, based on the code scan.

Design

Only async function callbacks passed directly as the first timer argument; awaits in nested functions are not attributed to the timer callback; awaits in catch/finally are still reported.

Validation

npm install, npm run build, rule unit tests, and npm run lint:setup-js all pass. Registered in src/index.ts, enabled as warn in eslint.config.cjs.

Generated by ESLint Miner · copilot · auto · 27.5 AIC · ⌖ 12 AIC · ⊞ 6.7K · ◷

  • expires on Oct 10, 2026, 12:56 AM UTC-08:00

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automation cookie Issue Monster Loves Cookies! eslint

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant