-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Enable rule "promise/catch-or-return"? #1322
Enable rule "promise/catch-or-return"? #1322
Comments
I think this sounds very good, we should run a test and see how many packages it would break 👍 |
@LinusU: Agree, that would be nice. How does one run such a test? Someone who has a setup for that? |
We should really write this down somewhere 😅
|
Result:
Most with a single or two failing lines. Of the two that I looked closer at it seems to be that the final Two examples: |
Could you post the entire list of failing repos, then we can start sending PRs 😄 |
Here's all the errors:
|
Thank you! Cleaned it up a bit here:
|
When using the `.then($1, $2)` function, any errors thrown from `$1` will *not* be delegated to `$2`. Changing to `.then($1).catch($2)` makes sure that even errors from `$1` gets delegated to `$2`. Found by this proposed standard rule: standard/eslint-config-standard#129
When using the `.then($1, $2)` function, any errors thrown from `$1` will *not* be delegated to `$2`. Changing to `.then($1).catch($2)` makes sure that even errors from `$1` gets delegated to `$2`. Found by this proposed standard rule: standard/eslint-config-standard#129
Found by this proposed standard rule: standard/eslint-config-standard#129
This seems like something that belongs in CONTRIBUTING.md :) |
Here's an up to date run 11 failing projects, 6.7% of total
|
@voxpelli That test run doesn't look too bad. If you have time, one thing that would help is sending PRs to the failing repos to fix the issues. That makes it less work for me to add the rule when the time comes (less code for me to change while working on the release; and fewer repos to mark as "disabled" in order to keep the tests passing) |
I'm definitely down to try enabling this with Regarding the |
If the functions |
Starting with Node 15 which was just released, unhandled rejections will start throwing, so probably even more reason to add this. I'm at your disposal to get this added @feross 👍 |
@voxpelli Can you propose a configuration for the rule? As well as testing ecosystem breakage with that setting? // clone repo
npm install
// edit the eslint.json file, adding a "rules" section with your proposed rule
npm test Report the final test output, number of tests passed/failed. You can also share representative examples of failures that you agree with and ones that are not ideal. Thanks for offering to help! |
@voxpelli I just noticed your comment here: standard/eslint-config-standard#148 (comment) Is your latest opinion that this shouldn't be merged as-is because of the false positives? |
In
12.0.0
(#123) it could be useful to add the promise/catch-or-return to help people catch the cases where one might have missed acatch()
orreturn
?Especially as
unhandledRejection
is deprecated and will start throwing.Thoughts?
The text was updated successfully, but these errors were encountered: