Programming Tips - javaScript: validate syntax and functionality

Date: 2003oct26 Language: bash Q. javaScript: validate syntax and functionality A. Node.js node.js's check option is a nice way to check the syntax:
node --check myfile.js
But globing (wildcard) doesn't work.
node --check *.js # DOES NOTHING!
So to check all files in a folder do:
find . -name \*.js -exec node --check {} \;
JSHint jshint checks a lot more things. Some of its errors are annoying. You can grep them out or add options to your code to suppress them.
jshint myfile.js
It supports wildcarding:
jshint *.js
but I rarely do this because it produces so many messages. Install with:
npm install -g jshint