Coding Tidbits

Cube Root is an exclusive Ruby on Rails Consultancy. Find our programming ramblings here.

JSHint

JSHint is a tool to detect errors and potential problems in JavaScript code.

Install JSHint using a Node program.

$ npm install jshint

To install JSHint globally on your system, use -g flag as:

$ npm install jshint -g

If you have done, you should be able to use JSHint.

To detect errors in single file run following command:

$ jshint orders.js

orders.js: line 1, col 1, Expected an assignment or function call and instead saw an expression.

orders.js: line 1, col 2, Missing semicolon.

2 errors

Now, you should be able to fix these errors, and make your code clean.

References: http://www.jshint.com/docs/