Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upPossible new rule-disallow naming a variable in a function the same as a function parameter #891
Comments
This comment has been minimized.
This comment has been minimized.
|
http://eslint.org/docs/rules/no-redeclare It is enabled... your example doesn't work. |
dcousens
closed this
May 19, 2017
dcousens
added
enhancement
need more info
and removed
enhancement
labels
May 19, 2017
This comment has been minimized.
This comment has been minimized.
|
@dcousens sorry, what I meant was: function (a) {
if (a) {
let a = 1
console.log(a)
}
}this one is valid currently. |
dcousens
reopened this
May 19, 2017
Flet
added
enhancement
and removed
need more info
labels
Nov 7, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
capaj commentedMay 19, 2017
I'd like to have a rule against naming variables in a function the same as a function parameter.
It makes code unreadable, because it requires the reader to resolve the scope of current variable based on scoping rules and that's not always easy, especially with
let.I don't think there is an eslint rule for this, but if there would be a a positive stance toward this rule by standard maintainers I'd love to write such a rule.
example of invalid code: