Live data from Hacker News

$20k bounty was claimed

prettier.io

111–120 of 345 posts

Re: $20k bounty was claimed

#111
post #63
post #33

While it's always great to see performance gains, my largest pain point with prettier was never performance. Instead my only gripe with prettier is the "line wrapping noise" it creates, illustrated here by Anthony Fu: https://antfu.me/posts/why-not-prettier#the-line-wrapping-no... Would it be realistic to expect a solution for this issue now that "prettier needs to step up it's game"?

I'd rather have a strict line length limit, than having my coworker creating objects in lines 150 or 180 chars long. So we'd end up discussing what is the best choice. I bet I'd also end up discussing those things with Anthony Fu. If the limit is 80, then the limit is 80 , not 81. Come Prettier. No more discussions. I definitely buy the tiny amount of "noise" it brings, in exchange for freeing me from an immense amou…

> If the limit is 80, then the limit is 80, not 81.

I agree with that. But the limit should be 120 or 160, not 80 (and my formatter should allow me to set a wider limit like that without making all my lines extra-wide - I want to be able to put things on one line where appropriate and not where it's not).

> I definitely buy the tiny amount of "noise" it brings

Tiny? It makes a lot of my code 3-5x as long. And often breaks things in weird places. This is IMO not a small reduction in readability.

Re: $20k bounty was claimed

#112
post #63
post #33

While it's always great to see performance gains, my largest pain point with prettier was never performance. Instead my only gripe with prettier is the "line wrapping noise" it creates, illustrated here by Anthony Fu: https://antfu.me/posts/why-not-prettier#the-line-wrapping-no... Would it be realistic to expect a solution for this issue now that "prettier needs to step up it's game"?

I'd rather have a strict line length limit, than having my coworker creating objects in lines 150 or 180 chars long. So we'd end up discussing what is the best choice. I bet I'd also end up discussing those things with Anthony Fu. If the limit is 80, then the limit is 80 , not 81. Come Prettier. No more discussions. I definitely buy the tiny amount of "noise" it brings, in exchange for freeing me from an immense amou…

80 character limit? Are we trying to relive the late 80s. Soon we'll move back to 40 characters. Screens can support higher resolutions now limiting lines to 80 so developers can turn their brains off seems silly. Turn your brain on and learn to filter the noise of 100 characters.

Re: $20k bounty was claimed

#113

Earlier quoted context omitted.

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.

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.

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: $20k bounty was claimed

#114
post #55

Earlier quoted context omitted.

Prettier’s biggest win is that it automates 99% of style complaints away and practically eliminates most classes of nitpicking. But, as well as the issue with line noise, it also encourages patterns that I think detract from code comprehension. It favours expressions over statements and even now, it’s not easy to set a breakpoint in the middle of one, so you end up rewriting into statements just so you can step throu…

does it? prettier is extremely configurable, unlike gofmt. so deferring to the authority of prettier is essentially deferring to the authority of the prettier.yml config. not that i have a problem with that _per se_, i’d expect the author(s) to take responsibility and appreciate that they’re defining/imposing their own taste(s).

Extremely configurable? It has like 3 config options, and an explicit policy of not being configurable.

Re: $20k bounty was claimed

#115
post #99
post #79

Earlier quoted context omitted.

I think the real issue with prettier is that it's almost become a de facto standard. E.g. personally I don't like it at all , but do like Svelte, and Svelte's official (and AFAIK only) formatter uses prettier. Hence I use prettier for Svelte, and ditto for a few other things. So the whole "extremely opinionated, if you want configuration go somewhere else" is great in principle, when people are choosing to use the to…

Well, this bounty is just about the only way that the Prettier team could contribute to solving that issue, so rejoice. Besides that, I get the impression being a universal standard is kind of a non-issue for Prettier: - If it was widespread, but highly configurable, that increases friction when switching projects, because there will be tiny formatting differences everywhere - If it was not widespread, it would not b…

> Well, this bounty is just about the only way that the Prettier team could contribute to solving that issue, so rejoice.

Erm, that bounty was for the production of a program that behaves exactly like prettier in at least 95% of cases, as far as I understood what "prettier test suite" means.

Re: $20k bounty was claimed

#116
post #8

> One question you are probably wondering is why would the Prettier team fund another project!? In practice, Prettier has been the dominant code formatter for JavaScript and as a result of a lack of competition, there has been little incentive to push on performance and fix various edge cases. I was indeed wondering that but the answer doesn't really answer the question for me. Why not set a bounty to improve Prettie…

> performance and fix various edge cases

Those are the two main things that rust is expected to help improve.

It's quite easy to empathize with somebody that sees a JS software having problem with those two and picking a language that is known to help with those instead of being known to increase those problems.

Re: $20k bounty was claimed

#118

Earlier quoted context omitted.

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.

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.

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: $20k bounty was claimed

#119

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 oper…

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

Re: $20k bounty was claimed

#120

"This means that we can now focus on the next important aspect: Performance. Prettier has never been fast per se, but fast enough for most use cases. This has always felt unsatisfying so we wanted to do something about it. What better way than a friendly competition. On November 9th, we put up a $10k bounty for any project written in Rust that would pass 95% of Prettier test suite." I don't see how better performance…

> I don't see how better performance follows from the fact that something is written in Rust.

Idiomatic Rust will often by 5-10x faster than very similar looking JavaScript/TypeScript code without even trying to optimise it. It depends what you're doing, and this doesn't always apply. But parsers where you're doing a lot of string manipulation are one of the cases where it definitely does.

Post reply on HN