Rules
Every rule from ESLint, Oxlint and Biome. Pick a rule to see its example. Reach is the weekly npm downloads of the presets that enable a rule; trend is its change over the last quarter.
Every rule from ESLint, Oxlint and Biome. Pick a rule to see its example. Reach is the weekly npm downloads of the presets that enable a rule; trend is its change over the last quarter.
async function foo(things) {
const results = [];
for (const thing of things) {
// Bad: each loop iteration is delayed until the entire asynchronous operation completes
results.push(await doAsyncWork(thing));
}
return results;
}
async function bar(things) {
for (const thing of things) {
await using resource = getAsyncResource(thing);
}
}async function foo(things) {
const promises = [];
for (const thing of things) {
// Good: all asynchronous operations are immediately started.
promises.push(doAsyncWork(thing));
}
// Now that all the asynchronous operations are running, here we wait until they all complete.
const results = await Promise.all(promises);
return results;
}Popular · 1 of 1
async function foo(things) {
const results = [];
for (const thing of things) {
// Bad: each loop iteration is delayed until the entire asynchronous operation completes
results.push(await doAsyncWork(thing));
}
return results;
}
async function bar(things) {
for (const thing of things) {
await using resource = getAsyncResource(thing);
}
}async function foo(things) {
const promises = [];
for (const thing of things) {
// Good: all asynchronous operations are immediately started.
promises.push(doAsyncWork(thing));
}
// Now that all the asynchronous operations are running, here we wait until they all complete.
const results = await Promise.all(promises);
return results;
}