使用jshint-rhino.js的自定义设置 [英] Custom settings with jshint-rhino.js
问题描述
我一直在将jshint与node一起使用,但最近不得不切换到与Rhino一起使用.
I've been using jshint with node but just recently had to switch over to using it with Rhino.
我曾经能够做到:
jshint --config=jsHintConfig.json fileToLint.js
jshint --config=jsHintConfig.json fileToLint.js
现在,我尝试将呼叫替换为:
Now, I've tried replacing that call with:
rhino jshint-rhino.js --config=jsHintConfig.json fileToLint.js
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
Usage: jshint.js file.js
jshint-rhino是否不接受json配置文件?
Does jshint-rhino not accept a json configuration file?
更新:
http://anton.kovalyov.net/2011/03 /01/jshint-edition-update/ -说:增加了对在与Rhino包装器一起使用时为JSHint提供选项作为命令行参数的支持",但没有说明如何实现.
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 -关于在cli上指定选项的内容,但也没有说明如何做.
https://github.com/jshint/jshint/issues/27 - Something about specifying options on the cli, but also doesn't say how.
推荐答案
此方法有效:
rhino jshint-rhino.js file1.js file2.js opt1 = true,opt2 = true,opt3 = false global1,global2,global3
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.
这篇关于使用jshint-rhino.js的自定义设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!