The Delight and Damage of Prettier

Computer Parts

At work, we recently added Prettier to our TypeScript dashboard. Prettier is a code formatter that’s gained popularity for its smart and deterministic output.

Why did we make this change? When you work on a big codebase with multiple contributors it can be difficult to keep everyone to a specific style of coding. Prettier takes this weight off your team’s shoulders and ensures you never have to review code for formatting again.

This is great for us, because we were spending a fair chunk of time giving nit pick comments in pull request reviews. Now that we don’t have to do this we can train our eyes to look at more important parts of the implementation, like logic, variable names, and potential bugs.

However, there is a downside that I thought over before implementing Prettier. Having the computer do the work for you means that you no longer need to care about what your code looks like.

Good formatting becomes natural as you gain more experience programming. And the readability of your code is important for your future self and for others. But what if you never have to learn? Then someday you have to write code without tools like Prettier, and it becomes a complete mess.

Reflecting on this argument I feel quite old. I bet people complained about computers and phones weakening peoples ability to hand write or do mental maths. The positives, having a codebase everyone can read and write to with less mental overhead, outweigh the negatives.

So I say if you’re inexperienced in a language or working on a personal project, maybe skip using a code formatter (still use a linter if you can). But if you’re in a team or working on something open-source, this could be a great productivity boost.