Created
December 6, 2015 17:26
-
-
Save robdodson/9219e1b5042eeca14923 to your computer and use it in GitHub Desktop.
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
var gutil = require('gulp-util'); | |
... | |
// Lint JavaScript | |
gulp.task('lint', function() { | |
var requiredFiles = ['.jscsrc', '.jshintrc', 'weasel.ball']; | |
requiredFiles.forEach(function(file) { | |
try { | |
fs.statSync(file) | |
} catch(err) { | |
throw new gutil.PluginError({ | |
plugin: 'lint', | |
message: 'Missing required file: ' + file | |
}); | |
} | |
}); | |
return gulp.src([ | |
'app/scripts/**/*.js', | |
'app/elements/**/*.js', | |
'app/elements/**/*.html', | |
'gulpfile.js' | |
]) | |
.pipe(reload({ | |
stream: true, | |
once: true | |
})) | |
// JSCS has not yet a extract option | |
.pipe($.if('*.html', $.htmlExtract())) | |
.pipe($.jshint()) | |
.pipe($.jscs()) | |
.pipe($.jscsStylish.combineWithHintResults()) | |
.pipe($.jshint.reporter('jshint-stylish')) | |
.pipe($.if(!browserSync.active, $.jshint.reporter('fail'))); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment