oxc/crates
Don Isaac 795db7c5b7
feat(linter): cxc: no accumulating spread (#1607)
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>
2023-12-05 17:25:40 +08:00
..
oxc refactor(rust): move to workspace lint table (#1444) 2023-11-20 14:38:10 +08:00
oxc_allocator refactor(rust): move to workspace lint table (#1444) 2023-11-20 14:38:10 +08:00
oxc_ast feat(transformer): Start on function_name transform. (#1510) 2023-12-04 13:35:44 +08:00
oxc_cli feat(prettier): turn off preserve_parens and start working on need-parens (#1487) 2023-11-21 16:26:56 +00:00
oxc_codegen chore(rust): remove unnecessary clippy::non_upper_case_globals (#1557) 2023-11-27 14:31:38 +08:00
oxc_diagnostics refactor(rust): move to workspace lint table (#1444) 2023-11-20 14:38:10 +08:00
oxc_formatter feat(ast): implement new proposal-import-attributes (#1476) 2023-11-25 15:56:09 +08:00
oxc_index refactor(rust): move to workspace lint table (#1444) 2023-11-20 14:38:10 +08:00
oxc_js_regex Initialize JS Regex crates and def AST. (#1500) 2023-11-23 00:22:17 +08:00
oxc_linter feat(linter): cxc: no accumulating spread (#1607) 2023-12-05 17:25:40 +08:00
oxc_linter_plugin refactor(rust): move to workspace lint table (#1444) 2023-11-20 14:38:10 +08:00
oxc_macros feat(linter): add a perf category (#1625) 2023-12-04 17:31:34 +08:00
oxc_minifier refactor(rust): move to workspace lint table (#1444) 2023-11-20 14:38:10 +08:00
oxc_parser feat(parsr): parse let.a = 1 with error recovery (#1587) 2023-11-29 23:21:39 +08:00
oxc_prettier feat(prettier) port should_break_after_operator (#1606) 2023-12-02 20:40:25 +08:00
oxc_query feat(query): Add is_getter, is_setter, is_constructor to all Function implementors (#1526) 2023-11-27 12:22:41 +08:00
oxc_resolver Release oxc_resolver v0.5.5 2023-11-30 17:16:04 +08:00
oxc_semantic chore(rust): remove unnecessary clippy::non_upper_case_globals (#1557) 2023-11-27 14:31:38 +08:00
oxc_span refactor(rust): move to workspace lint table (#1444) 2023-11-20 14:38:10 +08:00
oxc_syntax feat(prettier): binaryish expressions with parens (#1597) 2023-12-01 13:52:22 +08:00
oxc_transformer feat(transformer): Start on function_name transform. (#1510) 2023-12-04 13:35:44 +08:00
oxc_type_synthesis refactor(rust): move to workspace lint table (#1444) 2023-11-20 14:38:10 +08:00
oxc_wasm chore(deps): bump the dependencies group with 2 updates (#1623) 2023-12-04 15:26:44 +08:00