Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Fix: no-extra-parens autofix with `in` in a for-loop init (fixes #11706) #11848
What is the purpose of this pull request? (put an "X" next to item)
[x] Bug fix: #11706
What changes did you make? (Give an overview)
For example, the following will be treated as a correct code (not reported):
for (let a = (b in c); ;); for (let a = (b in c && d); ;); for (let a = b => (b in c); ;);
Removing parens would produce SyntaxError. Each line would be treated as an invalid for-in loop.
Also, this change is trying to minimize false negatives, i.e. to remove really 'extra' parens.
For example, the following:
for (let a = ((b in c) && (d in e)); ;);
would be fixed to:
for (let a = (b in c && d in e); ;);
Is there anything you'd like reviewers to focus on?
The following is done in this commit:
While doing this I've also found two possible bugs (missing checks) on