-
-
Save thuld/49be503928ed753c1d8d to your computer and use it in GitHub Desktop.
The following code will setup the task that will generate an error report whenever an problem is detected in one of the specified script files:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
var gulp = require('gulp'); | |
var gutil = require('gulp-util'); | |
var stylish = require('jshint-stylish'); | |
var jshint = require('gulp-jshint'); | |
gulp.task('lint', function() { | |
// this will exclude the modules folder | |
var sourcefiles = [ | |
'./**/*.js', | |
'!./node_modules/**', | |
'!gulpfile.js' | |
]; | |
gulp.src( sourcefiles ) | |
.pipe(jshint( '.jshintrc' )) | |
// .pipe(jshint.reporter('default')); | |
.pipe( jshint.reporter(stylish) ); | |
}); | |
gulp.task('watch', function(){ | |
// adds a watch that executes the lint task everytime | |
// a file is modified | |
gulp.watch( ['.jshintrc', '*.js', 'lib/*.js'], ['lint'] ); | |
}); | |
// define the default task that is invoked | |
// when "gulp" is executed on the cmd-line | |
gulp.task('default', [ 'watch' ]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment