Reputation: 6123
I am working on a Gulp file and I am doing the task for jshint to check my code.
gulp.task('lint', function () {
return gulp.src(['public/**/*.js',
'!public/vendor/*.js', '!public/app.min.js', '!public/fonts/*.*',
'!public/favico.png', '!public/templates.js'])
.pipe(jshint())
.pipe(jshint.reporter( 'default' ));
});
I just fix some errors I had in the code but the console/terminal didn't print anything to know if now everything is correct.
How should I do that ?
Upvotes: 0
Views: 156
Reputation: 5519
As said in github project page,
you can create a custom reporter that will print every error.
code is like this:
var jshint = require('gulp-jshint');
var map = require('map-stream');
var myReporter = map(function (file, cb) {
if (!file.jshint.success) {
console.log('JSHINT fail in '+file.path);
file.jshint.results.forEach(function (err) {
if (err) {
console.log(' '+file.path + ': line ' + err.line + ', col ' + err.character + ', code ' + err.code + ', ' + err.reason);
}
});
}
cb(null, file);
});
gulp.task('lint', function () {
return gulp.src(['public/**/*.js',
'!public/vendor/*.js', '!public/app.min.js', '!public/fonts/*.*',
'!public/favico.png', '!public/templates.js'])
.pipe(jshint())
.pipe(myReporter);
});
Upvotes: 1