Reputation: 11363
I have a feature-layer application and am writing a jshint gulp task for it.
This is the grunt task:
jshint : {
options : {
reporter : require("jshint-stylish"),
force : true
},
all : ["Gruntfile.js", "develop/modules/**/*.js", "develop/components/**/*.js"]
},
My .jshintrc
file:
{
"curly" : true,
"eqeqeq": true,
"forin" : true,
"globals" : {
"angular" : false, <-- is not defined
"module" : false,
"console" : false <-- Is not defined
},
"latedef" : true,
"maxerr" : 150,
"undef": true,
"unused": true,
"strict": true
}
but the output when calling the task on the project is:
C:\Users\jason\Desktop\work\QAngular\angular>grunt jshint
Running "jshint:all" (jshint) task
develop/modules/login/login.js
line 1 col 1 Use the function form of "use strict".
line 3 col 1 'angular' is not defined.
line 12 col 13 'console' is not defined.
line 20 col 21 'angular' is not defined.
line 21 col 34 'angular' is not defined.
line 27 col 29 'console' is not defined.
line 31 col 29 'console' is not defined.
According to the documentation, the globals
setting in .jshintrc
is supposed to handle this. Its not. Are there any possibilities I missed
Upvotes: 0
Views: 245
Reputation: 2121
grunt-contrib-jshint
does not use .jshintrc
by default, you have to ask for it explicitly by setting jshint.options.jshintrc
to true
or a filepath (https://www.npmjs.com/package/grunt-contrib-jshint#jshintrc):
jshint : {
options : {
jshintrc: true,
reporter : require("jshint-stylish"),
force : true
},
all : ["Gruntfile.js", "develop/modules/**/*.js", "develop/components/**/*.js"]
},
Upvotes: 1