Rule Proposal: Spacing in `if` statement condition
See original GitHub issueNot 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:
- Created 7 years ago
- Comments:8 (7 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I haven’t. Currently I just enforce it in code reviews.
@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.
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.