From b3d66e1ae0e07c4036fc62e76ca606b0437f0b71 Mon Sep 17 00:00:00 2001 From: Berkeley Martinez Date: Mon, 24 Aug 2015 16:19:34 -0700 Subject: [PATCH] add json lint gulp task --- gulpfile.js | 18 +++++++++++++++++- package.json | 1 + 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/gulpfile.js b/gulpfile.js index 8e1e345716..9cfded3db8 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -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']); diff --git a/package.json b/package.json index b14ee1e15f..8aa3c12d40 100644 --- a/package.json +++ b/package.json @@ -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",