Skip to content
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

no-for-loop fix to invalid code #747

Closed
fisker opened this issue May 25, 2020 · 3 comments · Fixed by #749
Closed

no-for-loop fix to invalid code #747

fisker opened this issue May 25, 2020 · 3 comments · Fixed by #749

Comments

@fisker
Copy link
Collaborator

fisker commented May 25, 2020

We didn't use avoidCapture in this rule.

			for (let i = 0; i < arr.length; i += 1) {
				console.log(arr[i]);
				const element = foo();
				console.log(element);
			}

Fixed to

			for (const element of arr) {
				console.log(element);
				const element = foo();
				console.log(element);
			}
@papb
Copy link

papb commented May 25, 2020

Why is this fix invalid?

@fisker
Copy link
Collaborator Author

fisker commented May 25, 2020

the variable element

@papb
Copy link

papb commented May 25, 2020

🤦‍♂️ Of course, I must be asleep, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants