Skip to content

Commit

Permalink
Add JSCS JavaScript code style checker to build
Browse files Browse the repository at this point in the history
  • Loading branch information
XhmikosR authored and alrra committed Oct 14, 2014
1 parent f3a94f5 commit f2d9182
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 5 deletions.
67 changes: 67 additions & 0 deletions .jscsrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
{
"disallowEmptyBlocks": true,
"disallowKeywords": [
"with"
],
"disallowMixedSpacesAndTabs": true,
"disallowMultipleLineStrings": true,
"disallowMultipleVarDecl": true,
"disallowSpaceAfterPrefixUnaryOperators": [
"!",
"+",
"++",
"-",
"--",
"~"
],
"disallowSpaceBeforeBinaryOperators": [
","
],
"disallowSpaceBeforePostfixUnaryOperators": true,
"disallowSpacesInNamedFunctionExpression": {
"beforeOpeningRoundBrace": true
},
"disallowSpacesInsideArrayBrackets": true,
"disallowSpacesInsideParentheses": true,
"disallowTrailingComma": true,
"disallowTrailingWhitespace": true,
"requireCamelCaseOrUpperCaseIdentifiers": true,
"requireCapitalizedConstructors": true,
"requireCommaBeforeLineBreak": true,
"requireCurlyBraces": true,
"requireDotNotation": true,
"requireLineFeedAtFileEnd": true,
"requireParenthesesAroundIIFE": true,
"requireSpaceAfterBinaryOperators": true,
"requireSpaceAfterKeywords": [
"catch",
"do",
"else",
"for",
"if",
"return",
"switch",
"try",
"while"
],
"requireSpaceAfterLineComment": true,
"requireSpaceBeforeBinaryOperators": true,
"requireSpaceBeforeBlockStatements": true,
"requireSpacesInAnonymousFunctionExpression": {
"beforeOpeningCurlyBrace": true
},
"requireSpacesInConditionalExpression": true,
"requireSpacesInFunctionDeclaration": {
"beforeOpeningCurlyBrace": true
},
"requireSpacesInFunctionExpression": {
"beforeOpeningCurlyBrace": true
},
"requireSpacesInNamedFunctionExpression": {
"beforeOpeningCurlyBrace": true
},
"requireSpacesInsideObjectBrackets": "allButNested",
"validateIndentation": 4,
"validateParameterSeparator": ", ",
"validateQuoteMarks": "'"
}
11 changes: 6 additions & 5 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,13 @@ gulp.task('copy:normalize', function () {
.pipe(gulp.dest(template('<%= dist %>/css', dirs)));
});

gulp.task('jshint', function () {
gulp.task('lint:js', function () {
return gulp.src([
'gulpfile.js',
template('<%= test %>/*.js', dirs),
template('<%= src %>/js/*.js', dirs)
]).pipe(plugins.jshint())
template('<%= src %>/js/*.js', dirs),
template('<%= test %>/*.js', dirs)
]).pipe(plugins.jscs())
.pipe(plugins.jshint())
.pipe(plugins.jshint.reporter('jshint-stylish'))
.pipe(plugins.jshint.reporter('fail'));
});
Expand All @@ -151,7 +152,7 @@ gulp.task('archive', function (done) {

gulp.task('build', function (done) {
runSequence(
['clean', 'jshint'],
['clean', 'lint:js'],
'copy',
done);
});
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"glob": "^4.0.6",
"gulp": "^3.8.8",
"gulp-header": "^1.1.1",
"gulp-jscs": "^1.1.2",
"gulp-jshint": "^1.8.5",
"gulp-load-plugins": "^0.7.0",
"gulp-rename": "^1.2.0",
Expand Down

0 comments on commit f2d9182

Please sign in to comment.