Reputation: 15993
We use gjslinter with Grunt to lint all the js files in our project.
The configuration in Gruntfile.js looks like this:
gjslint: {
options: {
flags: ['--disable 220,110,200'],
reporter: {
name: 'gjslint_xml',
dest: '<%= pkg.docs %>/gjslint/gjslint.xml'
}
},
all: {
src: ['<%= pkg.src %>/assets/js/modules/**', '<%= pkg.src %>/assets/js/lib/jquery/plugins/jquery-hse/**']
}
}
But when I start the linting it fails:
$ grunt gjslint Running "gjslint:all" (gjslint) task
Warning: Task "gjslint:all" failed. Use --force to continue.
Aborted due to warnings.
Why? Paths should be correct. There are no more error messages or reports. How can I debug this?
Upvotes: 0
Views: 51
Reputation: 15993
I found the solution by following these steps (on Windows 10 here):
C:/Python27
as well as C:/Python27/Scripts
to PATH
and PYTHONPATH
env variablesInstalled Google JavaScript Linter by running this in command line:
pip install https://github.com/google/closure-linter/zipball/master
Changed reporter setting for Grunt:
(Gruntfile.js):
reporter: {
name: 'console' //report to console
}
Now I am getting proper error messages in console when running grunt gjslint
. It showed me that there was a min.js file which had some invalid code. So, I removed it from Gruntfile.js by adding an exception for min files:
src: [
'<%= pkg.src %>/assets/js/modules/**/*.js',
'<%= pkg.src %>/assets/js/lib/jquery/plugins/jquery-hse/**/*.js',
'!<%= pkg.src %>/assets/js/**/*.min.js'
]
This fixed the issue!
Upvotes: 0