This script don't require instalation, you only need download this files and execute as below. If you has the NPM instaled you can install this script via NPM:
-
Into your project:
npm install JSLintCli
-
As Global (Recomended):
sudo npm install JSLintCli -g
If you install as Global you need execute this script as SuperUser on the first time to download and install the core
There are 2 ways to execute this script:
-
Using node executable:
node JSLint
-
Or using JSLint as executable:
./JSLint
You can pass to this script one of this file formats:
-
One file:
node JSLint tests/test1.js
-
Multiple files:
node JSLint tests/test1.js tests/test2.js tests/test3.js
-
A search with wildcard:
node JSLint tests/*.js
This script accept one option parameter (--list). With this parameter the script don't show the list of errors, only show a list of files that was passed and your status after the JSLint validation:
node JSLint --list tests/*.jsThe return will be like this:
>tests/test1.js - 3 problem(s) found >tests/test2.js - No problems found >tests/test3.js - No problems found >tests/test4.js - 2 problem(s) found
When you execute this script the first time, this script will download the JSLint core from https://raw.github.com/douglascrockford/JSLint/master/jslint.js. After download, the script will execute normally.