From: Iskren Chernev Date: Tue, 17 Jun 2014 06:09:12 +0000 (-0700) Subject: Add jscs task with options X-Git-Tag: 2.8.0~28^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6a831a4d5caf52b1cee2fcecfdc8e15aa61e4231;p=thirdparty%2Fmoment.git Add jscs task with options --- diff --git a/.jscs.json b/.jscs.json new file mode 100644 index 000000000..1ce31f827 --- /dev/null +++ b/.jscs.json @@ -0,0 +1,63 @@ +{ + "requireCurlyBraces": [ + "if", + "else", + "for", + "while", + "do", + "try", + "catch" + ], + "requireSpaceAfterKeywords": [ + "if", + "else", + "for", + "while", + "do", + "switch", + "return", + "try", + "catch" + ], + "requireSpaceBeforeBlockStatements": true, + "requireParenthesesAroundIIFE": true, + "requireSpacesInConditionalExpression": true, + "requireSpacesInAnonymousFunctionExpression": { + "beforeOpeningRoundBrace": true, + "beforeOpeningCurlyBrace": true + }, + "requireSpacesInNamedFunctionExpression": { + "beforeOpeningCurlyBrace": true + }, + "disallowSpacesInNamedFunctionExpression": { + "beforeOpeningRoundBrace": true + }, + "requireMultipleVarDecl": "onevar", + "requireBlocksOnNewline": true, + "disallowPaddingNewlinesInBlocks": true, + "disallowEmptyBlocks": true, + "disallowSpacesInsideObjectBrackets": true, + "disallowSpacesInsideArrayBrackets": true, + "disallowSpacesInsideParentheses": true, + "requireCommaBeforeLineBreak": true, + "disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"], + "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"], + "requireSpaceBeforeBinaryOperators": [ + "=", "+=", "-=", "*=", "/=", "%=", "<<=", ">>=", ">>>=", + "&=", "|=", "^=", + + "+", "-", "*", "/", "%", "<<", ">>", ">>>", "&", + "|", "^", "&&", "||", "===", "==", ">=", + "<=", "<", ">", "!=", "!==" + ], + "requireSpaceAfterBinaryOperators": true, + "requireCamelCaseOrUpperCaseIdentifiers": "ignoreProperties", + "disallowKeywords": ["with"], + "disallowMultipleLineStrings": true, + "validateLineBreaks": "LF", + "validateIndentation": 4, + "disallowTrailingWhitespace": true, + "disallowTrailingComma": true, + "requireLineFeedAtFileEnd": true, + "requireCapitalizedConstructors": true +} diff --git a/Gruntfile.js b/Gruntfile.js index 5b2f80407..f486c8551 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -160,6 +160,15 @@ module.exports = function (grunt) { } } }, + jscs: { + all: [ + "Gruntfile.js", "moment.js", "lang/**/*.js", + "test/**/*.js", "!test/browser*.js" + ], + options: { + config: ".jscs.json" + } + }, watch : { test : { files : [ @@ -187,7 +196,7 @@ module.exports = function (grunt) { require('load-grunt-tasks')(grunt); // Default task. - grunt.registerTask('default', ['jshint', 'nodeunit']); + grunt.registerTask('default', ['jshint', 'jscs', 'nodeunit']); //test tasks grunt.registerTask('test', ['test:node', 'test:browser']); @@ -199,8 +208,12 @@ module.exports = function (grunt) { // travis build task grunt.registerTask('build:travis', [ - 'jshint', 'test:node', 'check-sauce-creds', - 'test:travis-sauce-browser' + // code style + 'jshint', 'jscs', + // node tests + 'test:node', + // sauce tests + 'check-sauce-creds', 'test:travis-sauce-browser' ]); // Task to be run when releasing a new version diff --git a/package.json b/package.json index 246543216..6d5d88606 100644 --- a/package.json +++ b/package.json @@ -48,6 +48,7 @@ "grunt-contrib-uglify": "latest", "grunt-contrib-watch": "latest", "grunt-env": "latest", + "grunt-jscs-checker": "latest", "grunt-karma": "latest", "load-grunt-tasks": "latest", "karma": "latest",