Feature Request: breakBeforeElse
See original GitHub issueI 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:
- Created 7 years ago
- Reactions:178
- Comments:173 (59 by maintainers)
Top 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 >
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
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.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.