The following is a guest post by David Clark. David is the creator of a thing called Stylelint, a tool for keeping your CSS in shape. He does a great intro as to why you might need it himself, so take it away David…
You write CSS. Probably a lot of CSS. And you make mistakes. Probably a lot of mistakes. Somebody needs to stop you from making mistakes in your CSS.
Sometimes your mistake is a real bug. Sometimes it’s just sloppy, inconsistent, or unclear coding style. Some of them may seem trivial at first (depending on your temperament), but they become patently important as the codebase grows and ages, as more people stick their hands in it and do ugly things. Things you thought unimaginable.
You try to control yourself. Your colleagues pitch in, too, correcting you when you stray. But both you and your colleagues are mistake-makers, so will naturally, inevitably fail, at least in part. And later on you or some other sorry sap will face the consequences of those mistakes that slipped into your CSS.
Neither you nor your colleagues like talking about the mistakes you’ve made. It’s awkward. Sometimes it’s discouraging and divisive. Certain conventions that definitely help the codebase, like consistent formatting, may seem pedantic and tedious when enforced manually. Or else they bring out the pushy and pigheaded elements in people you usually like.
Additionally, you’d much rather be corrected right away than wait for a code review just so someone can point out that you duplicated a declaration and should clean up your spacing. Instant feedback would help you internalize conventions and spend a little less time floundering when your CSS doesn’t work.
What you really need is a mistake-preventing machine
You need a dependable mistake-preventing machine that understands CSS and understands you: your intentions, preferences, ideals, and weaknesses.
Such a machine would have its limitations. All things do. But its limitations would differ from those of you and your human colleagues. Whatever mistakes it can prevent it will prevent consistently, tirelessly. Meanwhile, you and your colleagues can work on improving the machine, expanding its powers and diminishing its limitations. If it is open-sourced, other contributors from around the world can join the effort