Does JSLint have anything like JavaScript Lint's control comments (e.g. /*jsl:fallthru*/
) to make it ignore certain passages?
views:
455answers:
3It doesn't seem so. Some Googling finds several posts by others, and responses from JSLint people along the lines of "Fix your code instead of labeling it intentionally defective." Doesn't seem entirely friendly. Of course, maybe in this case you should just fix the code, but I leave that for you to answer.
Yes. You can specify options for the whole file, but not individual sections of code. From the documentation at http://www.jslint.com/lint.html:
The implementation of JSLint accepts an option object that allows you to determine the subset of JavaScript that is acceptable to you. It is also possible to set those options within the source of a script.
An option specification can look like this:
/*jslint nomen: true, debug: true,
evil: false, onevar: true */
An option specification starts with /*jslint. Notice that there is no space before the j. The specification contains a sequence of name value pairs, where the names are JSLint options, and the values are true or false. An option specification takes precedence over the option object.
There is a complete list of options in the documentation (scroll down to the bottom of the page).