-
-
Notifications
You must be signed in to change notification settings - Fork 722
feat(linter/always-return): implement promise rule always-return #13178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(linter/always-return): implement promise rule always-return #13178
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. |
d0d2276 to
b6f8b36
Compare
CodSpeed Instrumentation Performance ReportMerging #13178 will not alter performanceComparing Summary
|
b6f8b36 to
e3c53b8
Compare
e6b4193 to
ddc8c12
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements a new ESLint rule promise/always-return that enforces proper return values in Promise .then() callbacks to prevent broken Promise chains. The rule ensures that each .then() callback either returns a value or throws an exception.
Key Changes:
- Implements the
AlwaysReturnrule with comprehensive logic for analyzing Promise callback control flow - Adds configuration options for
ignoreLastCallbackandignoreAssignmentVariablesettings - Includes extensive test coverage with snapshot testing for various Promise chain scenarios
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
crates/oxc_linter/src/rules/promise/always_return.rs |
Complete implementation of the always-return rule with control flow analysis |
crates/oxc_linter/src/snapshots/promise_always_return.snap |
Snapshot test file containing expected diagnostic outputs |
crates/oxc_linter/src/rules.rs |
Module registration to include the new rule in the linter |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
ddc8c12 to
40a641f
Compare
camc314
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks
Related to #4655