Skip to content

fix(promise-function-async): use suggestion instead of auto-fix for hybrid return types#618

Merged
graphite-app[bot] merged 1 commit intomainfrom
c/01-30-fix_promise-function-async_use_suggestion_instead_of_auto-fix_for_hybrid_return_types
Jan 30, 2026
Merged

fix(promise-function-async): use suggestion instead of auto-fix for hybrid return types#618
graphite-app[bot] merged 1 commit intomainfrom
c/01-30-fix_promise-function-async_use_suggestion_instead_of_auto-fix_for_hybrid_return_types

Conversation

@camc314
Copy link
Copy Markdown
Contributor

@camc314 camc314 commented Jan 30, 2026

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

Copy link
Copy Markdown
Contributor Author

camc314 commented Jan 30, 2026


How to use the Graphite Merge Queue

Add 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.

@camc314 camc314 self-assigned this Jan 30, 2026
@camc314 camc314 force-pushed the c/01-30-fix_promise-function-async_use_suggestion_instead_of_auto-fix_for_hybrid_return_types branch from adcef89 to f55fd8f Compare January 30, 2026 13:19
@camc314 camc314 force-pushed the c/01-30-fix_promise-function-async_use_different_error_message_for_hybrid_return_types branch from d365700 to 8026590 Compare January 30, 2026 13:19
@camc314 camc314 marked this pull request as ready for review January 30, 2026 13:20
Copilot AI review requested due to automatic review settings January 30, 2026 13:20
Copy link
Copy Markdown
Contributor Author

camc314 commented Jan 30, 2026

Merge activity

  • Jan 30, 1:20 PM UTC: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Jan 30, 1:32 PM UTC: camc314 added this pull request to the Graphite merge queue.
  • Jan 30, 1:46 PM UTC: The Graphite merge queue couldn't merge this PR because it had merge conflicts.
  • Jan 30, 2:03 PM UTC: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Jan 30, 2:03 PM UTC: camc314 added this pull request to the Graphite merge queue.
  • Jan 30, 2:17 PM UTC: Merged by the Graphite merge queue.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 adding async.
  • Report hybrid return type cases via ReportNodeWithSuggestions (no auto-fix), while keeping ReportNodeWithFixes for 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.

@graphite-app graphite-app Bot changed the base branch from c/01-30-fix_promise-function-async_use_different_error_message_for_hybrid_return_types to graphite-base/618 January 30, 2026 13:32
@graphite-app graphite-app Bot changed the base branch from graphite-base/618 to main January 30, 2026 13:45
@graphite-app graphite-app Bot removed the 0-merge label Jan 30, 2026
@camc314 camc314 force-pushed the c/01-30-fix_promise-function-async_use_suggestion_instead_of_auto-fix_for_hybrid_return_types branch from f55fd8f to 4069660 Compare January 30, 2026 13:50
…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
@graphite-app graphite-app Bot force-pushed the c/01-30-fix_promise-function-async_use_suggestion_instead_of_auto-fix_for_hybrid_return_types branch from 4069660 to f84cafa Compare January 30, 2026 14:04
@graphite-app graphite-app Bot merged commit f84cafa into main Jan 30, 2026
8 checks passed
@graphite-app graphite-app Bot deleted the c/01-30-fix_promise-function-async_use_suggestion_instead_of_auto-fix_for_hybrid_return_types branch January 30, 2026 14:17
@graphite-app graphite-app Bot removed the 0-merge label Jan 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

promise-function-async autofix incorrectly adds async to React components

2 participants