Remove semantically redundant spread syntax in array literals, object literals, function calls, and constructor calls when the rewrite is provably behavior-preserving.
Removes semantically redundant spread syntax in JavaScript and TypeScript source, aligned with eslint-plugin-unicorn/no-useless-spread, while staying conservative about runtime behavior.
What It Rewrites
Array literals that spread a literal array with no holes, such as const x = [1, ...[2, 3]] to const x = [1, 2, 3]
Function and constructor calls that spread a literal array with no holes, such as fn(...[a, b]) to fn(a, b) and new C(...[a, b]) to new C(a, b)
Object literals that spread a plain object literal with only static data properties and no key conflicts, such as {x: 0, ...{a: 1}, y: 2} to {x: 0, a: 1, y: 2}
Preserve Cases
Sparse arrays such as [...[ ,1]] and [...[, ,]]
Non-literal or unknown spread operands such as [...arr], fn(...args), and new C(...factory())
Object spreads with getters, setters, methods, computed keys, __proto__, or duplicate-key conflicts
Objects with sibling spread properties that are not statically provable as safe to inline