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
Fix: one-var allows uninitialized vars in ForIn/ForOf (fixes #5744) #6272
Conversation
LGTM |
By analyzing the blame information on this pull request, we identified @IanVS, @gyandeeps and @vitorbal to be potential reviewers |
@@ -400,14 +450,6 @@ ruleTester.run("one-var", rule, { | |||
}, | |||
{ | |||
code: "var i = [0], j;", | |||
options: [ { initialized: "never" } ], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like this is a duplicate test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, never mind
LGTM |
Code looks good. Can you add something to the docs? |
Oh yeah - sure thing! |
142bac8
to
f02e9bc
Compare
LGTM |
Updated with changes to the docs |
@@ -203,6 +203,8 @@ function foo() { | |||
|
|||
When configured with an object as the first option, you can individually control how `var`, `let`, and `const` are handled, or alternatively how `uninitialized` and `initialized` variables are handled (which if used will override `var`, `let`, and `const`). | |||
|
|||
**Note:** A variable declared in a for-in or for-of loop will NOT be flagged with the option `{ uninitialized: "always" }`, as this value is determined by the loop. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you change "NOT" to lowercase (we don't do this anywhere else)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yeah, no problem
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
LGTM |
Lgtm |
No description provided.