![](/img/trans.png)
[英]JSHINT: is there a way in to ignore camelCase only property and enforce it on variable and function
[英]JSHint ignore `!function(){ /* … */ }()` pattern
如何配置JS Hint忽略JSHint ignore !function(){ /* ... */ }()
模式。 目前,它向我發出警告,告訴我它需要一份聲明或作業。 我希望這是由於!function
將函數轉換為函數表達式,這無處可去。 我知道我可以做... var garbage = !function ...
但我不想更改源代碼以取悅JS Hint,我想告訴JS Hint可以使用運算符來強制執行函數表達。
你可以禁用它。 將它放在文件的開頭,或者將expr
選項添加到.jshintrc
配置中。
/*jshint expr:true */
此選項允許任何原始表達式,例如:
!function(){}();
a || b();
a ? b() : c();
你這樣寫是為了避免警告:
(function(){}());
if (!a) b();
if (a) {
b();
} else {
c();
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.