Skip to content

tools: add lint rule for aborted AbortController - #63541

Merged
nodejs-github-bot merged 5 commits into
nodejs:mainfrom
trivikr:eslint-abort-signal-abort
May 28, 2026
Merged

tools: add lint rule for aborted AbortController#63541
nodejs-github-bot merged 5 commits into
nodejs:mainfrom
trivikr:eslint-abort-signal-abort

Conversation

@trivikr

Copy link
Copy Markdown
Member

This adds an ESLint rule to prefer AbortSignal.abort() when a test creates an
AbortController, immediately aborts it, and only uses the resulting
controller.signal.

The rule is intentionally conservative and only fixes the simple already-aborted
signal pattern from #63489.


The rule uses ESLint scope analysis rather than text matching. After finding a
candidate declaration, it gets the declared variable with
sourceCode.scopeManager.getDeclaredVariables() and checks all references to
that variable.

It only reports when the variable has exactly two non-declaration references:

  1. the immediate controller.abort() call
  2. one controller.signal read

If the controller is logged, passed somewhere else, aborted later, read more than
once, or otherwise referenced, the rule does not report or autofix it.


Assisted-by: openai:gpt-5.5

@trivikr
trivikr requested a review from aduh95May 24, 2026 16:14
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/quic

@nodejs-github-botnodejs-github-bot added needs-ci PRs that need a full CI run. tools Issues and PRs related to the tools directory. labels May 24, 2026
@codecov

codecovBot commented May 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.31%. Comparing base (4639dcb) to head (a506493).
⚠️ Report is 7 commits behind head on main.

Additional details and impacted files
@@ Coverage Diff @@## main #63541 +/- ##
==========================================
+ Coverage 90.29% 90.31% +0.02% 
==========================================
Files 730 730 Lines 234695 234695 Branches 43956 43955 -1 ==========================================
+ Hits 211927 211974 +47 + Misses 14494 14436 -58 - Partials 8274 8285 +11 

see 48 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@trivikrtrivikr added the request-ci Add this label to start a Jenkins CI on a PR. label May 24, 2026
@trivikr
trivikrforce-pushed the eslint-abort-signal-abort branch from 55470dd to 2cd59c6CompareMay 25, 2026 01:44
Comment threadtest/parallel/test-abortcontroller.js Outdated
Comment threadtest/parallel/test-eslint-prefer-abort-signal-abort.js Outdated
Comment threadtest/parallel/test-eslint-prefer-abort-signal-abort.js Outdated
Comment threadtools/eslint-rules/prefer-abort-signal-abort.js Outdated
@trivikr
trivikr requested a review from aduh95May 25, 2026 15:37
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label May 27, 2026
@nodejs-github-bot

This comment was marked as outdated.

trivikrand others added 5 commits May 27, 2026 17:17
Refs: nodejs#63489
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
Assisted-by: openai:gpt-5.5
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
@trivikr
trivikrforce-pushed the eslint-abort-signal-abort branch from be4a7ca to a506493CompareMay 28, 2026 00:17
@trivikrtrivikr added the request-ci Add this label to start a Jenkins CI on a PR. label May 28, 2026
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label May 28, 2026
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@trivikrtrivikr added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label May 28, 2026
@trivikr

This comment was marked as outdated.

@trivikrtrivikr added commit-queue Add this label to land a pull request using GitHub Actions. commit-queue-squash Add this label to instruct the Commit Queue to squash all the PR commits into the first one. labels May 28, 2026
@nodejs-github-botnodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label May 28, 2026
@nodejs-github-bot
nodejs-github-bot merged commit 4d21e86 into nodejs:mainMay 28, 2026
81 checks passed
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Landed in 4d21e86

@trivikr
trivikr deleted the eslint-abort-signal-abort branch May 28, 2026 18:05
aduh95 added a commit that referenced this pull request May 30, 2026
Refs: #63489
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
Assisted-by: openai:gpt-5.5
PR-URL: #63541
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
aduh95 added a commit that referenced this pull request May 30, 2026
Refs: #63489
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
Assisted-by: openai:gpt-5.5
PR-URL: #63541
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
aduh95 added a commit that referenced this pull request Aug 6, 2026
Refs: #63489
Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
Assisted-by: openai:gpt-5.5
PR-URL: #63541
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author readyPRs that have at least one approval, no pending requests for changes, and a CI started.commit-queue-squashAdd this label to instruct the Commit Queue to squash all the PR commits into the first one.needs-ciPRs that need a full CI run.toolsIssues and PRs related to the tools directory.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@trivikr@nodejs-github-bot@Qard@metcoder95@aduh95@Ethan-Arrowood