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
allow negated condition in for-in guards in guard-for-in rule #7567
allow negated condition in for-in guards in guard-for-in rule #7567
Comments
Maybe this should be refactored to use code path analysis, so that we could flag the for statement if any path is reachable without having gone through a hasOwnProperty check. Of course, it doesn't help that right now we're not even checking what the IfStatement test looks like... 👍 from me. |
Oh, @michaelficarra, can you please edit your post to match this template? Thanks! |
@platinumazure Done. |
@michaelficarra Are you still interested in pushing this proposal forward? |
@not-an-aardvark Yes. What does that involve? |
It generally involves drumming up support from the team (see here). Right now there are two 👍s from team members on the proposal, so we would need one more for the proposal to be accepted. |
@not-an-aardvark Does my own 👍 count? |
No, it does not (it requires three 👍s in addition to a champion). ccing @eslint/eslint-team (sorry about all the pings today) to see if anyone else is in favor of this. |
We don't have a champion on this, so I'm setting this back to evaluating. If we don't get a champion in a week or two, we should probably close this. |
@platinumazure Since @michaelficarra created this issue, and filed a PR, I assume he is championing it, so setting it back to accepted. |
@ilyavolodin @michaelficarra Sorry for the mixup! |
I would like
guard-for-in
to allow the following pattern in addition to what it currently allows.To be clear, the difference is that this guard has a negated condition with a
continue
as the consequent. Thecontinue
should be allowed as the only statement in a block as well, to be compatible with that brace style preference.edit:
What rule do you want to change?
guard-for-in
Does this change cause the rule to produce more or fewer warnings?
Fewer.
How will the change be implemented? (New option, new default behavior, etc.)?
New default behaviour.
Please provide some example code that this change will affect:
What does the rule currently do for this code?
Warns.
What will the rule do after it's changed?
Not warn.
The text was updated successfully, but these errors were encountered: