Live data from Hacker News

Why is Prettier rock solid?

mrmr.io

101–110 of 163 posts

Re: Why is Prettier rock solid?

#101

Earlier quoted context omitted.

> until a particularly silly pedantic argument won them over. Which comment are you referring to? The release notes sound practical

https://github.com/prettier/prettier/issues/15942#issuecomme... I sort of misspoke, the comment itself is not silly, just the fact that it was that point that got a resolution.

Actually that comment derives onto this other issue, where the merits of the decision are discussed:

https://github.com/prettier/prettier/issues/15956

and to be honest, it didn't look like silly to me :) It was an interesting read for me, who as a maintainer, I tend to give more importance to the official statements such as in this case written recommendations of the source company that defined the new format.

Re: Why is Prettier rock solid?

#102
post #38

Earlier quoted context omitted.

I can't agree more, and I can't disagree more. There's a great deal to be learned by experimenting yourself. My workflow is: * Learn the concept * Implement it * Research prior art * Throw away my first implementation and rewrite it properly (Edit: formatting)

This is the way. Unfortunately this is not going to work, not in a startup environment. You probably do everything except the throwing away and re-implementing part..

Nor in any environment where a client is paying you to develop something. Try showing them an MVP and then telling them "ok, now I know how to do this I will throw it away and redo it from the beginning". Not to mention that, with unclear and constantly changing requirements, you are unlikely to ever arrive at a point where you can say that...

Re: Why is Prettier rock solid?

#103

Earlier quoted context omitted.

Yeah it’s true. Its not simply that you don’t have to manually format things a certain way. You simply don’t format things at all. You can avoid writing lots of spaces, newlines, semi colons, etc. it’s absolute garbage, then you save it, then it’s fine.

And autoformatters have cemented my preference for non-white spaced languages. As you say, just write whatever and let it format it. When I then switch to our python backend this strategy no longer works. Like, it can fix something, but it needs a much cleaner state to do so. For instance if my loops are indented wrong, black can't solve that as the decision it makes has a semantic meaning.

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

Re: Why is Prettier rock solid?

#105

Earlier quoted context omitted.

And autoformatters have cemented my preference for non-white spaced languages. As you say, just write whatever and let it format it. When I then switch to our python backend this strategy no longer works. Like, it can fix something, but it needs a much cleaner state to do so. For instance if my loops are indented wrong, black can't solve that as the decision it makes has a semantic meaning.

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.

Re: Why is Prettier rock solid?

#106
post #97

Prettier was inspired by gofmt. But I really wish gofmt gets inspired by prettier and automatically breaks long (80+ columns) lines into smaller lines (For example, move parameters of a long function each into their row).

It is not in the stdlib, but you can use golines for that.

https://pkg.go.dev/github.com/wrype/golines

Re: Why is Prettier rock solid?

#107

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 ?

Because it's an unpaid job and the only required qualification is willing to do it.

Re: Why is Prettier rock solid?

#108
post #38

Earlier quoted context omitted.

I think prettier's initial author answered the question quite concisely in the article's first link. Title and excerpt copied below: > Dig into past research. > If you're excited about an idea, it's super tempting to sit down an immediately get going. But you shouldn't do that until you've done some cursory research about how people have solved it before. Spending a few days researching the topic always completely ch…

I can't agree more, and I can't disagree more. There's a great deal to be learned by experimenting yourself. My workflow is: * Learn the concept * Implement it * Research prior art * Throw away my first implementation and rewrite it properly (Edit: formatting)

Yes - I quite often get into research paralysis where I keep looking and trying to work out the solutions to different problems I'm going to encounter and never getting started. Whereas if I start protoyping I learn a lot very quickly.

Re: Why is Prettier rock solid?

#109
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.

The issue here is that the change was done in a patch release. You can correct your past mistakes, but you should signal incompatibilities to your users by incrementing the major version.

Re: Why is Prettier rock solid?

#110
post #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 p…

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.

Post reply on HN