问题
I've been using jshint with node but just recently had to switch over to using it with Rhino.
I used to be able to do:
jshint --config=jsHintConfig.json fileToLint.js
Now, I've tried replacing that call with:
rhino jshint-rhino.js --config=jsHintConfig.json fileToLint.js
But it doesn't seem to work. I only get the following printed to the console:
Usage: jshint.js file.js
Does jshint-rhino not accept a json configuration file?
Update:
http://anton.kovalyov.net/2011/03/01/jshint-edition-update/ - Says: "Added support for providing options to JSHint as command line arguments when used with our Rhino wrapper" but doesn't say how.
https://github.com/jshint/jshint/issues/27 - Something about specifying options on the cli, but also doesn't say how.
回答1:
This worked:
rhino jshint-rhino.js file1.js file2.js opt1=true,opt2=true,opt3=false global1,global2,global3
No need to put a comma between file names and it is important to not have spaces before or after the commas for the options and globals.
来源:https://stackoverflow.com/questions/12588643/custom-settings-with-jshint-rhino-js