Eslint best linting tool for javascript code

Posted By : Parveen Kumar Yadav | 26-Sep-2017

As we know that Linting is an important part of daily workflow. Eslint is a great linting tool for your ECMAScript/JavaScript code . You can use the rules defined on it or even though you can create your own custom rules, as i have used this tool in one of my project. Install locally via npm:-

npm install eslint --save-dev
 

after that setup a configuration file:-

./node_modules/.bin/eslint --init
 

after that you can run it easily via:-

$ ./node_modules/.bin/eslint yourfile.js

 

you can install it globally via:-

$ npm install -g eslint
 

setup a configuration file:-

$ eslint --init
 

run directly via:-

$ eslint yourfile.js
 

After installation you can configure your rules in configuration file:- In the .eslintrc file

 {
    "rules": {
        "semi": ["error", "always"],
        "quotes": ["error", "double"]
    }
}
 

You can also create your custom rules at runtime a great feature of Eslint if you want to create like:-

1)You need to place all runtime rules in the same directory 
2)You need to create a configuration file and need to define your rule Id error level under rules key. 
3)Run the command over terminal i.e. --rulesdir (this is an option to specify location of your rules)
 

Hope it would helps !

Thanks

About Author

Author Image
Parveen Kumar Yadav

Parveen is an experienced Java Developer working on Java, J2EE, Spring, Hibernate, Grails ,Node.js,Meteor,Blaze, Neo4j, MongoDB, Wowza Streaming Server,FFMPEG,Video transcoding,Amazon web services, AngularJs, javascript. He likes to learn new technologies

Request for Proposal

Name is required

Comment is required

Sending message..