Monday, January 13, 2014

Offline method to check a Javascript file for coding errors

There a a few web sites that can perform Javascript code checking for errors, but I wanted an offline method for those times when I am not on the net. I found a JSLint plug-in for my favorite text editor Notepad++ that can do the job.

A Javascript file in Notepad++

To install the JSLint plug-in, just run the Plugin Manager in Notepad++ and install the plug-in.


 Once the JSLint plugin is installed, the commands are accessible from the Plugins pulldown menu as shown below.

To use JSLint to validate a Javascript file, simply have the file opened in Notepad++, then select Plugins | JSLint | JSLint Current File.

The JSLint pane appears at the bottom with a list of code problems.

 You can use the JSLint Previous or Next commands (arrow icons highlighted in red above) to navigate from error to error, or double clicking an item in the list. The line with the selected error will be shown in the code above.

To validate the Javascript code again, just click the JSLint Current File command (single green tick icon highlighted in red above) to run the code checking again.

No comments:

Related Posts with Thumbnails