Live data from Hacker News

Why is Prettier rock solid?

mrmr.io

111–120 of 163 posts

Re: Why is Prettier rock solid?

#111

Earlier quoted context omitted.

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.

The Biome team is currently working on CSS support. HTML is the next item on the list.

Re: Why is Prettier rock solid?

#112

Interestingly, prettier just made a breaking change in a patch release and refused to undo it for a week or so, until a particularly silly pedantic argument won them over. https://github.com/prettier/prettier/issues/15942 My only bad experience with prettier, besides the incredible slowness (orders of magnitude slower than ruff)

> My only bad experience with prettier, besides the incredible slowness (orders of magnitude slower than ruff)

Ruff is based on the same foundations that Biome (https://biomejs.dev/). Although Biome doesn't support all languages that Prettier supports, you should give a try, it is fast.

Re: Why is Prettier rock solid?

#113

Interestingly, prettier just made a breaking change in a patch release and refused to undo it for a week or so, until a particularly silly pedantic argument won them over. https://github.com/prettier/prettier/issues/15942 My only bad experience with prettier, besides the incredible slowness (orders of magnitude slower than ruff)

How can a person that introduces breaking changes in patch release and then just says everyone to piss off when facing critics (just because mister "has needs for this": https://github.com/prettier/prettier/issues/15553#issuecomme... ) be a maintainer of such a widespread tool ?

What's wrong with having a need for a feature and wanting it implemented?

Re: Why is Prettier rock solid?

#114
post #84

Earlier quoted context omitted.

"It's not my commit that it is wrong, it's the rest of the world that needs to fix their code." This is such an insane position to take for a maintainer. Don't be idealistic and silly. If you break compatibility, it is on you. No one cares that you are right. The Linus Torvalds "we do not break the user-space, ever" mantra should be a best practice for every open source programmer, and user-space in this case is "wha…

Bad initial designs then will forever doom any project, if only the project has a few users. And there are lots of bad designs in the open source world and in the programming projects world in general. Especially so in the NPM and Python ecosystems. In many widespread tools.

At least have the courtesy to bump the major version number. If you're going to break compatibility, then own it. If what you're doing is really for the best then don't try to do it quietly in shame, announce it with fanfare.

Re: Why is Prettier rock solid?

#115
post #70

Hmm I just had a (perhaps esoteric) issue in an Astro file. Specifying above a would cause the block at the bottom to become duplicated on save. Weird as, and I couldn’t be bothered troubleshooting, I just added the file to .prettierignore. But still.

Prettier does not support Astro files natively, so it's the Astro plugin's fault in this case.

(I maintain said plugin, so, well, it's my fault)

Re: Why is Prettier rock solid?

#116

Earlier quoted context omitted.

Conversely, my strategy is "press shift+tab to close the block and not have to screw around with matching {} everywhere".

But that leaves you having to manually adjust entire blocks, when indentation levels change. With {}, prettier can readjust everything properly for you, even after mutilating changes such as copying an entire block from a different file into a new one, and at a different indentation level.

Python formatters do that too, they don't care about the indentation, as long as it's consistent. All I need to do is indent the block far enough to the right that it's not more left than the previous one, and that's it.

This also happens rarely enough that it's never been an issue for me.

Re: Why is Prettier rock solid?

#117

I've worked with a number of developers whose output without these tools is a giant, unreadable mess. Training juniors to be reliant on this stuff does more harm (to them) than good.

If I'm reading this correctly, you think juniors should live without formatters because they need to learn to format manually?

I entirely disagree. Juniors have to learn so many more important things - how to logically structure code, testing, working on teams, git...

Why take time away from learning those (and similar) concepts to teach them something a tool does well and, if necessary, they can learn later?

I like it to deciding to teach teens how to drive with a manual transmission instead of an automatic one- they need to be able to drive and not hit things, and the more we can simplify that, the happier we all are. If needed, some kids can go back and learn how to use a stick shift.

Re: Why is Prettier rock solid?

#118

Earlier quoted context omitted.

What’s an example of Prettier breaking code?

Another example: https://github.com/prettier/prettier/issues/187 That issue has been open for 7 years.

The removal of the parentheses does not change the behavior of the program. I guess that would not be considered "breaking" the code.

Re: Why is Prettier rock solid?

#119

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.

This + Copilot. I code in an entirely different way now, I would of thought it impossible to change my ways (about 20 years of coding)

have*

Re: Why is Prettier rock solid?

#120

Earlier quoted context omitted.

Conversely, my strategy is "press shift+tab to close the block and not have to screw around with matching {} everywhere".

But that leaves you having to manually adjust entire blocks, when indentation levels change. With {}, prettier can readjust everything properly for you, even after mutilating changes such as copying an entire block from a different file into a new one, and at a different indentation level.

I find selecting a block of code and hitting tab/shift+tab much simpler and faster than hunting down matching parenthesis, especially when adjusting longer sections or complex situations.

Of course this is mostly a tooling issue, since there is a shortcut for adjusting indentation but not for adjusting parenthesis. Or maybe there is and I just haven't discovered it yet.

Post reply on HN