Prettier same line bracket for self-closing tags

Viewed 748

Is there any way to make prettier put the bracket of a self closing tag on the same line as the last attribute of a JSX element?

Here is what I mean:

enter image description here

I wanted to put it on the same line as the last attribute to save some space. Also, I already have configured prettier with bracketSameLine but this only applies to non self-closing elements.

1 Answers

Prettier has very few configuration options by design. It offers a small amount of control, but in the end it it designed to take the decision on how to style certain code elements off the developers.

This specific decision on where to put the closing bracket aims for minimizing diffs (appending an attribute to your input tag will add a single line without modifying existing lines in this case).

So the only options I see here are:

  1. Accept Prettier's suggestions.

OR

  1. Don't use Prettier.
Related