Live data from Hacker News

Why is Prettier rock solid?

mrmr.io

71–80 of 163 posts

Re: Why is Prettier rock solid?

#71

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.

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.

Re: Why is Prettier rock solid?

#72

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.

The more silly[1] comments are from the maintainer, saying you should update configs with workarounds for patch releases.

1: Suggested package: sillier.

Re: Why is Prettier rock solid?

#73

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.

A team I'm doing some work with uses eslint and has not configured prettier, so instead of simply having everything get formatted correctly, I get red squiggly lines under blocks of code because of an omitted meaningless whitespace character.

There are a few linting rules that can help identify semantic errors or dead code, but only a small number of rules are needed to get all of the benefits.

Autoformatting (prettier, gofmt, etc.) is the way to go.

Re: Why is Prettier rock solid?

#77

I picked up standard[1] a while back for this reason, I don't want to have to think about it. It works fine, I have no complaints (took me a while to get used to not using semi-colons but now I prefer it) Same reason I use `cargo fmt` as well. [1] https://standardjs.com/

In JavaScript (and in TypeScript), not using the semi-colon is often a footgun.

Here's a surprise:

  const a = 1
  const b = 2
  (a+b).toString()
Calling the convention "standard" was irresponsible, and it led many people (especially beginners) to assume that it was some sort of a preferred convention. Glad I'm seeing it less these days; thanks to TypeScript, and people following Microsoft's conventions.

Re: Why is Prettier rock solid?

#78

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)

Re: Why is Prettier rock solid?

#79
My complaint--and MDN and the W3C's complaint--with it is that it puts a closing slash on HTML void elements. While this is allowed for backwards compatibility with XHTML, it is not specified as being useful or needed in any HTML specification and has led to countless confusion among noobs who don't read the specification and only follow online articles.

https://html.spec.whatwg.org/dev/syntax.html#start-tags

Re: Why is Prettier rock solid?

#80

My complaint--and MDN and the W3C's complaint--with it is that it puts a closing slash on HTML void elements. While this is allowed for backwards compatibility with XHTML, it is not specified as being useful or needed in any HTML specification and has led to countless confusion among noobs who don't read the specification and only follow online articles. https://html.spec.whatwg.org/dev/syntax.html#start-tags

The closing slash is mandatory for jsx/tsx - and thus, most React devs - though.
Post reply on HN