no-growing-array-spread-in-loop
Review repeated prefix copies of a growing fresh local array inside a loop.
Why
Repeatedly copying all accumulated elements can make append collection quadratic in the output size.
Fix
Append into a fresh locally owned output when snapshot and observation semantics permit it.
Examples
export function collect(input: string[]) { let rows: string[] = []; for (const row of input) { rows = [...rows, row]; } return rows;}export function collect(input: string[]) { const rows: string[] = []; for (const row of input) { rows.push(row); } return rows;}