-
-
Notifications
You must be signed in to change notification settings - Fork 488
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): implement eslint:prefer-promise-reject-errors
#8254
base: main
Are you sure you want to change the base?
feat(linter): implement eslint:prefer-promise-reject-errors
#8254
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. |
eslint/prefer-promise-reject-errors
eslint:prefer-promise-reject-errors
CodSpeed Performance ReportMerging #8254 will not alter performanceComparing Summary
|
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.
Looks good!
* Port from eslint. | ||
* @see <https://github.com/eslint/eslint/blob/36ef8bbeab495ef2598a4b1f52e32b4cb50be5e2/lib/rules/utils/ast-utils.js#L2079> | ||
*/ | ||
fn could_be_error(expr: &Expression) -> bool { |
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.
[ask]
I think we can declare this function in ast_util
but why did you choose to declare this in this file?
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.
@baseballyama Nice!
I found this utils have already implemented in eslint/no-throw-literal.rs
.
And I checked this implementation works fine in this rule. So, I will move this function to ast-utils and use it.
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.
did cfdf18d
implement https://eslint.org/docs/latest/rules/prefer-promise-reject-errors
(ref: #479 )