Skip to content

Commit

Permalink
build: introduce jscs checks infrastructure
Browse files Browse the repository at this point in the history
	Closes #99
  • Loading branch information
PK1A committed Mar 14, 2014
1 parent 6604ea4 commit 83663fd
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .jscs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"],
"disallowSpaceBeforePostfixUnaryOperators": ["++", "--"],
"disallowYodaConditions": true
}
41 changes: 41 additions & 0 deletions .jscs.json.todo
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"maximumLineLength": 140,
"requireCamelCaseOrUpperCaseIdentifiers": true,
"requireDotNotation": true,
"requireLeftStickedOperators": [","],
"requireSpaceAfterBinaryOperators": [
"+",
"-",
"/",
"*",
"=",
"==",
"===",
"!=",
"!=="
],
"requireCapitalizedConstructors": true,
"safeContextKeyword": "self",
"requireCurlyBraces": [
"if",
"else",
"for",
"while",
"do",
"try",
"catch",
"case",
"default"
],
"requireSpaceAfterKeywords": [
"if",
"else",
"for",
"while",
"do",
"switch",
"return",
"try",
"catch"
]
}
10 changes: 8 additions & 2 deletions gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,12 @@ module.exports = function (grunt) {
reporters: ['dots', 'saucelabs']
}
},
jscs: {
src: ['hsp/**/*.js', 'public/**/*.js', '!public/**/markdown.js'],
options: {
config: '.jscs.json'
}
},
hspserver: {
port: 8000,
base: __dirname,
Expand Down Expand Up @@ -258,7 +264,7 @@ module.exports = function (grunt) {
grunt.registerTask('prepublish', ['peg']);
grunt.registerTask('package', ['prepublish', 'browserify', 'atpackager', 'uglify']);
grunt.registerTask('mocha', ['peg', 'mochaTest']);
grunt.registerTask('test', ['checkStyle', 'mocha', 'karma:unit']);
grunt.registerTask('ci', ['checkStyle', 'mocha', 'karma:ci', 'package']);
grunt.registerTask('test', ['checkStyle', 'jscs', 'mocha', 'karma:unit']);
grunt.registerTask('ci', ['checkStyle', 'jscs', 'mocha', 'karma:ci', 'package']);
grunt.registerTask('default', ['hspserver']);
};
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
"load-grunt-tasks": "~0.2.1",
"expect.js": "0.2.0",
"noder-js": "~1.2.0",
"jquery": "~1.11.0"
"jquery": "~1.11.0",
"grunt-jscs-checker": "~0.4.0"
},
"scripts": {
"test": "grunt test",
Expand Down

0 comments on commit 83663fd

Please sign in to comment.