no-mutating-container-transform
Return array replacements without mutating borrowed array inputs.
Why
A returned array does not undo writes visible through the caller's original aliases. Copying only after mutation leaves the caller changed.
Fix
Copy before changing the array and return the replacement, or use an explicit in-place command returning void. Preserve scalar command/result contracts.
Examples
function ordered(values: number[]): number[] { values.sort(); return values;}function ordered(values: number[]): number[] { const result = [...values]; result.sort(); return result;}