mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
Creates a new nursery-level rule, `no-reduce-spread`, that prevents spreading accumulator objects/arrays in `Array.prototype.reduce`. The Tl;Dr of why this should be avoided is because it drastically increases time/memory complexity in reductions. In general, it turns potentially `O(1)`/`O(n)` memory operations into `O(n)`/`O(n^2)`, and `O(n)` time into `O(n^2)`. For more details, refer to [this helpful blog post](https://prateeksurana.me/blog/why-using-object-spread-with-reduce-bad-idea/). Note that this rule doesn't exist in ESLint's default rule set or any other ESLint plugin, although it looks like [there's been some interest in it in the past](https://github.com/vercel/style-guide/issues/18). Since there is no reference implementation to compare against, and thus this could potentially have bugs, I've decided to make this a nursery-level rule until we're sure it's stable and useful. --- Edit: - [ ] Sync with Biome - https://biomejs.dev/linter/rules/no-accumulating-spread/ --------- Co-authored-by: Cameron Clark <cameron.clark@hey.com> |
||
|---|---|---|
| .. | ||
| oxc | ||
| oxc_allocator | ||
| oxc_ast | ||
| oxc_cli | ||
| oxc_codegen | ||
| oxc_diagnostics | ||
| oxc_formatter | ||
| oxc_index | ||
| oxc_js_regex | ||
| oxc_linter | ||
| oxc_linter_plugin | ||
| oxc_macros | ||
| oxc_minifier | ||
| oxc_parser | ||
| oxc_prettier | ||
| oxc_query | ||
| oxc_resolver | ||
| oxc_semantic | ||
| oxc_span | ||
| oxc_syntax | ||
| oxc_transformer | ||
| oxc_type_synthesis | ||
| oxc_wasm | ||