Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Why not just change it to a high value? Or prettier-ignore exceptional lines?


if you put a high lineWidth value, you'll have your object literals or destructuring mostly one-lined, etc.. often not desirable (for 4+ props)

That's mostly why I don't like prettier, sometimes you want a bit of control over code formatting when several options are possible, prettier don't allow it. I use vscode formatter (actually it's TypeScript compiler formatter) instead

Other things I dislike with prettier, like how it'd force parenthesis in a `2 + 3 * 4` expression, where it's a bit superfluous. Or string templates line returns on expressions https://github.com/prettier/prettier/issues/3280


I felt the same at first but I’ve honestly found after about a year of using prettier on every project that you just get used to the way it formats stuff and it’s a non-issue 99% of the time.

Where it does do something awkward e.g. to long expressions with lots of operators in, usually it’s actually a sign that you can make it clearer by splitting it into multiple smaller expressions which helps overall readability.

I think you can also tell prettier to ignore certain lines, though I don’t think I’ve ever needed to.


You can controll the formatting with empty comments

eg, if you dont like

    const {a, b, c} = props;
you can do

    const {
      // 
      a, 
      b, 
      c
    } = props;


But please don’t.


Then it wraps longer statements into one line. Which for things of unrestricted length (e.g. arrays) is not an option.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: