Adding JSCS integration
This commit is contained in:
parent
fdb79beb79
commit
e35be731cc
68
.jscsrc
Normal file
68
.jscsrc
Normal file
@ -0,0 +1,68 @@
|
||||
{
|
||||
"requireCurlyBraces": [
|
||||
"if",
|
||||
"else",
|
||||
"for",
|
||||
"while",
|
||||
"do",
|
||||
"try",
|
||||
"catch"
|
||||
],
|
||||
"requireSpaceAfterKeywords": [
|
||||
"if",
|
||||
"else",
|
||||
"for",
|
||||
"while",
|
||||
"do",
|
||||
"switch",
|
||||
"case",
|
||||
"return",
|
||||
"try",
|
||||
"typeof"
|
||||
],
|
||||
"requireSpaceBeforeBlockStatements": true,
|
||||
"requireParenthesesAroundIIFE": true,
|
||||
"requireSpacesInConditionalExpression": true,
|
||||
"disallowSpacesInNamedFunctionExpression": {
|
||||
"beforeOpeningRoundBrace": true
|
||||
},
|
||||
"disallowSpacesInFunctionDeclaration": {
|
||||
"beforeOpeningRoundBrace": true
|
||||
},
|
||||
"requireSpaceBetweenArguments": true,
|
||||
"requireMultipleVarDecl": "onevar",
|
||||
"requireVarDeclFirst": true,
|
||||
"requireBlocksOnNewline": true,
|
||||
"disallowEmptyBlocks": true,
|
||||
"disallowSpacesInsideArrayBrackets": true,
|
||||
"disallowSpacesInsideParentheses": true,
|
||||
"requireCommaBeforeLineBreak": true,
|
||||
"disallowSpaceAfterPrefixUnaryOperators": true,
|
||||
"disallowSpaceBeforePostfixUnaryOperators": true,
|
||||
"disallowSpaceBeforeBinaryOperators": [
|
||||
","
|
||||
],
|
||||
"requireSpacesInForStatement": true,
|
||||
"requireSpacesInAnonymousFunctionExpression": {
|
||||
"beforeOpeningCurlyBrace": true
|
||||
},
|
||||
"requireSpaceBeforeBinaryOperators": true,
|
||||
"requireSpaceAfterBinaryOperators": true,
|
||||
"disallowKeywords": [
|
||||
"with",
|
||||
"continue"
|
||||
],
|
||||
"validateIndentation": 2,
|
||||
"disallowMixedSpacesAndTabs": true,
|
||||
"disallowTrailingWhitespace": true,
|
||||
"disallowTrailingComma": true,
|
||||
"disallowKeywordsOnNewLine": [
|
||||
"else"
|
||||
],
|
||||
"requireLineFeedAtFileEnd": true,
|
||||
"requireCapitalizedConstructors": true,
|
||||
"requireDotNotation": true,
|
||||
"disallowNewlineBeforeBlockStatements": true,
|
||||
"disallowMultipleLineStrings": true,
|
||||
"requireSpaceBeforeObjectValues": true
|
||||
}
|
20
README.md
20
README.md
@ -22,21 +22,13 @@ There are several gulp tasks available to build various parts of the site, but t
|
||||
|
||||
This will build the site into the ./build directory, start a local start on port 8080, and begin watching the source files for modifications. The site will automatically be rebuilt when files are changed. Also, if you browser has the LiveReload extension, then the page will be reloaded.
|
||||
|
||||
To automatically run Karma test, run the following:
|
||||
These other gulp tasks are available:
|
||||
|
||||
$ gulp karma
|
||||
|
||||
To build the site for deployment, run the following:
|
||||
|
||||
$ gulp build
|
||||
|
||||
The site will be built into the ./build directory.
|
||||
|
||||
To build developer documentation, run the following:
|
||||
|
||||
$ gulp docs
|
||||
|
||||
The documentation will be build into the ./docs directory.
|
||||
$ gulp docs # Build documentation into the ./docs directory
|
||||
$ gulp build # Build the site into the ./build directory
|
||||
$ gulp verify # Run JSCS lint and Karma tests
|
||||
$ gulp verify:watch # Run JSCS lint and Karma tests when files change
|
||||
$ gulp lint:fix # Automatically fix some lint errors
|
||||
|
||||
## License
|
||||
|
||||
|
@ -15,8 +15,15 @@ module.exports = {
|
||||
sass: './src/**/*.scss',
|
||||
svg_sass: './src/sass/svg.scss',
|
||||
js: ['./src/**/*.js', './src/**/*.peg'],
|
||||
spec: './spec/**/*_spec.js'
|
||||
spec: './spec/**/*_spec.js',
|
||||
lint: [
|
||||
'./lib/**/*.js',
|
||||
'./src/**/*.js',
|
||||
'./spec/**/*.js',
|
||||
'./*.js'
|
||||
]
|
||||
},
|
||||
lintRoots: ['lib', 'src', 'spec'],
|
||||
browserify: {
|
||||
debug: true,
|
||||
fullPaths: false,
|
||||
|
38
gulpfile.js
38
gulpfile.js
@ -137,6 +137,10 @@ gulp.task('scripts', function() {
|
||||
.pipe(gulp.dest(config.buildPath('js')));
|
||||
});
|
||||
|
||||
gulp.task('verify', ['karma:single', 'lint']);
|
||||
|
||||
gulp.task('verify:watch', ['karma', 'lint:watch']);
|
||||
|
||||
gulp.task('karma', function(done) {
|
||||
var karma = require('karma'),
|
||||
path = require('path'),
|
||||
@ -157,3 +161,37 @@ gulp.task('karma:single', function(done) {
|
||||
|
||||
server.start();
|
||||
});
|
||||
|
||||
gulp.task('lint', function() {
|
||||
var jscs = require('gulp-jscs');
|
||||
|
||||
return gulp.src(config.globs.lint)
|
||||
.pipe(jscs())
|
||||
.pipe(jscs.reporter())
|
||||
.pipe(jscs.reporter('fail'))
|
||||
.on('error', notify.onError())
|
||||
});
|
||||
|
||||
gulp.task('lint:watch', function() {
|
||||
gulp.watch(config.globs.lint, ['lint']);
|
||||
});
|
||||
|
||||
gulp.task('lint:fix', config.lintRoots.map(function(root) {
|
||||
return 'lint:fix:' + root;
|
||||
}), function() {
|
||||
var jscs = require('gulp-jscs');
|
||||
|
||||
return gulp.src('./*.js')
|
||||
.pipe(jscs({fix: true}))
|
||||
.pipe(gulp.dest('.'));
|
||||
});
|
||||
|
||||
config.lintRoots.forEach(function(root) {
|
||||
gulp.task('lint:fix:' + root, function() {
|
||||
var jscs = require('gulp-jscs');
|
||||
|
||||
return gulp.src('./' + root + '/**/*.js')
|
||||
.pipe(jscs({fix: true}))
|
||||
.pipe(gulp.dest('./' + root));
|
||||
});
|
||||
});
|
||||
|
@ -20,6 +20,7 @@
|
||||
"gulp-docco": "0.0.4",
|
||||
"gulp-front-matter": "^1.3.0",
|
||||
"gulp-hb": "^2.6.5",
|
||||
"gulp-jscs": "^3.0.2",
|
||||
"gulp-notify": "^2.0.1",
|
||||
"gulp-rename": "^1.2.2",
|
||||
"gulp-sass": "^2.1.0",
|
||||
|
Loading…
Reference in New Issue
Block a user