Is there a config in prettier to keep line breaks?

Please try adding .prettierrc file to your code and adding a line in the object of the file.

"printWidth": 100

Reference screenshot: enter image description here


If you open VSC and go into settings then Extentions and click on "prettier" there's a check box ticked under Prettier: 'Require Config'. If that's unchecked it will break your lines automatically enter image description here


Did not find a configuration. As a hack you might want to include a comment on the first line to break:

return ternaryExpression //
          ? trueResult
          : falseResult;

According to this Github issue and looking at the doc, it doesn't seem to be possible to configure it to keep line breaks.

You could however set a very short printWidth or put // prettier-ignore comment above your code.