Bracket and Brace Together and Keep Multiline
See original GitHub issueHi, in my case, prettier formats a typescript code from:
Input (wanted)
this.messageService
.prompt(this.name, [{
name: 'value',
type: 'number'
}])
Output (formatted)
this.messageService
.prompt(this.name, [
{
name: 'value',
type: 'number'
}
])
I expected keep bracket and braces together. (the first one) [{ ...
not [\n\t{ ...
Is there a option for e.g. .prettierrc
“prettier”: “^1.15.3”,
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Multiple lines one side of equation with a Curly Bracket - TeX
Multiple lines one side of equation with a Curly Bracket ... Large braces for specifying values of variables by condition (5 answers).
Read more >How to bracket over multiple lines of text in Word document?
1. Click Insert > Shapes, then select a left or right brace shape from the drop-down list. · 2. Then draw a brace...
Read more >When are curly braces not required for multi-line loop bodies?
You need curly braces when using multiple statements (not multiple lines). However it is good practise to always use the curly braces.
Read more >How to make left curly bracket encompass multiple lines MS ...
make a left curly bracket enclose more than three lines to the right of it.Best Way to Type/Insert Parenthesis, Brackets.
Read more >How to add a big curly bracket in Microsoft Word - YouTube
How to add a big curly bracket to multiple lines in Microsoft WordA big curly bracket is used normally in the situation of...
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 FreeTop 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
Top GitHub Comments
I understand. I do agree the option philosophy. Not with all formats. But this is Prettier.
Conclusion: Options are generally forbidden. Prettier format style should be unified but the community can vote for changes.
In my case:
This (I prefer, compact)
vs Prettier (Easier to add / remove objects.)
Right? It’s ok. I can live with that. 😄
Also another issue.
Input (wanted)
Output (formatted)
Expceted
Keep multilines. This happend on other places too. Not only contructor. e.g. arguments in a method. Or multiple operator. like
one && two && three
(the line break after&&
is removed.)Is there already a option? If not, this is a feature request.
I think Prettier counts the number of arguments for decision of single or multiline, right? Because other parts of my code is converted from single to multiline. This is great. But this should also happen to few arguments.