New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial attempt to add a no-array-mutation rule #5

Open
wants to merge 2 commits into
base: master
from

Conversation

Projects
None yet
3 participants
@davidgtonge
Copy link

davidgtonge commented Mar 14, 2016

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 added some commits Mar 14, 2016

Initial attempt to add a no-array-mutation rule
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, reverse
@amilajack

This comment has been minimized.

Copy link

amilajack commented Jul 26, 2016

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

@jhusain

This comment has been minimized.

Copy link
Owner

jhusain commented Aug 15, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment