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
no-self-assign
failing for property assignment
#6718
Comments
Hmm... Seems like MemberExpressions just aren't being checked, even though a lot of other kinds of self-assignments are. @mysticatea Is there a reason MemberExpressions aren't checked in this rule, or was it maybe just an oversight? |
Thank you for this issue. Granted, property accesses can trigger side-effects, but I think that a use of self-assignments in order to trigger side-effects is a corner case. |
Are we sure that this should be a default behavior? As mentioned, properties can have getters/setters, so we need to be certain that this makes sense as a default. And since this is flagging something that wasn't flagged before, this should be an enhancement "Update". |
I removed I think it's good for default behavior since it does not expect that self-assignments have side-effects, normally. |
My question is, can we assume that? I'm not sure we can. |
Can we put it behind a rule option so users can make that call? On Jul 21, 2016 11:12 AM, "Nicholas C. Zakas" notifications@github.com
|
I think I would prefer this behind an option as well. Just to be on a safe side. Maybe the option can be on by default, but at least that way users will have a way to turn it off. |
For best backwards compatibility, I'd suggest having the option off by default and allow people to opt-in. |
👍 to @nzakas' proposal. |
Hmm, OK. |
That sounds good. Since this is an enhancement now, we need one more 👍 |
👍 |
What version of ESLint are you using?
3.1.1
What parser (default, Babel-ESLint, etc.) are you using?
Default
Please show your full configuration:
{ "env": { "browser": true }, "parserOptions": { "ecmaVersion": 6 }, "rules": { "no-self-assign": "error" } }
What did you do? Please include the actual source code causing the issue.
What did you expect to happen?
I would expect
b.a = b.a
to be a error;What actually happened? Please include the actual, raw output from ESLint.
Only
a.a
is an error.The text was updated successfully, but these errors were encountered: