Live data from Hacker News

$20k bounty was claimed

prettier.io

311–320 of 345 posts

Re: $20k bounty was claimed

#311

Earlier quoted context omitted.

Agreed, but that's a different conversation because gofmt is a lot less opinionated than prettier. Prettier goes well beyond style issues, and messes with semantics - it will add or remove parentheses in math expressions, add or remove linebreaks within lines of code, etc. If prettier worked more like gofmt I'd probably love it and have no complaints!

> and messes with semantics - it will add or remove parentheses in math expressions Wait, so prettier rewrites code incorrectly? Aka, it’s buggy?

I've never seen it be buggy, but it will often remove unnecessary parens. For example: (a * b) + (x * y) becomes a * b + x * y.

This the same code, but I often use parens for semantic grouping or to be 110% sure the operator precedence is correct for a particular formula. It's not a dealbreaker, but it does remove some of the meaning I was trying to imbue on the code.

Re: $20k bounty was claimed

#312

Earlier quoted context omitted.

Agreed, but that's a different conversation because gofmt is a lot less opinionated than prettier. Prettier goes well beyond style issues, and messes with semantics - it will add or remove parentheses in math expressions, add or remove linebreaks within lines of code, etc. If prettier worked more like gofmt I'd probably love it and have no complaints!

> and messes with semantics - it will add or remove parentheses in math expressions Wait, so prettier rewrites code incorrectly? Aka, it’s buggy?

No, by semantic information I mean information that's meaningful to humans but not to the JS engine. E.g.:

    // before prettier
    var matrix = [
        1, 0, 0,
        0, 1, 0,
        0, 0, 1,
    ]
    var result = (num % divisor) | bitmask
    
    // after
    var matrix = [1, 0, 0, 0, 1, 0, 0, 0, 1]
    var result = num % divisor | bitmask
No difference in actual behavior, but the linebreaks and extra parens were there to indicate the developer's intent, not to affect behavior.

Prettier's outlook is that this is intentional, and the developer should add "// prettier-ignore" comments to every line of code that has semantic information they want preserved.

Re: $20k bounty was claimed

#314

While porting to Rust has been a trend, as Prettier runs on every save, the speed boosts will be significant. I'll be trying out Biome soon. Congrats to the Biome project!

I recommend using the lint-staged tool so Prettier only runs on every save on changed files. It makes a huge difference on large projects.

Re: $20k bounty was claimed

#315
post #309
post #171

Earlier quoted context omitted.

Keep in mind as a freelancer you have to make about for $2.50 for every $1 a salaried person makes, as you're on the hook for 100% of taxes, health care, business expenses, etc.

That sounds about right. On the other hand it does mean that you are producing this kind of work for big FAANG companies you should expect to earn $80/hour. This is around the low end of a senior software engineer or the higher end of a junior software engineer.

I have heard of a database "engineer" paid $250 an hour to spend weeks creating what is basically a connection string to a database in a corporate virtual lan. The people paying him were never concerned about the cost, just how long it was taking. This was in Nebraska.

Re: $20k bounty was claimed

#316

Earlier quoted context omitted.

Meh, most devs I've met can format code better than Prettier. Having a consistent set of rules sounds alluring at first, but the issue is that mechanical application is, well, mechanical and therefore dumb. My personal impression is that the code style bike shedding is a sign of team immaturity. In the more mature teams (composed of more mature persons), I haven't really seen formatting bike shedding.

Yeah right until you're working in a team of 30+ people without a code formatter like Prettier. Since when did caring about readability equated to bike-shedding and immaturity?

I work in like ~100-person team without code formatter and it's fine. The age average is ~35.

> Since when did caring about readability equated to bike-shedding and immaturity?

Since never, I didn't claim that. On the contrary, Prettier leads to less readable code than what a human can produce. Bike-shedding is endless bickering about some specific, meaningless thing.

Re: $20k bounty was claimed

#317

Earlier quoted context omitted.

Meh, most devs I've met can format code better than Prettier. Having a consistent set of rules sounds alluring at first, but the issue is that mechanical application is, well, mechanical and therefore dumb. My personal impression is that the code style bike shedding is a sign of team immaturity. In the more mature teams (composed of more mature persons), I haven't really seen formatting bike shedding.

Those devs _can_, but why should they? Code formatting takes a lot of time - it doesn't matter how skilled of a dev you are - you can only accurately and so fast. But the big win for code formatters is fewer decisions. Decision fatigue is real. What's wrong with the application of e.g. Prettier? Is it wrong enough that it's worth your time to manually format however many thousands of LOC, making countless micro decis…

> Code formatting takes a lot of time

It doesn't, really. On larger projects, you read much more code than you write.

Formatting well is not something complex - I basically just format with WebStorm, and only tweak that (mostly line breaks). People (including me) are going to read that code many times, I think it's worth the little effort.

On the opposite, I often have to work hard to make Prettier produce readable code. Like, "how do I need to write this code, so Prettier doesn't mess it up?", which is often difficult / frustrating.

Re: $20k bounty was claimed

#318

Earlier quoted context omitted.

> and messes with semantics - it will add or remove parentheses in math expressions Wait, so prettier rewrites code incorrectly? Aka, it’s buggy?

No, by semantic information I mean information that's meaningful to humans but not to the JS engine. E.g.: // before prettier var matrix = [ 1, 0, 0, 0, 1, 0, 0, 0, 1, ] var result = (num % divisor) | bitmask // after var matrix = [1, 0, 0, 0, 1, 0, 0, 0, 1] var result = num % divisor | bitmask No difference in actual behavior, but the linebreaks and extra parens were there to indicate the developer's intent, not to…

[deleted]

Re: $20k bounty was claimed

#319
post #70

Earlier quoted context omitted.

Sure you will. Whoops, my regex got too long and now the diff is - filter: /\.(jimmy|jimbo|jeremiad)$/ + filter: + /\.(jimmy|jimbo|jeremiad|james)$/ . And it's not clear where the change is. GP's article has an example of that in a linked tweet.

This is fine for a text diff, but I want my code review tool to show me something different. Separate problem, and the flaw here isn’t the diff, or the tool that produced the diff, rather the tool displaying it to me. Let me do whatever I want to my code and show me BOTH the visual (unimportant) and semantic differences.

Good point. Are there any code-semantics-aware diff tool out there though?

Re: $20k bounty was claimed

#320

While porting to Rust has been a trend, as Prettier runs on every save, the speed boosts will be significant. I'll be trying out Biome soon. Congrats to the Biome project!

I recommend using the lint-staged tool so Prettier only runs on every save on changed files . It makes a huge difference on large projects.

Biome is also working on a feature that only formats changed files. See the associated PR [0] for more details.

[0] https://github.com/biomejs/biome/pull/753

Post reply on HN