fix(linter/no-await-in-loop): add support for await using#17947
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
Merging this PR will not alter performance
Comparing Footnotes
|
There was a problem hiding this comment.
Pull request overview
This pull request adds support for detecting await using declarations in the no-await-in-loop ESLint rule. The rule previously detected await expressions and for await...of statements inside loops, and now also detects await using declarations which are problematic in the same way.
Changes:
- Added handling for
await usingvariable declarations in loops - Updated the
is_loopedfunction to accept a node parameter instead of just a span, enabling detection ofawait usingin for-in/of loop conditions - Added test cases covering
await usingin while loops, for loops, and for-of loops
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| crates/oxc_linter/src/rules/eslint/no_await_in_loop.rs | Added support for detecting await using declarations in loops, including handling for loop bodies and for-in/of left positions |
| crates/oxc_linter/src/snapshots/eslint_no_await_in_loop.snap | Added test snapshots for three new test cases covering await using in different loop contexts |
| crates/oxc_linter/src/generated/rule_runner_impls.rs | Added VariableDeclaration to the NODE_TYPES bitset for the rule |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Merge activity
|
Updating this rule to account for an `await using` in the loop and in the loop condition. I did use Copilot to help update this rule based on the original source and then edited afterwards for style.
088e6c1 to
ad02e03
Compare

Updating this rule to account for an
await usingin the loop and in the loop condition. I did use Copilot to help update this rule based on the original source and then edited afterwards for style.