在Rhino上使用JSHint的配置文件 [英] Using a config file for JSHint with Rhino
问题描述
我正在尝试使用Rhino从命令行运行jsHint.我想使检查成为团队检查过程的自动部分.
I'm attempting to run jsHint from the command line using Rhino. I want to make the check an automatic part of my teams checkin process.
我可以使用以下命令来进行基本配置:
I have the basic configuration working using the command:
java -jar .rhino.jar ./jshint.js ./samplefile.js
这将为我的(故意出错的)示例文件输出标准jsHint消息.并将配置注释添加到示例文件的顶部可以正常工作.但是,我想添加一个项目级别的配置文件来为每个文件指定我想要的选项,而不必在每个单独的文件中添加注释.
That outputs the standard jsHint messages for my (intentionally error-ridden) sample file. And adding config comments to the top of the sample file works correctly. However I would like to add a project level config file to specify the options I want for each file without adding comments to each individual file.
我找到了针对基于node.js命令行工具的说明,但无法使用Rhino包装器进行复制.
我尝试了以下各种变化:
I found instructions to do so for the node.js command line based tool, but have been unable to replicate this with the Rhino wrapper.
I attempted various variations on:
java -jar .rhino.jar ./jshint.js ./samplefile.js --configure=./config.js
但是对于犀牛版本似乎不起作用.
有指针吗?
but that didn't seem to work for the rhino version.
Any pointers?
从找到此问题(使用jshint-rhino的自定义设置)几个星期前.
这表明可以使用以下格式:
This pointed out that the following format works:
java -jar .rhino.jar ./jshint.js ./samplefile.js option1=true option2=false global global
这对我有用,但是我想指定大量选项并使其易于配置,所以我非常喜欢在node.js发行版中使用json配置文件.
This worked for me, however I would like to specify a large amount of options and have it be easily configurable, so I would very much prefer to use a json config file as in the node.js distribution.
有人可以确认这是否可能吗?
Could somebody confirm that this is possible/not possible?
推荐答案
不幸的是,我们的Rhino包装器非常基础,不支持配置文件.拥有它会很好-也许您想创建票证?
Unfortunately, our Rhino wrapper is pretty basic and doesn't support config files. It would be nice to have that—perhaps you would like to create a ticket?
这篇关于在Rhino上使用JSHint的配置文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!