Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Closing > in new line

I have problem with '>' in tags. I got:

<label
    class="custom-control-label"
    for="building{{building.Id}}"
>
 {{ building.City }}, {{ building.Name }}
</label>

How to make label starting tag '>' in the same line as last attribute? I use Prettier, but I neither couldn't find solution in their config nor in code settings.

<label
   class="custom-control-label"
   for="building{{building.Id}}">
     {{ building.City }}, {{ building.Name }}
</label>

Solution: I've used built-in VS Code formatter.

like image 502
Mieszczańczyk S. Avatar asked Nov 19 '18 00:11

Mieszczańczyk S.


3 Answers

In Prettier < 2.4.0:

  • Add jsxBracketSameLine: true in your Prettier settings.

In Prettier >= 2.4., jsxBracketSameLine is deprecated, so:

  • Add bracketSameLine: true in your Prettier settings.

You can refer to the official documentation for more information.

like image 145
Junip Dewan Avatar answered Nov 10 '22 18:11

Junip Dewan


That setting in prettier is called jsxBracketSameLine and needs to be set to true

Documentation

https://prettier.io/docs/en/options.html#jsx-brackets

like image 7
AnonymousSB Avatar answered Nov 10 '22 17:11

AnonymousSB


You can follow this thread.

This a feature request for Prettier.

like image 6
Oswaldo Avatar answered Nov 10 '22 16:11

Oswaldo