eslint-plugin-etc
eslint-plugin-etc copied to clipboard
[Feature request] `prefer-readonly-array`
Enforces an array argument of a function to be declared as readonly if it's never mutated in the function body.
function getValues(
items: { value: number }[] // Should be readonly!
) {
return items.map(item => item.value)
}
Rationale: https://x.com/leishenghao/status/1664067474097332224?s=46&t=A5GTMNUCLTkLO8tQ8jEQJA