Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prevent Prettier from moving comments to new line

Tags:

prettier

I have a typescript project formatted with prettier. My issue is when I save code like this:

const thing = await call({ // comment
  a: 1
});

Prettier moves the comment to a new line which is not what I want.

const thing = await call({
  // comment
  a: 1
});

How do I prevent this from happening while retaining all other format settings?

EDIT: I do not want to use another formatter or // prettier-ignore. I need this done from the config file .prettierrc.json

like image 965
abc Avatar asked Nov 18 '25 02:11

abc


1 Answers

This is a known issue with Prettier. If you're looking for the corresponding bug/feature request, it's here: https://github.com/prettier/prettier/issues/807

like image 54
Simon Sarris Avatar answered Nov 19 '25 16:11

Simon Sarris