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
no-unused-vars
is incorrectly raised when function name matches parameter name
#2363
Comments
Thanks, we'll take a look. |
I think the Would it make sense to extract the shadowing checks as a common tool? |
Perhaps. We do have a lot of repeating logic across rules, not just related to scoping. I'm definitely open to suggestions to eliminate duplicate code. |
I've been digging a little bit about this one. Some previous discussions can be found in #2095, df9b254. Here are a few test cases related to
For now, I'm trying to find a fix for the "false positives" in 1, 2 and 3. I am not sure whether detecting all "missed negatives" (undetected unused vars) statically is even feasible/desirable. |
Actually there are tests that consider case 5 above as valid. Should we consider changing this behavior? |
The recursive stuff is hard to track down, especially in the case of anonymous functions. I'd say start with the first three cases and focus on getting those fixed. |
Fix: Improves detection of self-referential functions (fixes #2363)
The code snippet:
incorrectly complain about the parameter
a
being unused. It seem to prefer the reference to the funcion name instead of the parameter.Propably caused by the order in
block-scoped-var.js
.The text was updated successfully, but these errors were encountered: