A vacuum cleaner leaving a visible result on a carpet

TL;DR; Use a linter for your code! And fix all errors and warnings. Your brain will thank you.

In software, a linter is a static code checker. It looks at syntax, code format and white space, spelling, coding conventions, patterns that might cause bugs and other things that is not related to business logic. A lot of them have configurable rules, ways to make exceptions (that can be used for gradual introduction in legacy projects) and ways to auto-correct your code.

I see a linter as a cognitive tool, something we use to relieve our brains so that there is more energy left for things like problem solving. Here are three ways linting does that:

1. Linting rules are a social contract

Social negotiation takes energy. When a team has decided on the linting rules the discussion is done, or at least not constantly debatable. And it is enforced without any specific person having to take the fight. Have a pipeline for the code where linting is checked before code ends up in a flow shared by other developers.

2. Linting removes noise

Code that is regular is easier to read. Having a common standard is much more important than what standard you use. But the removing of noise only works fully if you do not let the linter add noise. Therefore it is important not to let any errors, or warnings stay. If you have something in your code that you want to keep, though the linter is protesting, make an explicit exception to silence the error or warning. As an extra, some linters can also recommend a simpler syntax for achieving the same behaviour. That can make your code less verbose without obfuscating it and then also remove noise.

3. Linting is automatic

A lot of what the linter does is things you would like to do, but now you do not have to. As with spell checking, you can find and fix all the deviations from how you want your code to look, while reading it and having it reviewed. But as with spell checking, that is neither the fun part of writing nor the most energising thing to give and get feedback about. Let the computer do the boring stuff.


Linting might find bugs. Especially in languages without a compile step, the checking for risky syntax is very valuable.

So, go and lint your code! And add the linting as an automatic step when writing code. That way you let the machine do a little more of the boring job, and leave more energy to do fun things, like problem solving.

Related texts

A single frosted leaf with clear contours and veins.

TDD in the context of writing code to be read

Wunder Baum hanging from a car window (Known as Little Trees in most English-speaking countries)

Wunderbaum testing