简体   繁体   English

如何关闭JSHint错误?

[英]How to turn off JSHint error?

I have the following error for my files in tests: Expected an assignment or function call and instead saw an expression. 我在测试中的文件有以下错误: Expected an assignment or function call and instead saw an expression. It is generated from Chai libraries asserts. 它是从柴库断言生成的。 How can I turn it off in my .jshintrc file? 如何在.jshintrc文件.jshintrc其关闭? I run a Gulp task based on it. 我基于它运行一个Gulp任务。

You can add the following on top of the line that's generating the error : 您可以在生成错误的行的顶部添加以下内容:

/*jshint -W030 */

Reference : http://jslinterrors.com/expected-an-assignment-or-function-call 参考: http : //jslinterrors.com/expected-an-assignment-or-function-call

Here's how you can silence it inside of a .jshintrc file. 您可以通过以下方法在.jshintrc文件.jshintrc.jshintrc

{
  ...
  "expr": true
  ...
}

Source: http://jshint.com/docs/options/#expr 来源: http//jshint.com/docs/options/#expr

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM