Hacker News new | ask | show | jobs
by brynjolf 1080 days ago
Prettier which is a Ecmasceipt formatter. It basically doesn't have settings as a feature. You can change some things like eol and if you want to use tabs or spaces. Everything else is more or less as it comes, and they want it to be that way to stop discussions in the teams using it and to not allow feature creep.

I call Pettier a compromise tool, noone is happy noone is too mad when you force it on checkin etc

3 comments

Prettier also came to mind, and I'm usually pretty happy with the "it's formatted this way, deal with it" approach - but I also would like the tool to behave predictably with updates. Prettier had some changes in 2.5 related to multi-line-classes (namely, forbidding them), which in turn made it unusable for projects with tailwind usage, as it now forces extremely long lines in some cases. (Especially for elements that have styling based on multiple breakpoints and a darkmode variant, you're hitting >120 chars easily).

I know that you can go for descriptive classnames and "@apply", but I was still miffed about a change like this in an already existing tool, with a lot of community pushback and no compromise in sight.

(Here's a relevant discussion, but keep in mind that multi-line-classes worked at some point and now just don't: https://github.com/tailwindlabs/tailwindcss/discussions/7763)

So for prettier, it wasn't just "format your code our way or else" - which is a good approach for a formatter, see also gofmt - it was "your current set up doesn't work anymore, tough luck".

> noone is happy

I’m 100% happy with Prettier. The trick is to not care too much about how the code looks. Consistent style trumps any choice for me.

This hasn't been my experience. I've been able to throw together a .prettierrc.js file that gets me everything I want to tweak from the default (line length, quote types, etc.).

Out of curiosity, what did you find to be something unchangeable?

I had opinions on how it placed curly brackets for example, I wanted it more similar to C# with the bracket on a new line.

No big deal but a bit annoying to have two ways of doing it.