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.

Feature Request: breakBeforeElse

See original GitHub issue

I know the goal of prettier is to standardize on a style, but it is also difficult since this did not come out at the same time as the language.

Our team uses the exact same style as prettier except placement for else statements. It is effectively blocking us from adopting this awesome library.

We prefer break before else to allow for cleaner comments.

// This does something
if (a) {
}
// This does something else if
else if {

}
// This does something else
else {

}

Which is nicer than.

// This does something
if (a) {

// This does something else if
} else if {

// This does something else
} else {

}

However this is preference and would be awesome if this was added as an option to prettier.

@vjeux showed how easy it is to do https://github.com/prettier/prettier/pull/837 and apparently @jlongster likes it 😃 https://twitter.com/jlongster/status/834407714965057540

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:178
  • Comments:173 (59 by maintainers)

github_iconTop GitHub Comments

90reactions
Kerrickcommented, Apr 14, 2017

This feels like one of those “I can’t adopt prettier unless” options that was mentioned in the 1.0 release blog post. I’m in the die-hard camp of else being on its own line for the sake of our eyes scanning down a single column to see if there is an else block. I can’t really see myself adopting prettier without a breakBeforeElse option.

75reactions
vjeuxcommented, May 21, 2017

We are past 1.0 and are not going to do any major formatting changes to prettier or add more options. Feel free to use prettier-miscellaneous if you do want it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Feature Request: BreakBeforeElse #840
Feature Request : BreakBeforeElse #840 (github.com/prettier). 1 point by _ZeD_ 5 months ago | hide | past | favorite ...
Read more >
New Feature Request Process
Analyzing the issues in our three main repositories, we found that a large portion of them are feature requests:.
Read more >
prettier/prettier
Feature Request : BreakBeforeElse #840 Jun 28th 2022 news.ycombinator.com; 9. ... Looking into the pull requests of 50 open source projects Apr 24th...
Read more >
Prettier is an opinionated code formatter.
Feature Request : breakBeforeElse. I know the goal of prettier is to standardize on a style, but it is also difficult since this...
Read more >
Feature Request Template: How to Collect User Feedback ...
Why should you use a feature request form? Best practices when collecting feature requests; What are the different types of feature requests?
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