关于javascript:如何将全局配置传递给jshint?

How do I pass global config to jshint?

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

我的配置文件:

1
2
>type tests\jshint_options.js
/*jshint globalstrict:true */

这就是我迄今为止所尝试的:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
>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
ONG\AppData
oaming
pm
ode_modules\jshint\lib\cli.js:28:18)
    at Object.interpret (C:\Users
ONG\AppData
oaming
pm
ode_modules\jshint\lib\cli.js:114:22)
    at Object. (C:\Users
ONG\AppData
oaming
pm
ode_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)

>


经过大量的挖掘,我发现这篇有帮助的博文让我陶醉…

配置文件是JSON格式,而不是JavaScript注释!

1
2
3
{
   "supernew": true
}

附笔。

这实际上记录在nodejs jshint文档中!不知道为什么我以前没找到。