Pass an object with the options as second parameter to JSLINT
. Global variables can be defined as an array of strings and assigned to the predef
property of said options object.
From the JSLint source code:
JSLINT
is a global function. It takes two parameters.
var myResult = JSLINT(source, option);
The first parameter is either a string or an array of strings. If it is a
string, it will be split on '\n'
or '\r'
. If it is an array of strings, it
is assumed that each string represents one line. The source can be a
JavaScript text, or HTML text, or a JSON text, or a CSS text.
The second parameter is an optional object of options that control the
operation of JSLINT. Most of the options are booleans: They are all
optional and have a default value of false. One of the options, predef
,
can be an array of names, which will be used to declare global variables,
or an object whose keys are used as global names, with a boolean value
that determines if they are assignable.