Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 486767

Summary: Update no-redeclare quickfix to handle duplicated arguments
Product: [ECD] Orion Reporter: Michael Rennie <Michael_Rennie>
Component: JS ToolsAssignee: Olivier Thomann <Olivier_Thomann>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: Olivier_Thomann
Version: unspecified   
Target Milestone: 13.0   
Hardware: All   
OS: All   
Whiteboard:

Description Michael Rennie CLA 2016-01-28 13:28:41 EST
We should consume the no-dupe-args rule

http://eslint.org/docs/rules/no-dupe-args
Comment 1 Olivier Thomann CLA 2016-07-18 18:17:17 EDT
This rule collides with the "no-redeclare" rule.
So for the examples given in the documentation,

/*eslint-env browser */
function foo(a, b, a) {
	console.log("value of the second a:", a);
}

var bar = function(a, b, a) {
	console.log("value of the second a:", a);
};

the second 'a' is reported as being already declared which is good enough. I think I will just update the quickfix to be able to rename the variable.
Comment 2 Olivier Thomann CLA 2016-07-18 18:20:52 EDT
The page http://eslint.org/demo/ shows that 'a' is reported as a no-redeclare error and a no-dup-args error. I don't mind keeping both, but I think one of them is enough as long as the quickfix can also handle function arguments which is not the case now.
Comment 3 Michael Rennie CLA 2016-07-19 08:52:38 EDT
(In reply to Olivier Thomann from comment #2)
> The page http://eslint.org/demo/ shows that 'a' is reported as a
> no-redeclare error and a no-dup-args error. I don't mind keeping both, but I
> think one of them is enough as long as the quickfix can also handle function
> arguments which is not the case now.

I agree, two rules that mark the same thing seems excessive.
Comment 4 Olivier Thomann CLA 2016-07-19 10:47:32 EDT
Updating title accordingly.
Comment 5 Olivier Thomann CLA 2016-07-19 10:49:44 EDT
For the duplicate arguments issue, the quickfix will only rename the argument without trying to rename all identifiers that match the duplicate argument name as it is not clear which ones match to the first argument or the duplicated one.