diff --git a/gulpfile.js b/gulpfile.js index 6d6586d61..542f0cf44 100755 --- a/gulpfile.js +++ b/gulpfile.js @@ -41,23 +41,30 @@ gulp.task('scss:watch', function () { // ############################################################################# // LINTING +gulp.task('jscs:fix', function () { + return gulp.src(PROJECT_PATH.js + '**/*.js') + .pipe(jscs({fix: true})) + .pipe(gulp.dest(PROJECT_PATH.js)); +}); + +gulp.task('jscs', function () { + return gulp.src(PROJECT_PATTERNS.lint) + .pipe(jscs()) + .pipe(jscs.reporter()) + .pipe(jscs.reporter('fail')); +}); + gulp.task('lint', function () { return gulp.src(PROJECT_PATTERNS.lint) .pipe(jshint('.jshintrc')) .pipe(jshint.reporter(stylish)) - .pipe(jscs('.jscsrc')) - .on('error', function (error) { - gutil.log('\n' + error.message); - if (process.env.CI) { - process.exit(1); - } - }); + .pipe(jshint.reporter('fail')); }); gulp.task('lint:watch', function () { - gulp.watch(PROJECT_PATTERNS.lint, ['lint']); + gulp.watch(PROJECT_PATTERNS.lint, ['lint', 'jscs']); }); gulp.task('compile', ['scss']); gulp.task('watch', ['scss:watch', 'lint:watch']); -gulp.task('ci', ['lint']); +gulp.task('ci', ['lint', 'jscs']);