Adding npm script to run JSCS lint

This commit is contained in:
Jeff Avallone 2016-10-15 12:41:44 -04:00
parent c89ef457b6
commit 218e6a30d8
2 changed files with 2 additions and 34 deletions

View File

@ -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));
});
});

View File

@ -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",