JSLint: control comments (selective ignore)

后端 未结 9 1709
一生所求
一生所求 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:51

    Put /*jsl:ignore*/ and /*jsl:end*/ around the code.

    0 讨论(0)
  • 2020-12-01 06:55

    You can also: ......

    ignoreThis(); // jslint ignore:line

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

    0 讨论(0)
  • 2020-12-01 06:55

    I'm going to say, No. JSLint does not seem to have a simple way to say, 'ignore this block of code', very much to my annoyance. Disabling the different options individually and then turning them back on like Matt seems to suggest should work, but it's not going to be elegant like JSHint's /* jshint ignore:start */, /* jshint ignore:end */.

    The reason I was looking into this is because I'm using Brackets, which comes with JSLint as it's default linter. I have some minified 3rd party code that I copied into my .js, temporarily, and as long as it's in there JSLint is going to complain. What stinks is I often want to paste a minified chunk early on, which is also when I want the linter looking at my code to help me rule out obscure errors. Later I'll just minify and concat everything with Grunt, but not being able to disable it for a block early on is really, really, annoying.

    0 讨论(0)
提交回复
热议问题