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.
arr.reduce((acc, x) => ({ ...acc, [x]: fn(x) }), {})
Object.keys(obj).reduce((acc, el) => ({ ...acc, [el]: fn(el) }), {})
let foo = []; for (let i = 0; i < 10; i++) { foo = [...foo, i]; }function fn (x) {
// ...
}
arr.reduce((acc, x) => acc.push(fn(x)), [])
Object.keys(obj).reduce((acc, el) => {
acc[el] = fn(el)
}, {})
// spreading non-accumulators should be avoided if possible, but is not
// banned by this rule
Object.keys(obj).reduce((acc, el) => {
acc[el] = { ...obj[el] }
return acc
}, {})
let foo = []; for (let i = 0; i < 10; i++) { foo.push(i); }Popular · 1 of 2
Prevents using object or array spreads on accumulators in Array.prototype.reduce() and in loops.
arr.reduce((acc, x) => ({ ...acc, [x]: fn(x) }), {})
Object.keys(obj).reduce((acc, el) => ({ ...acc, [el]: fn(el) }), {})
let foo = []; for (let i = 0; i < 10; i++) { foo = [...foo, i]; }function fn (x) {
// ...
}
arr.reduce((acc, x) => acc.push(fn(x)), [])
Object.keys(obj).reduce((acc, el) => {
acc[el] = fn(el)
}, {})
// spreading non-accumulators should be avoided if possible, but is not
// banned by this rule
Object.keys(obj).reduce((acc, el) => {
acc[el] = { ...obj[el] }
return acc
}, {})
let foo = []; for (let i = 0; i < 10; i++) { foo.push(i); }