Options

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, evil: false */

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. All of the options default to false. Table C-1 lists the options available in using JSLint.

Table C-1. JSLint options

Option

Meaning

adsafe

true if ADsafe.org rules should be enforced

bitwise

true if bitwise operators should not be allowed

browser

true if the standard browser globals should be predefined

cap

true if uppercase HTML should be allowed

debug

true if debugger statements should be allowed

eqeqeq

true if === should be required

evil

true if eval should be allowed

for in

true if unfiltered for in statements should be allowed

fragment

true if HTML fragments should be allowed

laxbreak

true if statement breaks should not be checked

nomen

true if names should be checked

on

true if HTML event handlers should be allowed

passfail

true if the scan should stop on first error

plusplus

true if ++ and -- should not be allowed

rhino

true if the Rhino environment ...

Get JavaScript: The Good Parts now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.