Skip to content

Instantly share code, notes, and snippets.

@robdodson
Created December 6, 2015 17:26
Show Gist options
  • Save robdodson/9219e1b5042eeca14923 to your computer and use it in GitHub Desktop.
Save robdodson/9219e1b5042eeca14923 to your computer and use it in GitHub Desktop.
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