Search code examples
angulartypescriptvisual-studio-codeprettier

How to disable prettier settings creating new line of > of html tag?


I walk through the Prettier extension of Vscode and I can't find how to disable this scenario. See the > of html tag.

Here's a sample code that needed some fix, every time i run the Prettier. The output is this:

<tag-html
 [val1]="valueStr"
 [val2]="valueStr"
>
</tag-html>

I want Prettier to output:

<tag-html
 [val1]="valueStr"
 [val2]="valueStr">
</tag-html>

Solution

  • For JSX (and other file types, like HTML) this can be done setting

    "bracketSameLine": true

    in your .prettierrc

    see https://prettier.io/docs/en/options.html#bracket-line

    (or jsxBracketSameLine for versions < 4.2.0)