Review: eslint
If you’re not using a linter yet – it’s a little tool that highlights both programming errors and violations of best practices (if you want, it can do so as you write code). Some of the practices it flags are actually deep ideological divisions within the programming community around matters of stylistic preferences, and of course all linters are very configurable as a result.
eslint
is a linter for JavaScript (also known as ECMAScript, hence “es”). After using jshint
for a long time, I recently switched to babel-eslint
to get support for some of the ES7 features not yet understood by jshint
. I was impressed by how well thought-out the eslint
ecosystem is.
When you install the package, a little command line wizard helps you configure your rules, whether you’re writing JavaScript on the server or on the client. The linter not only points out violations of the configured rules, it also links to the extensive documentation for each rule on the eslint.org website.
As you read about the different rules, you can make a judgment call which ones are important to you. Or you can just follow someone else’s style guide, like Airbnb’s eslint config. While overly fussy linting rules may be frustrating at first, a good linter adjusted to your preferences will soon become your best friend.
In short, eslint
is a well-maintained package with a vibrant community of users. I highly recommend it.