eslint-plugin-better-mutation icon indicating copy to clipboard operation
eslint-plugin-better-mutation copied to clipboard

Permit modification of variables created using array prototype functions that result in new arrays

Open sloops77 opened this issue 8 months ago • 0 comments

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',

sloops77 avatar Jun 12 '24 01:06 sloops77