fix(promise-function-async): use suggestion instead of auto-fix for hybrid return types#618
Conversation
How to use the Graphite Merge QueueAdd the label 0-merge to this PR to add it to 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. |
adcef89 to
f55fd8f
Compare
d365700 to
8026590
Compare
Merge activity
|
There was a problem hiding this comment.
Pull request overview
Adjusts the promise-function-async rule so that hybrid return types (promise ∪ non-promise) without an explicit return type annotation produce a suggestion rather than an auto-fix, giving users control over whether to add async or instead add/clarify a return type annotation (per #18732).
Changes:
- Add a dedicated suggestion message (
missingAsyncHybridReturnSuggestion) for addingasync. - Report hybrid return type cases via
ReportNodeWithSuggestions(no auto-fix), while keepingReportNodeWithFixesfor non-hybrid cases. - Update rule tests to assert suggestions (instead of
Output) for hybrid return type scenarios.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| internal/rules/promise_function_async/promise_function_async.go | Switch hybrid return type handling from auto-fix to suggestion; add suggestion message. |
| internal/rules/promise_function_async/promise_function_async_test.go | Update invalid cases to validate suggestion-based behavior for hybrid return types. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
f55fd8f to
4069660
Compare
…ybrid return types (#618) For functions with hybrid return types (union of promise and non-promise types without explicit return type annotation), use a suggestion instead of an auto-fix. This gives users more control since adding async may not always be the intended fix - they might want to add an explicit return type annotation instead. fixes oxc-project/oxc#18732
4069660 to
f84cafa
Compare

For functions with hybrid return types (union of promise and non-promise types without explicit return type annotation), use a suggestion instead of an auto-fix. This gives users more control since adding async may not always be the intended fix - they might want to add an explicit return type annotation instead.
fixes oxc-project/oxc#18732