oxc/no-accumulating-spread
oxc plugin · perf
No autofix
.oxlintrc.json
{
"rules": {
"oxc/no-accumulating-spread": "error"
}
}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); }Examples from the Oxlint documentation.
ESLint does not have this rule.
oxc/no-accumulating-spread
oxc plugin · perf
{
"rules": {
"oxc/no-accumulating-spread": "error"
}
}Biome does not have this rule.
Https://rust-lang.github.io/rust-clippy/master/#/misrefactored_assign_op
Disallows the use of async functions as Express endpoint handlers.
Disallows the use of approximate constants, instead preferring the use of the constants in the Math object.
Disallow the use of barrel files where the file contains export * statements, and the total number of modules exceeds a threshold.
Disallows the use of this in exported functions.