Live data from Hacker News

Why is Prettier rock solid?

mrmr.io

1–10 of 163 posts

Re: Why is Prettier rock solid?

#3
Ehh I would disagree here. Yes, prettier uses the classic pretty printing paper, but almost every pretty printer does in some form. And even then it’s subjective how you compile the actual syntax down to the printer elements. Prettier uses a very thick layer of complicated translation rules to get the printing just right. Especially with JSX and TypeScript. It’s honestly just good old testing and labor that makes it good. And even then I anticipate more than a few comments decrying prettier’s formatting. You can’t please everybody. That’s why it’s prettier not prettiest

Re: Why is Prettier rock solid?

#4

Ehh I would disagree here. Yes, prettier uses the classic pretty printing paper, but almost every pretty printer does in some form. And even then it’s subjective how you compile the actual syntax down to the printer elements. Prettier uses a very thick layer of complicated translation rules to get the printing just right. Especially with JSX and TypeScript. It’s honestly just good old testing and labor that makes it…

>”That’s why it’s prettier and not prettiest”

Missed opportunity I think to have a prettier with the prettiest defaults. Sadly the name is taken [0]

[0] https://www.npmjs.com/package/prettiest

Re: Why is Prettier rock solid?

#6
I'm not sure I got an answer to the question in the title. Prettier is rock solid because it was based on a paper by someone who designed Haskell? That's a cool link, but I'm not sure what the insight is, is this evidence that functional programming-style algorithms lead to a more stable codebase?

Re: Why is Prettier rock solid?

#7
post #2

> note that gofmt doesn't indent, which is the hard part Huh? I'm pretty sure it indents with tabs.

I’m not sure what that would even mean. It definitely intends but maybe there are some edge cases where it has no opinion - like a long function signature with too many parameters it leaves alone unless you manually start new lining things

Re: Why is Prettier rock solid?

#9
This isn’t actually true. Prettier does break code in strange circumstances and it can be very difficult to fix. The maintainers have a ton of stress on them and it’s hard to improve it sometimes.

It’s very well tested and easy to add cases too - just add an input and an output so that may be why it seems so solid, just whenever there is an issue people fix it.

I think the main thing is that Meta maintains it which probably is why it’s so solid.

Post reply on HN