[prettierx] flexible block brace style
See original GitHub issueSimilar to --break-before-else
option, please add an option for Stroustrup brace style. This would basically add breaks before certain statements, including else
, catch
, and finally
. See ESLint’s Brace Style Documentation for examples.
From @brodybits (May 2021):
- Looking at the eslint
brace-style
rule, I think it would be ideal to support the “Allman” as well as “Stroustrup” brace style. - For discussion if we should support configuration per statement type, as was proposed for non-block statements in PR #327
- This may supersede the
--break-before-else
option from PR #224.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:7 (2 by maintainers)
Top Results From Across the Web
brodybits/prettierx: a less opinionated fork of Prettier ... - GitHub
prettierX - a less opinionated fork of Prettier. License: MIT npm. An unofficial fork of the Prettier code formatter, intended to provide some...
Read more >Options - Prettier
If you want Prettier to force all prose blocks to be on a single line and rely on editor/viewer soft wrapping instead, you...
Read more >Rules - JavaScript Standard Style
Keep else statements on the same line as their curly braces. eslint: brace-style // ✓ ok if (condition) { // . ... Add...
Read more >prettierx | Yarn - Package Manager
prettierX - a less opinionated fork of the Prettier code formatter ... (with some prettierX language-js updates now based on Prettier 2.3.2).
Read more >Removing new lines before empty blocks in Eclipse
As far as I can tell this is not (yet) possible in eclipse; you can specify when new lines should be inserted or...
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
The stoustrup style applies to more than if/else blocks. It applies to any set of inseparable blocks.
Input:
Output:
Basically there should be at least one break after any
}
that closes a block statement.Should also respect comments: