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 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)

>

最佳答案

经过大量挖掘,我发现了这个 helpful blog post Revel ...

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

{
    "supernew": true
}

附言

这实际上记录在 nodejs-jshint documentations 中!不知道为什么我以前没有发现。

关于javascript - 如何将全局配置传递给 jshint?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9770968/

相关文章:

javascript - Gulp watch 导致无限循环

javascript - 本地存储迭代获取for循环内单击按钮的值

javascript - 如何在 javascript 中运行对象的 onEvent 方法?

javascript - 如何在 JSHint 中启用不必要的分号警告?

javascript - jsHint "function not defined"问题,函数声明的顺序很重要?

javascript - jquery/javascript : jQuery. fn.reverse = [].reverse;

javascript - 如何保护我的 php、jquery、ajax 请求免受黑客攻击?

javascript - 当我有效使用非点符号时 jshint "Better written in dot notation"的解决方案

javascript - JSHint 沉默 "Variable is defined but never used"

javascript - 将参数传递给命名函数 jshint 警告