Is there a way to suppress JSHint warning for one given line?

后端 未结 3 1233
遥遥无期
遥遥无期 2020-11-30 16:34

I have a (single) case in my app were eval is used, and I would like to suppress JSHint warning only for this case.

Is there a way to achieve that? Conf

3条回答
  •  庸人自扰
    2020-11-30 17:12

    As you can see in the documentation of JSHint you can change options per function or per file. In your case just place a comment in your file or even more local just in the function that uses eval:

    /*jshint evil:true */
    
    function helloEval(str) {
        /*jshint evil:true */
        eval(str);
    }
    

提交回复
热议问题