-
Notifications
You must be signed in to change notification settings - Fork 463
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow detect when function argument shadows existing variable #443
Comments
Parameter names are very specific to a function, so JSLint allows redefinition of them. I suppose we could add an option to allow/prohibit them, but I am not sure it is worth the price. |
If I where to recommend any change, it would be to warn against single letter variable names. They are cryptic, confusing, and conducive to making errors like yours. |
|
IMHO, I think there are cases when a single letter variable can be allowed
|
In the following code I use variable "s" to store string "foo", then I want to iterate over "data" array using forEach, I use function argument "s" which "overwrites" the parent "s". Jslint currently does not show it as warning:
Could jslint produce warning, something like:
Redefinition of 's' from line 1.
JSLINT already does it for local variables:
The text was updated successfully, but these errors were encountered: