Jshint: JSHint + `"use strict";` 导致虚假的“'exports' 未定义”。 警告

创建于 2013-05-09  ·  3评论  ·  资料来源: jshint/jshint

我想将 JSHint 和"use strict";都应用到我的 Node.js 代码中,但是当我这样做时,JSHint 会抱怨:

$ jshint .
binfix.js: line 14, col 1, 'exports' is not defined.
binfix.js: line 24, col 1, 'exports' is not defined.
binfix.js: line 48, col 1, 'exports' is not defined.

最有用的评论

我添加了这个:

{
"node" : true
}

在 .jshintrc 文件中,它对我来说效果很好。 谢谢@mcandre@valueof

所有3条评论

使用/*jshint node:true */选项。

@antonkovalyov再次感谢! 当我将"node": true添加到我的.jshintrc时,所有警告都消失了!

我添加了这个:

{
"node" : true
}

在 .jshintrc 文件中,它对我来说效果很好。 谢谢@mcandre@valueof

此页面是否有帮助?
0 / 5 - 0 等级