Adding npm script to run JSCS lint
This commit is contained in:
parent
c89ef457b6
commit
218e6a30d8
33
gulpfile.js
33
gulpfile.js
@ -14,7 +14,6 @@ const gulp = require('gulp-help')(require('gulp')),
|
|||||||
sourcemaps = require('gulp-sourcemaps'),
|
sourcemaps = require('gulp-sourcemaps'),
|
||||||
babelify = require('babelify'),
|
babelify = require('babelify'),
|
||||||
path = require('path'),
|
path = require('path'),
|
||||||
jscs = require('gulp-jscs'),
|
|
||||||
config = require('./config');
|
config = require('./config');
|
||||||
|
|
||||||
gulp.task('default', 'Auto-rebuild site on changes.', ['server', 'docs'], function() {
|
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(sourcemaps.write('.'))
|
||||||
.pipe(gulp.dest(config.buildPath('css')))
|
.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));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"pretest": "jscs lib/ src/ spec/",
|
||||||
"test": "karma start --single-run"
|
"test": "karma start --single-run"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
@ -27,7 +28,6 @@
|
|||||||
"gulp-front-matter": "^1.3.0",
|
"gulp-front-matter": "^1.3.0",
|
||||||
"gulp-hb": "^5.0.1",
|
"gulp-hb": "^5.0.1",
|
||||||
"gulp-help": "^1.6.1",
|
"gulp-help": "^1.6.1",
|
||||||
"gulp-jscs": "^4.0.0",
|
|
||||||
"gulp-notify": "^2.0.1",
|
"gulp-notify": "^2.0.1",
|
||||||
"gulp-rename": "^1.2.2",
|
"gulp-rename": "^1.2.2",
|
||||||
"gulp-sass": "^2.1.1",
|
"gulp-sass": "^2.1.1",
|
||||||
@ -35,6 +35,7 @@
|
|||||||
"handlebars-layouts": "^3.1.2",
|
"handlebars-layouts": "^3.1.2",
|
||||||
"imports-loader": "^0.6.5",
|
"imports-loader": "^0.6.5",
|
||||||
"jasmine-core": "^2.4.1",
|
"jasmine-core": "^2.4.1",
|
||||||
|
"jscs": "^3.0.7",
|
||||||
"karma": "^1.1.2",
|
"karma": "^1.1.2",
|
||||||
"karma-firefox-launcher": "^1.0.0",
|
"karma-firefox-launcher": "^1.0.0",
|
||||||
"karma-jasmine": "^1.0.2",
|
"karma-jasmine": "^1.0.2",
|
||||||
|
Loading…
Reference in New Issue
Block a user