Project Best Practices: Setting Up ESLint

This is part of a series about NodeJs best practices for your projects. Every project you build will become more maintainable with these practices. They are not everything (we will get there), but they are more than a good start.

This tutorial goes over setting up ESLint. You can check out the official docs right here: The docs are pretty straightforward 😀

Let’s start by creating a new project

mkdir eslit-test
cd eslint-test
npm init -y

No we will add eslint

npm install eslint --save-dev

And initialize it by

./node_modules/.bin/eslint --init

This will ask you if you want to use a preset ESLint or answer questions about your Javascript uses. I prefer the Standard or AirBnB preset.

That’s it! Now you can run lint using the command below or by connecting a plugin to your text editor. I use Atom + the Eslint plugin

eslint yourfile.js


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s