I have never seen a formatter talked about this much, it is just a formatter and code is not poem, Jesus.
Why is Prettier rock solid?
121–130 of 163 posts
Re: Why is Prettier rock solid?
#122The debate for me is now eslint —-fix or prettier. I don’t get why people need more “control”. If it breaks code, then sure, I understand the reservation but in 99% of cases, it just, “I don’t like how it breaks up my code”. Why care? At least, if you’re all using it, the diffs will be predictable and PRs can focus on what matters. //rant
ESLint deprecated its formatting rules and recommends Prettier and dprint - https://eslint.org/blog/2023/10/deprecating-formatting-rules...
Re: Why is Prettier rock solid?
#123Re: Why is Prettier rock solid?
#124> note that gofmt doesn't indent, which is the hard part interesting because for me it's hard to read changelogs of js/ts based repos that are using prettier compared to go repos, I wonder if the indentation is a reason for that. I'm honestly not sure what the author means by that either, gofmt seems to fix indentation for me.
If you're reading a PR diff on GitHub you can get it to ignore whitespace diffs by adding ?w=1 to the url - complete lifesaver in this kind of situation.
Re: Why is Prettier rock solid?
#125Earlier 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.
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 (pretti…
Take a look at the “eslint.rules.customizations” key in this file:
https://github.com/antfu/eslint-config/blob/main/.vscode/set...
Re: Why is Prettier rock solid?
#126Meh, people seem to have an inflated view of Prettier. I find that it's at best ok, but has produced enough frustrating errors that I just turn it off.
Prettier real usefulness is in team projects. At $PREVIOUS_WORKPLACE, it totally removed the burden of formatting issues in PRs. It’s far from perfect but at least everyone in the team was producing the same style and we could focus on logic errors rather than formatting (which is the first thing you spot and can’t ignore when doing a code review).
That said, I do believe in the value of consistent formatting tools, I just think Prettier is a somewhat lazy choice that attempts to skirt responsibility for deciding on things or cultivating agreement. It's a disfunctional team who's members care too much about their opinions on such trite topics, and/or who aren't capable of coming to agreement on a common set of them.
For PRs, I've always just asked someone to run their formatter if it's clear they forgot, and usually there's a common config used by some formatting tool, it's not worth much beyond a a one-liner to make these decisions, and you should be able to do this periodically as things change.
Re: Why is Prettier rock solid?
#127Earlier 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".
Copying, moving, reordering, newlines, pretty much anything will keep correct pairing of brackets.
Re: Why is Prettier rock solid?
#128Earlier quoted context omitted.
Conversely, my strategy is "press shift+tab to close the block and not have to screw around with matching {} everywhere".
Perhaps is because jetbrains make better structural editing than vscode, but I practically never have to type closing brackets. Copying, moving, reordering, newlines, pretty much anything will keep correct pairing of brackets.
Regardless, to me, this is such a minor issue that I don't consider it at all when choosing a language.
Re: Why is Prettier rock solid?
#129Earlier 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.
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 (pretti…
Re: Why is Prettier rock solid?
#130Earlier 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.
This person is not just a good engineer but a solid politician.