fix(useAwait): treat yield* as async operation in async generators#8978
fix(useAwait): treat yield* as async operation in async generators#8978ematipico merged 1 commit intobiomejs:mainfrom
Conversation
yield* in an async generator delegates to an AsyncIterable, which requires the async modifier. The useAwait rule now recognizes yield* as an async operation and no longer incorrectly reports these functions. Fixes biomejs#8645
🦋 Changeset detectedLatest commit: 3f3e4e7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
WalkthroughThis pull request fixes the Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
CodSpeed Performance ReportMerging this PR will not alter performanceComparing Summary
Footnotes
|
|
Another AI PR not disclosed... |
|
Hey, fair point — I used Claude Code as an assistant while working on this. I should have disclosed it per your contributing guidelines, my apologies. I'll make sure to include AI disclosure in future PRs. |
Summary
Fixes #8645.
yield*in anasyncgenerator function delegates to anAsyncIterable, which requires theasyncmodifier. TheuseAwaitrule was incorrectly flagging these functions as missingawait.This PR adds
yield*(i.e.JsYieldExpressionwith astar_token) to the set of expressions recognized as async operations by theMissingAwaitVisitor, alongsideawaitandfor await...of.Changes
use_await.rs: Added a check forJsYieldExpressionwithstar_token()in the visitor'sWalkEvent::Enterbranchvalid.js: Added test cases forasync function*withyield*invalid.js: Added test case forasync function*with plainyield(should still be flagged)Test plan
cargo test -p biome_js_analyze -- use_await— all 4 tests passasync function* yieldStarAsyncIterable() { yield* otherAsyncGenerator(); }— no diagnosticasync function* yieldWithoutStar() { yield 1; }— correctly flagged