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

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

    Yes, there is a way. Two in fact. In October 2013 jshint added a way to ignore blocks of code like this:

    // Code here will be linted with JSHint.
    /* jshint ignore:start */
    // Code here will be ignored by JSHint.
    /* jshint ignore:end */
    // Code here will be linted with JSHint.
    

    You can also ignore a single line with a trailing comment like this:

    ignoreThis(); // jshint ignore:line
    

提交回复
热议问题