[英]JSHINT: how to disable the warning Missing space after anonymous 'function'
I got warning in jshint 我在jshint收到警告
'[L76:C24] Missing space after 'function''
I follows Nicholas Zakkas Maintainable javascript styles where there is no space after anonymous function. 我遵循Nicholas Zakkas可 维护的javascript样式,匿名函数后没有空格。 How to remove this warning in jshint?
如何在jshint中删除此警告?
.jshintrc .jshintrc
{
"node": true,
"browser": true,
"es5": true,
"esnext": true,
"bitwise": true,
"camelcase": true,
"curly": true,
"eqeqeq": true,
"immed": true,
"indent": 4,
"latedef": true,
"newcap": true,
"noarg": true,
"quotmark": "single",
"regexp": true,
"undef": true,
"unused": true,
"strict": true,
"trailing": true,
"smarttabs": true
}
Normally you have error notices in the following form in your CLI: 通常,您在CLI中有以下表单中的错误通知:
[L426:C63] W030: Expected an assignment or function call and instead saw an expression.
[L426:C63] W030:预期赋值或函数调用,而是看到一个表达式。
Now you can take that WXXX
ID and add it to your options
subobject. 现在,您可以将该
WXXX
ID添加到options
子对象中。 Simply add 只需添加
"-WXXX" : true
for whatever notice you want to turn off. 无论你想要什么通知关闭。 Keep in mind that you only can turn off all notices of a type and no specific notices on specific lines or lines in only single files.
请记住,您只能关闭某个类型的所有通知,而不能仅关注单个文件中特定行或行的特定通知。 Still, you can add different tasks for different files and ignore different hints/notices that way.
不过,您可以为不同的文件添加不同的任务,并忽略不同的提示/通知。
Here's an example for grunt-contrib-jshint
. 这是
grunt-contrib-jshint
的一个例子。 Note: site.scripts
comes from a YAML file that holds the config. 注意:
site.scripts
来自保存配置的YAML文件。
jshint : {
dev : {
options : {
// Ignore: "Bad" line break
"-W014" : true
},
src: [ "<%= site.scripts %>/**/*.js" ]
}
}
The indent
option used to force the white
option on . 用于强制启用
white
选项的indent
选项 。 This is no longer the case in the most recent version. 在最新版本中不再是这种情况。
Try adding the following to your .jshintrc: 尝试将以下内容添加到.jshintrc:
"white": false
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.