jshint ignore Use '!==' to compare with ''

♀尐吖头ヾ 提交于 2019-12-03 16:45:59

问题


How can I configure JSHint to ignore this error: Use '!==' to compare with ''. ?

I want that this code pass:

/*jshint undef: false */
if (a == true) {

}

回答1:


The solution is to install the new version of jshint:

npm install -g https://github.com/jshint/jshint/archive/1.0.0-rc4.tar.gz

Then to use this config:

{
    "-W041": false
}

Finally this command

jshint --config jshint.json file.js




回答2:


Just use:

if (a) {

}

You don't ever need to use == true in a if statement.



来源:https://stackoverflow.com/questions/14895217/jshint-ignore-use-to-compare-with

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!