4

I have written a single line of code.

enter image description here

And after save prettier reformat the line into 2.

enter image description here

How to stop prettier from breaking lines into two?

rioV8
  • 24,506
  • 3
  • 32
  • 49
Mahbub Ul Islam
  • 773
  • 8
  • 15

1 Answers1

6

You need to increase the printWidth in your .prettierrc file:

The number is the number of characters before a wrap will be attempted, to stop lines from being wrapped at all set a high number like 1000.

.prettierrc

{
    "printWidth": 1000
}

From the prettier documentation

Print Width:
Specify the line length that the printer will wrap on.

lejlun
  • 4,140
  • 2
  • 15
  • 31
  • 7
    That won't work, it will cause Prettier to try and make all lines 1000 characters long. Ideally they should add a setting that will leave line lengths alone. – Jeandré Dec 07 '21 at 06:40