no-await-in-loop
Configuration
rslint.config.ts
Rule Details
Disallows await expressions inside loop bodies (for, for-in, for-of, while, do-while). Using await in a loop is usually a sign that the program is not taking full advantage of the parallelization benefits of async/await, as each iteration waits for the previous one to complete. The operations can often be refactored to use Promise.all() instead.
This rule allows await in for-await-of loops, since those are designed to work with async iterables. However, a for-await-of nested inside another loop will be flagged.
Examples of incorrect code for this rule:
Examples of correct code for this rule: