Skip to content
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

Proposal: Disallow await in loops #793

Closed
tunnckoCore opened this issue Feb 21, 2017 · 3 comments

Comments

@tunnckoCore
Copy link

commented Feb 21, 2017

Digging more and more in ESLint rules, i found some good ones which enforces good style and more readable code. This issue is for no-await-in-loop rule - not fixable.

Suggested configuration.

{
  "no-await-in-loop": "error"
}

I believe it is good practice to not do that and ban such things, since each loop iteration is delayed until the entire asynchronous operation completes.

@jprichardson

This comment has been minimized.

Copy link
Member

commented Feb 21, 2017

👎 there are good reasons to use an await in a for-loop. For example, let's assume you want to make a number of rate-limited HTTP requests. A for-loop using await makes for a very clean way to do this.

@tunnckoCore

This comment has been minimized.

Copy link
Author

commented Feb 21, 2017

Maybe. I believe we should run tests, to see ecosystem impact and if it is not so big everyone can add disable comment.

@feross

This comment has been minimized.

Copy link
Member

commented Feb 21, 2017

Duplicate: #737 Please use search before creating new issues.

@feross feross closed this Feb 21, 2017

@lock lock bot locked as resolved and limited conversation to collaborators May 10, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
3 participants
You can’t perform that action at this time.