Hacker News new | ask | show | jobs
by harimau777 249 days ago
I strongly dislike and disagree with Prettier.

From a practical standpoint, I disagree with the idea that coding style is just "bikeshedding". Coding style has a DRAMATIC impact on how readable code is and therefore how easy it is to understand. In my experience, fighting to keep code understandable is one of the most difficult and important parts of software engineering. In particular, by not allowing the user to change indentation style Prettier makes JavaScript much more difficult to read.

From a social standpoint, I think that by labeling things "bikeshedding", Prettier represents a toxic approach to team dynamics. Just because something isn't important to you doesn't mean that it's not essential to someone else.

IMHO, Prettier was a massive setback for the JavaScript community.

4 comments

> I strongly dislike and disagree with Prettier.

Have you ever worked in a large team where everybody has their own idea on how code should be formatted? If not, then I can understand your position.

Do you get to review PRs where formatting changes make majority of the changes? Because some people don't use code formatters, others do but use different rules from each other. You may call this freedom, others may call it hell.

I'm not opposed to establishing a coding style and using a linter to enforce it.

I'm opposed to doing that without getting buy in from the team. IMHO it's important to figure out whats important to the different developers on your team and finding a set of rules that works for them; as opposed to just adopting something that makes some people happy and tanks other people's productivity.

I agree that suddenly adding a formatter to existing code could be disruptive. But how does "buy in from the team" work over time? If you hire someone new and they don't like the format rules, do you stop using the formatter?
I think it depends on the situation. If it's just not their preference then there's probably no need for a change. However, if it's going to prevent the new person from doing their job then a change is probably justified.
People being prevented from doing their job because of code formatting? In my nearly 20 years of development, that statement was indeed true, but only before the age of formatters. Back then, endless hours were spent on recurring discussions and nitpicky stylistic reviews. The supposed gains were minimal, maybe saving a few seconds parsing a line faster. And if something is really hard to read, adding a prettier-ignore comment above the lines works wonders. The number of times I’ve actually needed it since? Just a handful.

Code style is a Pareto-optimal problem space: what one person finds readable may look like complete chaos to someone else. There’s no objective truth, and that’s why I believe that in a project involving multiple people, spending time on this is largely a waste of time.

> I'm not opposed to establishing a coding style and using a linter to enforce it.

Linters can enforce code formatting? Indentation and such.

> I'm opposed to doing that without getting buy in from the team.

That is generally a good principle for adopting any tool and not specific to Prettier or any other code formatter.

I have to admit I am somewhat confused about your objections to Prettier in particular.

> Just because something isn't important to you doesn't mean that it's not essential to someone else.

The problem with this as an argument is that its opposite is equally valid.

Team dynamics are definitionally not about the concerns of the individual. The team is not helped by one person's insistence on handcrafted whitespace.

The challenge is that it’s easy to find fundamental disagreements on a team on how a codebase should be styled, especially when the language itself doesn’t provide much guidance on styling convention. When that happens, it’s easy for a debate around styling to go on without ever finding consensus.

I’m way more open to adopting coding style that’s not my personal taste as long as it’s consistent and tools like prettier really help with that.

I can see how that would be a challenge. I think the key may be to focus on identifying which things are just a given developer's preference and which are essential to their productivity. Like you said, I'm more than happy to adopt a style that isn't my personal taste. The problem comes when the style prevents me from doing my job.
> In particular, by not allowing the user to change indentation style Prettier makes JavaScript much more difficult to read.

Prettier allows configuring the indentation style (tabs/spaces) and indentation size, see https://prettier.io/docs/configuration#editorconfig.