Skip to content
This repository has been archived by the owner on Jul 8, 2020. It is now read-only.

Commit

Permalink
fixes #22 - linters: jsonhint
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Grupp committed Feb 17, 2015
1 parent 0cb4e4b commit 265521a
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 3 deletions.
3 changes: 2 additions & 1 deletion app/templates/_gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ var gulp = require('gulp');
// config
gulp.paths = {
dist: 'www',
jsFiles: ['app/**/*.js', '!app/bower_components/**/*.js']
jsFiles: ['app/**/*.js', '!app/bower_components/**/*.js'],
jsonFiles: ['app/**/*.json', '!app/bower_components/**/*.json']
};
// retrieve options
var minimist = require('minimist');
Expand Down
1 change: 1 addition & 0 deletions app/templates/_package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"gulp-inject": "^1.1.1",
"gulp-jscs": "^1.4.0",
"gulp-jshint": "^1.9.0",
"gulp-jsonlint": "^1.0.2",
"gulp-livereload": "^3.2.0",
"gulp-load-plugins": "^0.8.0",
"gulp-natural-sort": "^0.1.0",
Expand Down
2 changes: 1 addition & 1 deletion app/templates/gulp_tasks/building.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var $ = require('gulp-load-plugins')();
var del = require('del');
var vinylPaths = require('vinyl-paths');

gulp.task('build', ['jshint', 'jscs', 'build-app', 'build-templates', 'build-assets'], function () {
gulp.task('build', ['jshint', 'jscs', 'jsonlint', 'build-app', 'build-templates', 'build-assets'], function () {
return gulp.src(paths.dist + '/**/*')
.pipe($.size({title: 'build', gzip: true}));
});
Expand Down
8 changes: 8 additions & 0 deletions app/templates/gulp_tasks/linting.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,11 @@ gulp.task('jscs', function () {
return gulp.src(paths.jsFiles)
.pipe($.jscs());
});

gulp.task('jsonlint', function () {
return gulp.src(paths.jsonFiles)
.pipe($.jsonlint())
.pipe($.jsonlint.reporter(function (file) {
throw new Error(file.path + '\n' + file.jsonlint.message);
}));
});
2 changes: 1 addition & 1 deletion app/templates/gulp_tasks/watching.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ gulp.task('watch', ['serve'], function () {
console.log('File ' + event.path + ' was ' + event.type + ', running tasks...');
if (event.type === 'changed') {
$.livereload.reload();
gulp.start('jshint', 'jscs');
gulp.start('jshint', 'jscs', 'jsonlint');
}
else { // added or deleted
gulp.start('inject-all'); // inject in index (implicitly reloads)
Expand Down

0 comments on commit 265521a

Please sign in to comment.