add json lint gulp task

This commit is contained in:
Berkeley Martinez
2015-08-24 16:19:34 -07:00
parent 15c49ec520
commit b3d66e1ae0
2 changed files with 18 additions and 1 deletions

View File

@ -19,10 +19,12 @@ var Rx = require('rx'),
sync = require('browser-sync'),
inject = require('gulp-inject'),
// css
less = require('gulp-less'),
// lint
jsonlint = require('gulp-jsonlint'),
eslint = require('gulp-eslint');
@ -60,6 +62,11 @@ var paths = {
syncWatch: [
'public/**/*.*'
],
challenges: [
'seed/challenges/*.json',
'seed/under-construction/*.json'
]
};
@ -163,12 +170,20 @@ gulp.task('sync', ['serve'], function() {
});
});
gulp.task('lint', function() {
gulp.task('lint-js', function() {
return gulp.src(['public/js/lib/**/*'])
.pipe(eslint())
.pipe(eslint.format());
});
gulp.task('lint-json', function() {
return gulp.src(paths.challenges)
.pipe(jsonlint())
.pipe(jsonlint.reporter());
});
gulp.task('test-challenges', ['lint-json']);
gulp.task('less', function() {
return gulp.src('./public/css/*.less')
.pipe(plumber({ errorHandler: errorHandler }))
@ -182,6 +197,7 @@ gulp.task('build', ['less']);
gulp.task('watch', ['less', 'serve', 'sync'], function() {
gulp.watch('./public/css/*.less', ['less']);
gulp.watch(paths.challenges, ['test-challenges']);
});
gulp.task('default', ['less', 'serve', 'sync', 'watch', 'pack-watch']);

View File

@ -120,6 +120,7 @@
"gulp": "~3.8.8",
"gulp-eslint": "~0.9.0",
"gulp-inject": "~1.0.2",
"gulp-jsonlint": "^1.1.0",
"gulp-nodemon": "^2.0.3",
"gulp-notify": "^2.2.0",
"gulp-plumber": "^1.0.1",