Hacker News new | past | comments | ask | show | jobs | submit login

I dislike prettier and wonder why it's so popular because

- I sometimes prefer lines to exceed maxLength (ex: template string, which prettier would horribly break on vars)

- allow `1 + 2 * 3` or `a || b && c` to be parenthesis-less because everyone know the precendence here




> I sometimes prefer lines to exceed maxLength (ex: template string, which prettier would horribly break on vars)

Prettier doesn't break a long template literal though...?

> allow `1 + 2 * 3` or `a || b && c` to be parenthesis-less because everyone know the precendence here

"Everyone knows" is usually an unwise assumption. And adding parentheses does make it easier to read even for people who know their order of operations.


Not OP, but prettier doesn't break template literals, but it will break non-literal sections of template strings. For example, if we wrote this:

    const foo = `aaaaaaaaaaaaaaa${bbbbbbbbbbbbb}ccccccccccccccc${ddddddddddd}`;
prettier would fix it to

    const foo = 
      `aaaaaaaaaaaaaaa${
        bbbbbbbbbbbbb
       }ccccccccccccccc${
        ddddddddddd
       }`;
(or something similar) and it would be fully equivalent.

I don't like it doing that either tbh but hey prettier is good enough in most cases its worth putting up with it


I have a PR fixing that specific issue: https://github.com/prettier/prettier/pull/15209

Just needs another maintainer's stamp.




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

Search: