add json lint gulp task
This commit is contained in:
18
gulpfile.js
18
gulpfile.js
@ -19,10 +19,12 @@ var Rx = require('rx'),
|
|||||||
sync = require('browser-sync'),
|
sync = require('browser-sync'),
|
||||||
|
|
||||||
inject = require('gulp-inject'),
|
inject = require('gulp-inject'),
|
||||||
|
|
||||||
// css
|
// css
|
||||||
less = require('gulp-less'),
|
less = require('gulp-less'),
|
||||||
|
|
||||||
// lint
|
// lint
|
||||||
|
jsonlint = require('gulp-jsonlint'),
|
||||||
eslint = require('gulp-eslint');
|
eslint = require('gulp-eslint');
|
||||||
|
|
||||||
|
|
||||||
@ -60,6 +62,11 @@ var paths = {
|
|||||||
|
|
||||||
syncWatch: [
|
syncWatch: [
|
||||||
'public/**/*.*'
|
'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/**/*'])
|
return gulp.src(['public/js/lib/**/*'])
|
||||||
.pipe(eslint())
|
.pipe(eslint())
|
||||||
.pipe(eslint.format());
|
.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() {
|
gulp.task('less', function() {
|
||||||
return gulp.src('./public/css/*.less')
|
return gulp.src('./public/css/*.less')
|
||||||
.pipe(plumber({ errorHandler: errorHandler }))
|
.pipe(plumber({ errorHandler: errorHandler }))
|
||||||
@ -182,6 +197,7 @@ gulp.task('build', ['less']);
|
|||||||
|
|
||||||
gulp.task('watch', ['less', 'serve', 'sync'], function() {
|
gulp.task('watch', ['less', 'serve', 'sync'], function() {
|
||||||
gulp.watch('./public/css/*.less', ['less']);
|
gulp.watch('./public/css/*.less', ['less']);
|
||||||
|
gulp.watch(paths.challenges, ['test-challenges']);
|
||||||
});
|
});
|
||||||
|
|
||||||
gulp.task('default', ['less', 'serve', 'sync', 'watch', 'pack-watch']);
|
gulp.task('default', ['less', 'serve', 'sync', 'watch', 'pack-watch']);
|
||||||
|
@ -120,6 +120,7 @@
|
|||||||
"gulp": "~3.8.8",
|
"gulp": "~3.8.8",
|
||||||
"gulp-eslint": "~0.9.0",
|
"gulp-eslint": "~0.9.0",
|
||||||
"gulp-inject": "~1.0.2",
|
"gulp-inject": "~1.0.2",
|
||||||
|
"gulp-jsonlint": "^1.1.0",
|
||||||
"gulp-nodemon": "^2.0.3",
|
"gulp-nodemon": "^2.0.3",
|
||||||
"gulp-notify": "^2.2.0",
|
"gulp-notify": "^2.2.0",
|
||||||
"gulp-plumber": "^1.0.1",
|
"gulp-plumber": "^1.0.1",
|
||||||
|
Reference in New Issue
Block a user