-
-
Notifications
You must be signed in to change notification settings - Fork 186
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
Missing warning for: ReferenceError: variable is not defined #516
Comments
@lelit It would be great if you could take a look. |
Will do, and sorry for not noticing this kind of reports! |
WRT the unused parameter, it's a deliberate behavior, given how often you write a function that does not consume all its arguments. Maybe there could be an opt-in/opt-out option to select a different reaction. On the undefined var, it's indeed a general defect I will try to address, as it manifests itself even in a simpler case: function foo() {
var x = x + 1;
} I seem to remember that the logic behind the check is "was this variable declared in var-block before this point?"... it should probably add the check "... and, if this is a declaration, a DIFFERENT var-block" or something like that. |
About the unused parameter. It is in fact used, so why should it produce a warning? This variable is destructured and given a new name, as documented here: |
I was talking about the comment
in your first example: function missingWarning (var0) {
const var1 = {var1};
console.log("Var1:", var1);
}
missingWarning(); |
Aha! My mistake. I suspect I did not get a warning about var0 in my editor when I created the example. I'm not sure but that warning might have been implemented after I created my example. |
Yes that's right.. #515 |
js2-mode should warn about "unused var0" and "var1 is not defined".
The text was updated successfully, but these errors were encountered: