0

I want to keep my code like this:

    <div>
      <form action="">
        <button type="button" onClick={() => setsearchStr('Random')}>Text</button>
      </form>
    </div>

But prettier changes it to:

    <div>
      <form action="">
        <button type="button" onClick={() => setsearchStr('Random')}>
          Text
        </button>
      </form>
    </div>

How can i achieve this?

Thanks

I already have this config:

{
  "trailingComma": "es5",
  "tabWidth": 2,
  "semi": true,
  "singleQuote": true,
  "arrowParens": "avoid",
  "printWidth": 130,
  "bracketSameLine": true
}

Luc881
  • 1
  • 1
  • see [HTML whitespace sensitivity](https://prettier.io/docs/en/options.html#html-whitespace-sensitivity) or increase your `printWidth` – pilchard Apr 19 '23 at 00:38

1 Answers1

0

Hi you can achieve this by adding :

    "singleAttributePerLine": false,

to your prettier config.

Hope it works for you !

Single Attribute per Line

Samuel
  • 464
  • 5