-
Notifications
You must be signed in to change notification settings - Fork 889
no-duplicate-variable: handle parameters #2597
Conversation
please merge develop, this will fail strict-boolean-expressions #2408 |
[enhancement] `no-dupliate-variable`: added check if variable has the same name as a parameter
@adidahiya I can't confirm there is anything failing. Anyways, I rebased on master. |
@@ -108,6 +109,7 @@ function testArguments1(arg: number, arg: number): void { | |||
// failure: local var/let declarations shadow arguments. | |||
function testArguments2(x: number, y: number): void { | |||
var x = 1; | |||
~ [err % ('x')] | |||
let y = 2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why isn't y
a problem?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this rule doesn't handle block scoped declarations. these result in a compiler error, so there is no need for a linter error
@adidahiya I don't think having this check in How about adding a new config option |
@adidahiya I added a new options |
PR checklist
Overview of change:
[new-rule-option]
no-dupliate-variable
addscheck-parameters
to check if variable has the same name as a parameterThis is needed because of the behavior change of
no-shadowed-variable
in my upcoming PR.Also the name of the rule implies this behavior. At least I expected that...
Is there anything you'd like reviewers to focus on?
The rule does not check for duplicate parameter names, because the compiler already does that.
Changelog entry
[new-rule-option]
no-duplicate-variable
addscheck-parameters
to check if variable has the same name as a parameter