Primarily, this patch adds an env/wsh.js script which allows JSHint to be run natively within Windows, either from the command line or via an IDE's 'external tools'. It can be run standalone (in which case it assumes jshint.js is one directory up) or concatenated to the end of jshint.js. It supports supplying the script as a filename or via stdin, and accepts JSHint options as Windows-style command-line arguments.
Secondarily, I've also added a new wsh option which predefines the Windows Scripting Host environment globals (a lá node and rhino).
added straight port of wsh.js from benblank/JSLint
refactored wsh.js output formatting into a series of property formatters
added command-line options, usage message to wsh.js
implemented 'global' option in wsh.js
added 'wsh' option for predefining WSH environment globals
added missing 'shadow' option to wsh.js so that it passes lint
made wsh.js aware of its own location
Thanks! Two things:
Sure, I'll look at adding tests today or tomorrow.
The wrapper only requires the Windows Scripting Host itself, which has been bundled since Windows 98, so you should be good to go. To test it, you can open a console window in the jshint/env directory and type cscript wsh.js rhino.js to lint the Rhino wrapper. You also use it from any other folder, as long as you specify the path to wsh.js.
cscript wsh.js rhino.js
Currently, it doesn't work when used from the shell (by dragging scripts onto it), but that's on my to-do list.
added 'wsh' globals to /*members */
added unit test for 'wsh' option
Fixed so that existing unit tests pass (whoops!) and added new tests for wsh:
$ expresso tests/*.js
100% 52 tests
improved handing of file errors in wsh.js
removed script trimming in wsh.js
This wrapper was originally written for JSLint, which generated spurious errors if the final character of the script was not trimmed off. JSHint doesn't seem to suffer this problem.
Looks good. Going to try this new "Merge pull request" button on this one. :-)
Merged pull request #126 from benblank/master.
Add WSH support to JSHint
Seems to work fine, thanks!