Javascript 如何将全局配置传递给jshint?

Javascript 如何将全局配置传递给jshint?,javascript,jshint,Javascript,Jshint,如何将全局配置传递给jshint?我在文档中没有找到答案 我的配置文件: >type tests\jshint_options.js /*jshint globalstrict:true */ 这就是我迄今为止所尝试的: >jshint myfile.js --config=tests\jshint_options.js myfile.js: line 1, col 1, Use the function form of "use strict". myfile.js: line

如何将全局配置传递给jshint?我在文档中没有找到答案

我的配置文件:

>type tests\jshint_options.js
/*jshint globalstrict:true */
这就是我迄今为止所尝试的:

>jshint myfile.js --config=tests\jshint_options.js
myfile.js: line 1, col 1, Use the function form of "use strict".
myfile.js: line 4, col 24, Unescaped '['.
myfile.js: line 4, col 49, Unescaped '['.

3 errors

>jshint myfile.js --config tests\jshint_options.js

node.js:201
        throw e; // process.nextTick error, or 'error' event on first tick
              ^
SyntaxError: Unexpected end of input
    at Object.parse (native)
    at _loadAndParseConfig (C:\Users\RONG\AppData\Roaming\npm\node_modules\jshint\lib\cli.js:28:18)
    at Object.interpret (C:\Users\RONG\AppData\Roaming\npm\node_modules\jshint\lib\cli.js:114:22)
    at Object.<anonymous> (C:\Users\RONG\AppData\Roaming\npm\node_modules\jshint\bin\hint:2:25)
    at Module._compile (module.js:441:26)
    at Object..js (module.js:459:10)
    at Module.load (module.js:348:31)
    at Function._load (module.js:308:12)
    at Array.0 (module.js:479:10)
    at EventEmitter._tickCallback (node.js:192:40)

>
>jshint myfile.js--config=tests\jshint\u options.js
myfile.js:第1行,第1列,使用函数形式“Use strict”。
myfile.js:第4行,第24列,不带scape的“[”。
myfile.js:第4行,第49列,不带scape的“[”。
3个错误
>jshint myfile.js--配置测试\jshint\u options.js
node.js:201
抛出e;//process.nextTick error,或在第一次勾选时抛出“error”事件
^
SyntaxError:输入意外结束
at Object.parse(本机)
在\u loadAndParseConfig(C:\Users\RONG\AppData\Roaming\npm\node\u modules\jshint\lib\cli.js:28:18)
在Object.explait(C:\Users\RONG\AppData\Roaming\npm\node\u modules\jshint\lib\cli.js:114:22)
at对象。(C:\Users\RONG\AppData\Roaming\npm\node\u modules\jshint\bin\hint:2:25)
在模块处编译(Module.js:441:26)
at Object..js(module.js:459:10)
在Module.load(Module.js:348:31)
at功能。加载(module.js:308:12)
at Array.0(module.js:479:10)
在EventEmitter上进行回调(node.js:192:40)
>

经过大量挖掘,我发现这件事让我大开眼界

配置文件是JSON格式的,而不是javascript注释

{
    "supernew": true
}
附言


这实际上是在中记录的!不确定为什么我以前没有发现。

FYI,打开了一个问题来记录这一点: