Skip to content
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

Support MemberExpressions in no-mutating-methods allowedObjects #54

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

raineorshine
Copy link

@raineorshine raineorshine commented Jan 1, 2021

In no-mutating-methods, the allowedObjects option currently only works on Identifier types, not MemberExpression types. This PR adds support for MemberExpression types.

For example, this currently reports an error:

/* eslint fp/no-mutating-methods: ["error", {"allowedObjects": ["two"]}] */
one.two.push(a)

Use Case

The standard way of navigating to a new route in vue-router is with this.$router.push(...). Setting "allowedObjects": ["$router"] does not work as expected. There is no way to get no-mutating-methods to ignore this with the current implementation.

Additional Nodes

This is a breaking change. I can add a different option to avoid breaking, but arguably the existing option should have always functioned this way.

raineorshine added a commit to a-thousand-worlds/a-thousand-worlds-2 that referenced this pull request Jan 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant