eslint-plugin-better-mutation
eslint-plugin-better-mutation copied to clipboard
Permit modification of variables created using array prototype functions that result in new arrays
In most cases its weird to modify an array created using map, however it may be desired in certain circumstances
eg the following could be considered to be ok.
'const a = x.map(v => v); a[0] = 2;',
The following array methods are theoretically ok:
'Array.prototype.concat',
'Array.prototype.filter',
'Array.prototype.flat',
'Array.prototype.flatMap',
'Array.prototype.map',
'Array.prototype.slice',
'Array.prototype.toReverse',
'Array.prototype.toSorted',
'Array.prototype.toSpliced',
'Array.prototype.with',