From 218e6a30d8690ce1b90414283aa5ad42179940cd Mon Sep 17 00:00:00 2001 From: Jeff Avallone Date: Sat, 15 Oct 2016 12:41:44 -0400 Subject: [PATCH] Adding npm script to run JSCS lint --- gulpfile.js | 33 --------------------------------- package.json | 3 ++- 2 files changed, 2 insertions(+), 34 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 663ebb8..b3e1441 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -14,7 +14,6 @@ const gulp = require('gulp-help')(require('gulp')), sourcemaps = require('gulp-sourcemaps'), babelify = require('babelify'), path = require('path'), - jscs = require('gulp-jscs'), config = require('./config'); gulp.task('default', 'Auto-rebuild site on changes.', ['server', 'docs'], function() { @@ -107,35 +106,3 @@ gulp.task('styles', 'Build stylesheets into ./build directory.', function() { .pipe(sourcemaps.write('.')) .pipe(gulp.dest(config.buildPath('css'))) }); - -gulp.task('verify', 'Verify (lint and run tests) scripts.', ['lint']); - -gulp.task('verify:watch', 'Auto-verify scripts.', ['lint:watch']); - -gulp.task('lint', 'Lint scripts', function() { - return gulp.src(config.globs.lint) - .pipe(jscs()) - .pipe(jscs.reporter()) - .pipe(jscs.reporter('fail')) - .on('error', notify.onError()) -}); - -gulp.task('lint:watch', 'Auto-lint scripts', function() { - gulp.watch(config.globs.lint, ['lint']); -}); - -gulp.task('lint:fix', 'Fix some lint errors.', config.lintRoots.map(function(root) { - return 'lint:fix:' + root; -}), function() { - return gulp.src('./*.js') - .pipe(jscs({fix: true})) - .pipe(gulp.dest('.')); -}); - -config.lintRoots.forEach(function(root) { - gulp.task('lint:fix:' + root, false, function() { - return gulp.src('./' + root + '/**/*.js') - .pipe(jscs({fix: true})) - .pipe(gulp.dest('./' + root)); - }); -}); diff --git a/package.json b/package.json index c0dbadb..0faedce 100644 --- a/package.json +++ b/package.json @@ -10,6 +10,7 @@ "license": "MIT", "private": true, "scripts": { + "pretest": "jscs lib/ src/ spec/", "test": "karma start --single-run" }, "devDependencies": { @@ -27,7 +28,6 @@ "gulp-front-matter": "^1.3.0", "gulp-hb": "^5.0.1", "gulp-help": "^1.6.1", - "gulp-jscs": "^4.0.0", "gulp-notify": "^2.0.1", "gulp-rename": "^1.2.2", "gulp-sass": "^2.1.1", @@ -35,6 +35,7 @@ "handlebars-layouts": "^3.1.2", "imports-loader": "^0.6.5", "jasmine-core": "^2.4.1", + "jscs": "^3.0.7", "karma": "^1.1.2", "karma-firefox-launcher": "^1.0.0", "karma-jasmine": "^1.0.2",