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

后端 未结 3 1237
遥遥无期
遥遥无期 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:25

    The "evil" answer did not work for me. Instead, I used what was recommended on the JSHints docs page. If you know the warning that is thrown, you can turn it off for a block of code. For example, I am using some third party code that does not use camel case functions, yet my JSHint rules require it, which led to a warning. To silence it, I wrote:

    /*jshint -W106 */
    save_state(id);
    /*jshint +W106 */
    

提交回复
热议问题