eslint-plugin-immutable icon indicating copy to clipboard operation
eslint-plugin-immutable copied to clipboard

Initial attempt to add a no-array-mutation rule

Open davidgtonge opened this issue 8 years ago • 2 comments

Hi

This is currently a simplistic check that looks for calls of array methods that mutate. Not restricted to arrays currently so will actually block any method calls with push, pop, splice, shift, unshift or reverse, e.g. this currently warns if I use const newArray = R.reverse(array)

I'm new to Eslint and so I'm not sure if there is a way to make this check more specific to arrays.

davidgtonge avatar Mar 14 '16 02:03 davidgtonge

This would be a welcome PR. What is the status of this?

amilajack avatar Jul 26 '16 17:07 amilajack

Not confident that this change wouldn't negatively impact users of ImmutableJS. Unfortunately I don't think we can assume that methods with the same name as the Array methods are mutating. maybe if confirm there is nothing capturing the return value this would be safe. Seems like a prohibition on that would encompass this.

jhusain avatar Aug 15 '16 16:08 jhusain