Update dependencies, switch to eslint
This commit is contained in:
26
gulpfile.js
26
gulpfile.js
@@ -8,7 +8,7 @@ var flatten = require('gulp-flatten');
|
||||
var gulp = require('gulp');
|
||||
var gulpif = require('gulp-if');
|
||||
var imagemin = require('gulp-imagemin');
|
||||
var jshint = require('gulp-jshint');
|
||||
var eslint = require('gulp-eslint');
|
||||
var lazypipe = require('lazypipe');
|
||||
var less = require('gulp-less');
|
||||
var merge = require('merge-stream');
|
||||
@@ -58,8 +58,8 @@ var enabled = {
|
||||
maps: !argv.production,
|
||||
// Fail styles task on error when `--production`
|
||||
failStyleTask: argv.production,
|
||||
// Fail due to JSHint warnings only when `--production`
|
||||
failJSHint: argv.production,
|
||||
// Fail due to ESLint warnings only when `--production`
|
||||
failESLint: argv.production,
|
||||
// Strip debug statments from javascript when `--production`
|
||||
stripJSDebug: argv.production
|
||||
};
|
||||
@@ -184,9 +184,9 @@ gulp.task('styles', ['wiredep'], function() {
|
||||
});
|
||||
|
||||
// ### Scripts
|
||||
// `gulp scripts` - Runs JSHint then compiles, combines, and optimizes Bower JS
|
||||
// `gulp scripts` - Runs ESLint then compiles, combines, and optimizes Bower JS
|
||||
// and project JS.
|
||||
gulp.task('scripts', ['jshint'], function() {
|
||||
gulp.task('scripts', ['lint'], function() {
|
||||
var merged = merge();
|
||||
manifest.forEachDependency('js', function(dep) {
|
||||
merged.add(
|
||||
@@ -221,15 +221,15 @@ gulp.task('images', function() {
|
||||
.pipe(browserSync.stream());
|
||||
});
|
||||
|
||||
// ### JSHint
|
||||
// `gulp jshint` - Lints configuration JSON and project JS.
|
||||
gulp.task('jshint', function() {
|
||||
// ### ESLint
|
||||
// `gulp lint` - Lints configuration JSON and project JS.
|
||||
gulp.task('lint', function() {
|
||||
return gulp.src([
|
||||
'bower.json', 'gulpfile.js'
|
||||
'gulpfile.js'
|
||||
].concat(project.js))
|
||||
.pipe(jshint())
|
||||
.pipe(jshint.reporter('jshint-stylish'))
|
||||
.pipe(gulpif(enabled.failJSHint, jshint.reporter('fail')));
|
||||
.pipe(eslint())
|
||||
.pipe(eslint.format())
|
||||
.pipe(gulpif(enabled.failESLint, eslint.failAfterError()));
|
||||
});
|
||||
|
||||
// ### Clean
|
||||
@@ -252,7 +252,7 @@ gulp.task('watch', function() {
|
||||
}
|
||||
});
|
||||
gulp.watch([path.source + 'styles/**/*'], ['styles']);
|
||||
gulp.watch([path.source + 'scripts/**/*'], ['jshint', 'scripts']);
|
||||
gulp.watch([path.source + 'scripts/**/*'], ['lint', 'scripts']);
|
||||
gulp.watch([path.source + 'fonts/**/*'], ['fonts']);
|
||||
gulp.watch([path.source + 'images/**/*'], ['images']);
|
||||
gulp.watch(['bower.json', 'assets/manifest.json'], ['build']);
|
||||
|
||||
Reference in New Issue
Block a user