question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

allow negated condition in for-in guards in guard-for-in rule

See original GitHub issue

I would like guard-for-in to allow the following pattern in addition to what it currently allows.

for (key in foo) {
    if (!{}.hasOwnProperty.call(foo, key)) continue;
    doSomething(key);
}

To be clear, the difference is that this guard has a negated condition with a continue as the consequent. The continue should be allowed as the only statement in a block as well, to be compatible with that brace style preference.

for (key in foo) {
    if (!{}.hasOwnProperty.call(foo, key)) {
        continue;
    }
    doSomething(key);
}

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:

for (key in foo) {
    if (!{}.hasOwnProperty.call(foo, key)) continue;
    doSomething(key);
}
for (key in foo) {
    if (!{}.hasOwnProperty.call(foo, key)) {
        continue;
    }
    doSomething(key);
}

What does the rule currently do for this code?

Warns.

What will the rule do after it’s changed?

Not warn.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:4
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
michaelficarracommented, Nov 8, 2016
0reactions
platinumazurecommented, Jan 4, 2018

@ilyavolodin @michaelficarra Sorry for the mixup!

Read more comments on GitHub >

github_iconTop Results From Across the Web

GUARD DUTY - Army Publishing Directorate
This ensures that the guards know who is authorized to challenge and inspect the guard force and to maintain security of the area...
Read more >
Guard Force Management — Focus and Responsibilities
Many companies employ a third-party Guard Force Manager to oversee security operations and manage resources. There are several benefits to ...
Read more >
FM3-90 Chapter 12 Security Operations - GlobalSecurity.org
A guard force uses all means at its disposal, including decisive engagement, to prevent the enemy from penetrating to a position were it...
Read more >
Tag Archives: Local Guard Force - Diplopundit
We understand that the local guard force has between 900-1000 members, and that this dispute has been going on since last month.
Read more >
12 FAM 420 POST SECURITY MANAGEMENT
(12) (U) Supervising the local guard force coordinator, residential security ... liaison agreements with the host government and as local conditions permit.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found