Repository navigation
Conversation
An `await using` declaration awaits the resource's disposal, but `AwaitFinder` only looked for `await` expressions and `for await`. Async functions whose only await was `await using` were reported, and the dangerous fix removed `async`, which produced invalid code. Co-Authored-By: Claude Opus 5.5 <[email protected]>
camc314
approved these changes
Sep 28, 2026
Contributor
Merging this PR will not alter performance
Comparing Footnotes
|
Author
|
Thanks for the review and merge, @camc314! |
graphite-app Bot
pushed a commit
that referenced
this pull request
Sep 28, 2026
# Oxlint ### 🚀 Features - 9d80eed linter/react/only-export-components: Support `allowCompoundComponents` (#27117) (Kuroda Kayn) - e05b155 linter: Add typescript/no-generated-empty-object-type (#26958) (camc314) ### 🐛 Bug Fixes - 42dfbb5 linter/eslint/one-var: Keep `declare` when splitting declarations (#27081) (Cheolhee Lee) - 2ba7e33 linter/eslint/require-await: Count `await using` as an await (#27080) (Cheolhee Lee) - 611e4ed linter/plugins: Include executing selectors in JS plugin rule timings (#27111) (overlookmotel) - 2cac66f react-compiler: Handle recursive function expressions (#26796) (Brennan Butler) - e996e6c react-compiler: Treat zero-argument new Date as impure (#26894) (Boshen) - 571cfa3 oxlint: Skip type-aware lint rules in type-check-only mode (#27076) (camc314) - d0b2462 oxlint: Skip undefined children in CFG walker (#27075) (camc314) - 5186328 parser: Handle HTML comment values (#22933) (Boshen) - 0b630e8 linter/typescript/unified-signatures: Align rule with upstream (#26956) (camc314) - ebb22f1 linter/node/no-exports-assign: Change category from style to suspicious (#26555) (Bartok) - cce28a0 linter/import/no-duplicates: Distinguish import attributes (#26936) (camc314) - feb733b linter/unicorn/prefer-spread: Stop checking string split calls (#26935) (camc314) - 929e154 linter/eslint/no-unused-vars: Honor ignore patterns inside array rest bindings (#26923) (camc314) - 5bdb9b8 linter/eslint/no-unused-vars: Recognize consumed update expressions (#26782) (camc314) - 5c05bef linter/eslint/prefer-const: Ignore embedded assignments (#26920) (camc314) ### ⚡ Performance - ded4c29 linter/eslint/no-unused-vars: Skip sequence checks when absent (#26921) (camc314) # Oxfmt ### 🚀 Features - e0b1f9f oxfmt: Bump bundled Prettier version to 3.9.9 (#27002) (leaysgur) - 342527d oxfmt: Bump bundled Prettier version to 3.9.8 (#26999) (leaysgur) ### 🐛 Bug Fixes - eeba1db formatter: Skip test-call layout when arguments have comments (#27119) (leaysgur) - 1f7b8ad oxfmt: Allow repeated CLI calls in the same process (#27051) (Liang) - 7bcb807 formatter_markdown: Keep blank line between HTML and nested list (#27112) (leaysgur) - 10b10c5 formatter: Keep comments around `=` on their side and line (#27041) (leaysgur) - 9aad365 formatter: Keep comments deferred before an assignment operator (#26997) (waltu) - 8fbddb1 formatter/jsdoc: More alignment with original plugin (#27039) (leaysgur) - 50be18e formatter: Keep trailing spaces on normal block comments (#27037) (leaysgur) - 56d1880 formatter: Nestle adjacent block comments (#27036) (leaysgur) - 3be5d94 formatter: Treat `/***` comments as JSDoc (#27035) (leaysgur) - cd45f71 formatter: Keep trailing double spaces on JSDoc lines (#26861) (John Costa) - fd695f4 formatter_markdown: Fix more mismatches found in ecosystem-ci repos (#27003) (leaysgur) - 4e77d59 formatter_markdown: Keep a math span after a kept line break from opening a block (#27001) (leaysgur) - 584b8b0 formatter_markdown: Keep a shape line after a multi-line inline node or link title (#27000) (leaysgur) - b939645 formatter_markdown: Keep a line break before an inline liquid tag under preserve (#26998) (leaysgur)
53 of 95 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root cause
AwaitFinder(crates/oxc_linter/src/rules/eslint/require_await.rs:220-239) only setsfoundforawaitexpressions andfor await. Anawait usingdeclaration also awaits (the resource's disposal when the scope exits), so an async function whose only await isawait using x = ...orfor (await using x of xs)is reported.The rule's dangerous fix then removes
async, which leavesawait usingoutside an async function. With oxlint 1.85.0:The fixed file no longer parses (
`await` is only allowed within async functions and at the top levels of modules). In a debug build the same fix trips the fixer's syntax check (crates/oxc_linter/src/fixer/mod.rs:422).ESLint counts these declarations since eslint/eslint#19828 (
lib/rules/require-await.js#L180-L182):Fix
Override
visit_variable_declarationinAwaitFinder: anawait usingdeclaration setsfound, any other declaration is walked as before. This mirrors the existingvisit_for_of_statementoverride. The left side offor (await using x of xs)reaches the same method throughwalk_for_of_statement->visit_for_statement_left, so it needs no separate case. Nested functions and arrows are still not visited, so anawait usinginside them does not count for the outer function.Edge cases covered
await usingdirectly in the body, in a nested block, and infor (await using x of xs).using(still reported).await usingonly inside a nested async arrow. The outer function is still reported and the arrow no longer is (onmainboth were).Testing
cargo test -p oxc_linter --lib -- rules::eslint::require_await::: onmainthe three new pass cases fail (3 test cases expected to pass, but failed, each reported at 1:16); with the fix the test passes. The snapshot gains the two new fail cases.cargo test -p oxc_linter: all pass (lib: 1270 passed, 1 ignored).cargo clippy -p oxc_linter --all-targets --all-features -- -D warnings,cargo fmt --all -- --check,typoson the changed files: clean.oxlintbuild on a file withawait usingin the body and infor (await using ...): two diagnostics before, none after, and--fix-dangerouslyleaves it unchanged.Notes
This is not the #25230 case (a returned promise without
await, which needs type information):await usingis syntax, and ESLint core counts it.AI-assisted: I used Claude Code while investigating; I reviewed, ran and verified every change myself.
cc @camc314
🤖 Generated with Claude Code