This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 463490 - [eslint] Implement a 'no-self-assign' rule
Summary: [eslint] Implement a 'no-self-assign' rule
Status: RESOLVED FIXED
Alias: None
Product: Orion (Archived)
Classification: ECD
Component: JS Tools (show other bugs)
Version: 7.0   Edit
Hardware: PC Windows 7
: P4 enhancement (vote)
Target Milestone: 11.0   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-03-30 12:12 EDT by Mark Macdonald CLA
Modified: 2015-12-17 14:41 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Macdonald CLA 2015-03-30 12:12:08 EDT
I recently made a foolish mistake while assigning a variable. I had intended to write
> var RUNTIME = "runtime";

but instead I wrote:
> var RUNTIME = RUNTIME;   // RUNTIME is now `undefined`


I can't think of a valid usecase for assigning the same variable to itself. It would be nice if the validator flagged this as a potential error.

Upstream eslint doesn't seem to have this feature, so it might be worth contributing back.
Comment 1 Eclipse Genie CLA 2015-12-17 10:24:58 EST
New Gerrit change created: https://git.eclipse.org/r/62944
Comment 2 Eclipse Genie CLA 2015-12-17 14:28:05 EST
New Gerrit change created: https://git.eclipse.org/r/62961