News for hackers. Stuff that matters.
Re:Prettier $20k Bounty was Claimed by xdennis on Monday November 27, 2023 @12:18PM (#38435059)
> I find Prettier to be way too heavy handed

But that's the purpose of such tools: to stop endless debates about style.

Re:Prettier $20k Bounty was Claimed by harimau777 on Monday November 27, 2023 @12:47PM (#38435462)
The problem is that style matters and therefore those debates matter. Just because something isn't important to the developers that made Prettier doesn't mean that it's not important to the productivity of other developers.
Re:Prettier $20k Bounty was Claimed by shepherdjerred on Monday November 27, 2023 @02:00PM (#38436631)
The reality is that as long as your style is consistent, very few people actually care what that style is.

I can imagine smaller teams/single individuals being very picky about how their code looks and there is nothing wrong with that. Once you have larger teams that becomes a waste of time since you'll likely have much larger problems to solve.

Re:Prettier $20k Bounty was Claimed by deathanatos on Monday November 27, 2023 @03:55PM (#38438140)
> as long as your style is consistent, very few people actually care what that style is.

This is an oft-repeated myth. There are some style rules for which that is true, but for some, there are objective, logical reasons to prefer one style over the other.

For example, mandating the optional comma after the last time in a list whose items has been split over multiple times results in more readable and logical patches: if you mandate the comma, a patch that only adds items will only have added lines, whereas if you don't, a patch adding items can have a mix of add/remove lines.

Pushing operators to the subsequent line makes it fundamentally easier to read as they all align, vs. a ragged right edge, and this is doubly important if the operators aren't the same, as it makes that far more visible. (Though this is harder in some languages with odd behavior around this, such as JavaScript.) (This also affects patch readability in many languages, and in fact, I'd say patch readability is the driver of many objective reasons behind styling choices.)

And so forth. I'd wager as many rules have logical reasons backing them as those that actually do boil down to literally just stylistic decisions.

Re:Prettier $20k Bounty was Claimed by digging on Monday November 27, 2023 @01:37PM (#38436243)
> The problem is that style matters and therefore those debates matter.

Does it? IME/O, styling only matters up until the point that it is consistent and reasonable. And I'm saying this as someone who used to want to debate and micromanage a lot of formatting standards in my projects. Ego is removed from the equation (unless you're the one trying to introduce Prettier to a reluctant team), and without ego, the debates no longer seem very important.

Re:Prettier $20k Bounty was Claimed by adam_arthur on Monday November 27, 2023 @09:49PM (#38441689)
Is 6pt font easier to read than 12pt font? Are all style choices equivalent from first principles?

No, not really. Many of the decisions prettier makes are quite objectively bad for readability from first principles (e.g. breaking up lines where the RHS isn't relevant to most readers, left shifting RHS of assignments when the implementation details are less important than the abstraction over them).

I am totally in favor of a universal formatter, but at least justify the design decisions being made. Prettier formatting choices are often very lackluster and hard to defend objectively.

It will be replaced by something better eventually

Re:Prettier $20k Bounty was Claimed by pcthrowaway on Monday November 27, 2023 @12:26PM (#38435144)
I mean.. sure https://xkcd.com/927/
Re:Prettier $20k Bounty was Claimed by mm263 on Monday November 27, 2023 @12:33PM (#38435266)
It isn't really applicable here since Prettier was de-facto standard at pretty much every place I've worked at - start-ups to FAANG
Re:Prettier $20k Bounty was Claimed by constantly on Monday November 27, 2023 @12:30PM (#38435222)
It's not a new standard so this comic really doesn't apply here. It's just being opinionated, for once, about what to use. I welcome it strongly, as I do tools like Black for Python, which do similar things. Just set that up in CI for anything and all my code looks the same, removing some overhead of readability.
Re:Prettier $20k Bounty was Claimed by fenomas on Monday November 27, 2023 @11:59PM (#38442496)
Sure, but the issue with prettier is that it goes beyond style and also mangles semantic details. That's their explicit design choice - they feel that conforming formatting in all cases is more important than preserving semantic information about code, and that devs should add "// prettier-ignore" comments to every line of code with semantic details that prettier would throw away.