Live data from Hacker News

Why is Prettier rock solid?

mrmr.io

21–30 of 163 posts

Re: Why is Prettier rock solid?

#22

Prettier isn’t terrible but compared to ocamlformat it is soooo… slow. Each time I save it takes a second or two for it to format. Ocamlformat is instant in the meanwhile.

Take a look at Biome formatter and linter. Blink of an eye fast on very large projects that prettier feels like forever on. Just don't enable the experimental or potentially breaking format options on a large existing code base. They aren't enabled by default. Deno's in the box trolling is pretty nice as well. YMMV of course.

No HTML support… bummer. I’ve been looking to switch from Prettier but I haven’t yet found a viable alternative.

Re: Why is Prettier rock solid?

#23
The debate for me is now eslint —-fix or prettier. I don’t get why people need more “control”. If it breaks code, then sure, I understand the reservation but in 99% of cases, it just, “I don’t like how it breaks up my code”. Why care? At least, if you’re all using it, the diffs will be predictable and PRs can focus on what matters. //rant

Re: Why is Prettier rock solid?

#24
post #16
post #2

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

I suspect the author meant that gofmt doesn’t break lines, which dramatically simplifies the complexity. See https://journal.stuffwithstuff.com/2015/09/08/the-hardest-pr... for a fun, related read.

Yeah, line splitting is the hard part.

I wrote that article and I'm actually in the middle of rewriting dartfmt right now to have an entirely new internal representation.

Re: Why is Prettier rock solid?

#26

The debate for me is now eslint —-fix or prettier. I don’t get why people need more “control”. If it breaks code, then sure, I understand the reservation but in 99% of cases, it just, “I don’t like how it breaks up my code”. Why care? At least, if you’re all using it, the diffs will be predictable and PRs can focus on what matters. //rant

The answer is "both". Use ESLint for actual fixes and Prettier for formatting.

Re: Why is Prettier rock solid?

#28
Off topic but every once and a while I'm made aware of the impact prettier has had on my typing. It's so hard to write code without a tool like prettier because formatting related keystrokes have largely been removed from my muscle memory. You basically end up writing a sort of shorthand.

Re: Why is Prettier rock solid?

#29
post #19

Earlier quoted context omitted.

What’s an example of Prettier breaking code?

For example, the latest Prettier makes XHTML files invalid by changing DOCTYPE to lowercase: https://github.com/prettier/prettier/issues/15476 Prettier moves ts-ignore comments which can cause TypeScript errors: https://github.com/prettier/prettier/issues/15876 Interpreting nested CSS functions' "-" as minus and inserting a space: https://github.com/prettier/prettier/issues/15369

1.1k open issues. OOF
Post reply on HN