News for hackers. Stuff that matters.
Re:Prettier $20k Bounty was Claimed by meowtimemania on Monday November 27, 2023 @12:14PM (#38434991)
Do you have any examples where prettier code is much less readable? I haven't really ran into that issue and have been very happy with prettier.
Re:Prettier $20k Bounty was Claimed by harimau777 on Monday November 27, 2023 @12:43PM (#38435426)
Prettier often makes code written using sequences of .chaining much more difficult to read by forcing it all to the same line.

For the same reason, it often makes code written using composition more difficult to read since it won't let you decide when to put a sub-call on its own indented line for clarity.

Re:Prettier $20k Bounty was Claimed by pkilgore on Monday November 27, 2023 @01:50PM (#38436466)
Disable it! (https://prettier.io/docs/en/ignore.html)

I do this occasionally, and especially with things like test tables. Linters/formatters are there to help in the common case, not to be some oppressive dogma.

Re:Prettier $20k Bounty was Claimed by hu3 on Monday November 27, 2023 @02:09PM (#38436739)
If the fix is to disable prettier for an entire file, you're proving your parent poster point.
Re:Prettier $20k Bounty was Claimed by dewey on Monday November 27, 2023 @03:55PM (#38438136)
It doesn't have to be disabled for the whole file, you can annotate lines too as shown in the link the parent commenter shared.
Re:Prettier $20k Bounty was Claimed by francislavoie on Monday November 27, 2023 @06:45PM (#38440213)
Adding comments just to fight with prettier is... uglier. I rather just not use prettier at all. It's more harmful than good IMO.
Re:Prettier $20k Bounty was Claimed by HellsMaddy on Monday November 27, 2023 @01:53PM (#38436501)
I had the same gripe, and recently tried switching to dprint. It is much less aggressive with changing where lines break, and honestly it’s a huge relief to be able to break lines wherever I think makes the code most readable. It’s also significantly faster than prettier. I’ve been very happy with it.
Re:Prettier $20k Bounty was Claimed by morbicer on Tuesday November 28, 2023 @11:58AM (#38447908)
dprint is soo much better (configurable) and already written in Rust so very fast

I am sad it's not getting more popular

Re:Prettier $20k Bounty was Claimed by floydnoel on Monday November 27, 2023 @01:42PM (#38436329)
In those situations I make use of comments to force new lines where I want them. Stupid but it works!
Re:Prettier $20k Bounty was Claimed by mostlylurks on Monday November 27, 2023 @01:14PM (#38435881)
If I don't remember wrong, doesn't it put object destructurings on one line if they fit? That's both less readable than putting each destructured member on its own line as well as a cause of unnecessary whitespace changes in your commit history if you ever add one more field to the destructuring that takes it over the line length limit.
Re:Prettier $20k Bounty was Claimed by floydnoel on Monday November 27, 2023 @01:44PM (#38436360)
Add a comment anywhere in the destructuring and it will force each property onto its own line.
Re:Prettier $20k Bounty was Claimed by nicoburns on Monday November 27, 2023 @02:02PM (#38436650)
A good example from further down the comment section:

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
       }`;
Which is not only much harder to read in it's own right, but now takes up 6 lines instead of one!
Re:Prettier $20k Bounty was Claimed by bakkoting on Monday November 27, 2023 @07:29PM (#38440651)
I have a PR fixing that: https://github.com/prettier/prettier/pull/15209

Just needs another maintainer's stamp.