How To Tell Jslint / Jshint What Global Variables Are Already Defined
In my project we have some global variables that work as containers: MyProject.MyFreature.someFunction = function() { ... } So then I use that script across the site and JSLint /
Solution 1:
For JSHint you can create .jshintrc
to your project directory with
{"globals":{"MyProject":true}}
Solution 2:
Solution 3:
JSLint has a textarea below the options that says predefine global variables here
in it. Just add the variable names in there before running the check.
JSHint doesn't allow you to add global variables, but you can uncheck the When variable is undefined
option to suppress that warning.
The JSHint library also has parameters for globals, if you run it as a library . . . details in here: http://jshint.com/docs/
Post a Comment for "How To Tell Jslint / Jshint What Global Variables Are Already Defined"