-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
[Feature request] disallow async promise executor #10217
Comments
Hi @dwelle, thanks for the issue. It looks like there's not enough information for us to know how to help you. If you're reporting a bug, please be sure to include:
Requesting a new rule? Please see Proposing a New Rule for instructions. Requesting a rule change? Please see Proposing a Rule Change for instructions. If it's something else, please just provide as much additional information as possible. Thanks! |
Hi @dwelle, thanks for the issue. This sounds good to me and I would love to get behind it once we have a little more information. Would you mind editing the initial issue post to reflect the new issue template, as requested by the bot? It would be good to see a few more examples. Thanks! |
@platinumazure edited. I went through https://eslint.org/docs/developer-guide/contributing/new-rules before creating this issue, but didn't occur to me to click through the |
Thanks, both for adding in the template and for any PR to make the
contribution guide clearer!
…On Sun, Apr 15, 2018, 03:20 David Luzar ***@***.***> wrote:
@platinumazure <https://github.com/platinumazure> edited. I went through
https://eslint.org/docs/developer-guide/contributing/new-rules before
creating this issue, but didn't occur to me to click through the new issue
link on the page as it wasn't clear enough it's a template. I'll issue a PR
to make it clearer.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#10217 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AARWenqEwaSweqaVmzG4_6V5ay-Ypm2Uks5towLBgaJpZM4TVOhf>
.
|
I'll champion this change. @eslint/eslint-team Anyone willing to support this change? It needs two more 👍s from team members to accept it. |
Just added my 👍. This is now accepted! |
Please describe what the rule should do:
Promise executors must not be (technically, they can if you know what you're doing)
async
else bad side effects happen, such as throwing (seemingly) sync errors(A)
no longer rejecting the promise (thus unable to be caught by(B)
), because the async function is executed in different frame:Why is this different from not catching any potential async errors in a non-
async
executor? It isn't -- but, the above example gives off a feeling like you're throwing a sync error, while it's not, and for people new to async/await this may not be evident.More info in this SO answer.
Thus, I propose a rule that forbids
async
executor function.What category of rule is this? (place an "X" next to just one item)
[ ] Enforces code style
[x] Warns about a potential error
[ ] Suggests an alternate way of doing something
[ ] Other (please specify:)
Provide 2-3 code examples that this rule will warn about:
Why should this rule be included in ESLint (instead of a plugin)?
It seems like to become common-enough error when async/await becomes more mainstream to include it in core.
The text was updated successfully, but these errors were encountered: