Very often I end up writing loops with await
s inside of them, in order to perform some tasks sequentially or achieve a certain interval between iterations.
For example:
for (const item of items) {
await doSomthing(item);
}
or:
while(true) {
await doSomeTask();
await delay(60000);
}
However, ESLint is reprimanding me for writing this kind of code.
What is an alternative pattern to sequential looping with awaiting and infinite loops with awaits inside, when I don't want to run all async tasks at the same time and rather want to run them at a slow pace?