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: no-var should fix ForStatement.init #7993
Conversation
@mysticatea, thanks for your PR! By analyzing the history of the files in this pull request, we identified @alangpierce, @vitorbal and @not-an-aardvark to be potential reviewers. |
LGTM |
fdfcd4d
to
e37195d
Compare
LGTM |
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.
I think the current implementation can change the behavior of some code:
for (var i = 0, i = 0; false;);
// gets fixed to
for (let i = 0, i = 0; false;); // syntax error
var i = 0;
for (var i = 1; false;);
console.log(i); // => 1
// gets fixed to
var i = 0;
for (let i = 1; false;);
console.log(i); // => 0
@not-an-aardvark No. This PR does not change those cases. This is a revision of #7962; it removes |
Oh, I see. LGTM then. I'll look into those cases in a separate PR. |
e37195d
to
27e82c3
Compare
LGTM |
I rebased to resolve conflicts and just added tests for those cases. |
What is the purpose of this pull request? (put an "X" next to item)
[X] Bug fix (template)
Tell us about your environment
What parser (default, Babel-ESLint, etc.) are you using?
Please show your full configuration:
What did you do? Please include the actual source code causing the issue.
What did you expect to happen?
The
var
declaration is fixed then no errors.What actually happened? Please include the actual, raw output from ESLint.
What changes did you make? (Give an overview)
I changed
no-var
rule to fixvar
declarations atForStatement.init
.Is there anything you'd like reviewers to focus on?
Nothing in particular.