Suppress “Expected '===' and instead saw '=='.” error in jslint

后端 未结 5 1682
轮回少年
轮回少年 2020-12-29 19:25

How can I stop the error message Expected \'===\' and instead saw \'==\'. from appearing in jslint. Doesn\'t seem to be an option.

5条回答
  •  情歌与酒
    2020-12-29 20:13

    This is pretty hot off the press.

    Douglas Crockford has just added an 'eqeq' option to the JSLint tool.

    See one of the June 12, 2011 edits on GitHub:

    https://github.com/douglascrockford/JSLint/commits/2e8d430b5b9543caefb3743513181f1295f52ddf/jslint.js

    Ad the time of writing it hadn't been updated on the JSLint front page, but i've tested it with the following and get no == related warnings:

    /*jslint eqeq: true*/
    var x = 0;
    if (x == 1) {
        alert("test");
    }
    

提交回复
热议问题