JSLint: control comments (selective ignore)

后端 未结 9 1836
一生所求
一生所求 2020-12-01 06:16

Does JSLint have anything like JavaScript Lint\'s control comments (e.g. /*jsl:fallthru*/) to make it ignore certain passages?

9条回答
  •  生来不讨喜
    2020-12-01 06:49

    Put

    /*ignore jslint start*/
    

    before and

    /*ignore jslint end*/ 
    

    after the code to be ignored. Ex:

    function ignore(){
        /*ignore jslint start*/
        var x; var y;
        /*ignore jslint end*/
    }
    

    Or export JsLint settings, define your IgnoreErrorStart/ IgnoreErrorEnd symbols and import.


    Edit
    Some folks may confuse this answer with JSHint. In that case, use these:

    /*jshint ignore:start*/
      
    /*jshint ignore:end*/
    

    Taken from https://stackoverflow.com/a/26012357/313501

提交回复
热议问题