-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
prefer-const
false positive
#5610
Comments
This is interesting. Tried these in the demo: Valid: /* eslint prefer-const: 2 */
let foo;
if (bar) {
foo = 42;
}
baz(foo); Invalid (valid example with braces around /* eslint prefer-const: 2 */
let foo;
if (bar) foo = 42;
baz(foo);
Invalid (valid example with function call removed): /* eslint prefer-const: 2 */
let foo;
if (bar) {
foo = 42;
}
Why is it that the combination of curly braces around the @SimenB if you add curly braces around the |
@btmills Ah, good catch! Adding braces makes the warning go away |
Cool. So at least there's a workaround that can be used while we figure out what's going on here. I don't see any tests that cover this case. @mysticatea you looked at scoping for |
I has forgotten this case: /* eslint prefer-const: 2 */
let foo;
if (bar) foo = 42;
baz(foo); |
Fix: `prefer-const` false positive at non-blocked if (fixes #5610)
What version of ESLint are you using?
2.4.0
What parser (default, Babel-ESLint, etc.) are you using?
default
Please show your full configuration:
What did you do? Please include the actual source code causing the issue.
What did you expect to happen?
No warning, as
DevTools
is used outside of theif
-statementWhat actually happened? Please include the actual, raw output from ESLint.
I'm aware of many potentially related issues (#5251, #5283, and #5284), but I don't think this one is covered
The text was updated successfully, but these errors were encountered: