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.

Rule Proposal: Spacing in `if` statement condition

See original GitHub issue

Not sure if there’s already an ESLint rule for this, I couldn’t find one.

When does this rule warn? Please describe and show example code: Bad:

if (someLongFoo &&
  someLongBar) {

Good:

if (something) {
if (
 someLongFoo &&
 someLongBar
) 

Is this rule preventing an error or is it stylistic? Stylistic

Why is this rule a candidate for inclusion instead of creating a custom rule? It seems like it’d be just as useful as other stylistic rules included with ESLint. Coding guidelines commonly include information on correct spacing for if and switch statements.

Are you willing to create the rule yourself? Yes, if I get a chance to. Happy for someone else to pick it up though.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
Daniel15commented, Aug 8, 2016

have you ever been able to enforce this in a different tool like JSCS or JSHint? Thanks!

I haven’t. Currently I just enforce it in code reviews.

Would you mind looking at the rule change template and adding any missing information to your post? Thanks!

@platinumazure - Which parts of that template are required for new rules? It looks like the template is mainly for changes to existing rules.

It looks like we’re currently on ESLint 2.7.0.

0reactions
kaicataldocommented, Jan 8, 2017

I’m closing this issue because it looks like consensus couldn’t be reached. While we wish we could accommodate all requests, we have limited resources and do need to prioritize. We’ve found that issues failing to reach consensus after 21 days tend to never reach consensus, and as a team have decided to close such issues. This doesn’t mean the idea isn’t interesting or valuable, only that it’s not something the team can commit to at the moment.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Styling multi-line conditions in 'if' statements? [closed]
This is exactly how I solve this problem in my code. Having a keyword as the first word in the line makes the...
Read more >
PEP 8 – Style Guide for Python Code
When the conditional part of an if -statement is long enough to require that it ... Python disallows mixing tabs and spaces for...
Read more >
How to Format A Proposal : The Do's and Dont's | RFPIO
Double-spacing makes your proposal document much easier to skim. 4. DO insert paragraphs every 3-5 sentences. Always break up monolithic blocks of text,...
Read more >
4. Conditionals and loops — Beginning Python Programming ...
Each condition is checked in order. If the first is false, the next is checked, and so on. If one of them is...
Read more >
Nested IF in Excel – formula with multiple conditions - Ablebits
Excel nested IF statement - multiple conditions in a single formula ... Excel doesn't care about extra spacing in a formula, so you...
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