ESLint | Linter for JS file

ESLint is the Javascript linter. It is similar to JSLint.

How to add ESLint in the project?

First you have to add the node module in the project. For adding node module you have to check this link to create node module.

After installing the node module in the project we need to install the eslint in it.

For that run below command

npm install --save-dev eslint

This will install the eslint package in the node module.

Now to check the eslint package is present or not use the below command:

ls node_modules/eslint

The eslint command operates through the .bin folder which is created. To check the .bin folder for eslint use:

ls -la node_modules/.bin

Now if you test the ESLint in the code by using the below code.

./node_modules/.bin/eslint components/

It will provide error to add the configuration file.

To set the configuration file you have to add the code.

/node_modules/.bin/eslint --init

Then it will ask bunch of question for configuration.

Once you will add the question the configuration file will be added and the ESLint is ready to use.

To use you can use the command:

./node_modules/.bin/eslint components/

Till now I have research this much about ESLint.

Reference site from where I learn the ESLint:

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 )

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