I uses RequireJS AMD in my project. When i run jshint on my project, it throws error like
In AMD Scripts
\'define\' is not defined.
<
Read the docs and search for /*global
Add this in your .jshintrc
"predef" : ["define"] // Custom globals for requirejs
late to the party, but use this option in your jshintrc
:
"dojo": true
and thou shall rest peacefully without red warnings...
Just to expand a bit, here's a .jshintrc
setup for Mocha:
{
....
"globals" : {
/* MOCHA */
"describe" : false,
"it" : false,
"before" : false,
"beforeEach" : false,
"after" : false,
"afterEach" : false
}
}
From the JSHint Docs - the false (the default) means the variable is read-only.
If you are defining globals only for a specific file, you can do this:
/*global describe, it, before, beforeEach, after, afterEach */
To avoid the not defined warning in jshint for the javascript add comments like:
/*global describe:true*/
Options
If you are working on node js. Add these two lines in the beginning of your file
/*jslint node: true */
"use strict";