question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`no-self-assign` failing for property assignment

See original GitHub issue

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.

var a = 123;
a = a;

var b = { a };
b.a = b.a; 

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.

2:5 error ‘a’ is assigned to itself no-self-assign

✖ 1 problem (1 error, 0 warnings)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:12 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
platinumazurecommented, Jul 21, 2016

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 wrote:

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.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/eslint/eslint/issues/6718#issuecomment-234303607, or mute the thread https://github.com/notifications/unsubscribe-auth/AARWemfF03LpMmHU-ynqSqglzbW_cmdtks5qX5phgaJpZM4JQXbi .

0reactions
ilyavolodincommented, Jul 22, 2016

👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

c++ - What is wrong with "checking for self-assignment" and ...
To answer my rhetorical question: It means that a well-designed assignment operator should not need to check for self-assignment. Assigning an ...
Read more >
Rules - ESLint - Pluggable JavaScript Linter
The "extends": "eslint:recommended" property in a configuration file enables ... Disallow assignment operators in conditional expressions ... no-self-assign.
Read more >
How to set up property assignment? in JustMock - Telerik
With JustMock I can't find any method that would assign a property value on a mocked instance. The following code fails in assertion:...
Read more >
CA2011: Do not assign property within its setter (code analysis)
Cause. A property was accidentally assigned a value within its own set accessor. Rule description. Assigning a property to itself in its set ......
Read more >
Property Validation fails due to assignment issues. - MathWorks
Property Validation fails due to assignment... Learn more about property validation, properties, validation, property validation function, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found