-
Notifications
You must be signed in to change notification settings - Fork 159
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
Rule against await await
#1168
Comments
Sounds reasonable, PRs are welcome |
Has anyone ever written this kind of code though? Is a rule worth it considering the extra time necessary to check for this condition? Perhaps there is precedence in other linters? |
It seems people write this kind of code: https://github.com/search?type=code&q=%22await+await+%22+language%3AJavaScript&l=JavaScript (maybe when coming from other languages like c# where this is necessary) |
I have written this code by accident ... you can easily end up with |
Maybe deno fmt should just remove multiple awaits. |
As I explained in the issue description |
I'm surprised the tsc warning isn't shown in this case
Does that really happen when |
Oh, ... yeah me too. In case we get that warning to work then this lint is probably redundant.
Yes, according to the ECMAScript standard it even must happen. |
It does affect it, but I wouldn't consider it too dangerous. That said, considering it does change execution that's reasonable to not do it for formatting.
Considering this is already handled by tsc, I think we should not add this to deno_lint. I'm going to close this issue. |
I guess we should open a new issue at |
But not by |
Oh yeah. Looks like typescript is only reporting this as a suggestion diagnostic, which we don't surface except in the editor. Perhaps it being reported via deno lint would still be good. I'm going to reopen. |
Slightly getting off-topic but would it make sense to add a |
While the number of
await
keywords can affect which promise job is executed first (because promise jobs have to be enqued even if the promise is fulfilled), in sane code you usually only ever want oneawait
keyword for one expression. And multipleawait
keywords are usually just an accident, so it would be nice to have a rule to detect this.E.g. Invalid:
Valid:
The text was updated successfully, but these errors were encountered: