Read my book

I wrote books about Webpack and React. Check them out!

Friday, March 27, 2015

Why to pick ESLint over JSLint, JSHint and co.?

Given it's so easy to screw up things with JavaScript, a little discipline goes a long way. Linting is one of those techniques that will simplify your life a lot with a minimal cost. It is possible to integrate the linting process into your editor/IDE. This will allow you to fix potential problems before they become actual issues. It won't replace testing but it will simplify your life and make it more boring. Boring is good.

Why ESLint then? It allows you to develop custom rules. Better yet there is a nice set of rules available for React! This is a good reason alone to give ESLint a serious look if you develop using React.

I've got a basic setup at react-component-boilerplate. It is a little boilerplate I designed to make it easier to develop React components for public consumption. I have tried to integrate what I consider best practices to it. The boilerplate relies heavily on Webpack and provides goodies such as hot reloading and a starting point for Jest tests. These things alone made it worth it for me to develop it.

Even though a young project, ESLint shows a lot of promise already. As people have written a lot about the topic already, I won't do the same. Consider the following starting points if you are interested:


I cannot think of a good reason why not to lint your code. It's just one of those things you should set up as that will help to avoid a massive amount of headache over longer term.