Last Updated: February 25, 2016
·
3.359K
· nicolas-briemant

Use jshint with node.js

This little article aims to show how to easily use jshint with node.js.

(assuming you are in a node project)


  • Add jshint module to your package.json (preferably in devDependencies)

  • Run npm install jshint

  • Create a .jshintrc file which will contain your specific configuration:

{
    "strict": true
,   "laxcomma": true
}
  • Run ./node_modules/.bin/jshint <paths>
    If you are awesome, you may have a Makefile in which you can add a lint task:
lint:
    ./node_modules/.bin/jshint ./lib ./test ./index.js

and running make lint will do the job perfectly.

Have a fresh tip? Share with Coderwall community!

Post
Post a tip
Did you know?

JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.

Security insights from Cside