From 6dcfccb32c79019f16a2c97ad50cbcc81f61095c Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Wed, 29 Jan 2014 14:21:26 -0800 Subject: [PATCH 1/5] chore(grunt): sort the grunt task load statements --- Gruntfile.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 1ec4d66a6afa..721bc16e54bd 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -6,15 +6,15 @@ module.exports = function(grunt) { //grunt plugins grunt.loadNpmTasks('grunt-bump'); grunt.loadNpmTasks('grunt-contrib-clean'); - grunt.loadNpmTasks('grunt-contrib-copy'); grunt.loadNpmTasks('grunt-contrib-connect'); grunt.loadNpmTasks('grunt-contrib-compress'); - grunt.loadNpmTasks('grunt-jasmine-node'); + grunt.loadNpmTasks('grunt-contrib-copy'); + grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-ddescribe-iit'); + grunt.loadNpmTasks('grunt-jasmine-node'); grunt.loadNpmTasks('grunt-merge-conflict'); grunt.loadNpmTasks('grunt-parallel'); grunt.loadNpmTasks('grunt-shell'); - grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadTasks('lib/grunt'); var NG_VERSION = util.getVersion(); From fa691f5fb893cb8e499a84f655c92d2c5bc69bc9 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Thu, 30 Jan 2014 10:51:10 -0800 Subject: [PATCH 2/5] chore(build): add jscs code style check to our build --- .jscs.json | 3 +++ .jscs.json.todo | 22 ++++++++++++++++++++++ Gruntfile.js | 10 +++++++++- package.json | 4 +++- 4 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 .jscs.json create mode 100644 .jscs.json.todo diff --git a/.jscs.json b/.jscs.json new file mode 100644 index 000000000000..e2307d167704 --- /dev/null +++ b/.jscs.json @@ -0,0 +1,3 @@ +{ + "disallowKeywords": ["with"] +} diff --git a/.jscs.json.todo b/.jscs.json.todo new file mode 100644 index 000000000000..de551fbdd652 --- /dev/null +++ b/.jscs.json.todo @@ -0,0 +1,22 @@ +// This is an incomplete TODO list of checks we want to start enforcing +// +// The goal is to enable this checks one by one into .jscs.json along with commits that +// correct the existing code-base issues and make the check pass. + +{ + "requireCurlyBraces": ["if", "else", "for", "while", "do", "try", "catch"], + "requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch"], + "disallowLeftStickedOperators": ["?", "+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="], + "disallowRightStickedOperators": ["?", "+", "/", "*", ":", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="], + "requireRightStickedOperators": ["!"], + "requireLeftStickedOperators": [","], + "disallowImplicitTypeConversion": ["string"], + "disallowMultipleLineBreaks": true, + "disallowKeywordsOnNewLine": ["else"], + "disallowTrailingWhitespace": true, + "requireLineFeedAtFileEnd": true, + "validateJSDoc": { + "checkParamNames": true, + "requireParamTypes": true + } +} diff --git a/Gruntfile.js b/Gruntfile.js index 721bc16e54bd..d66f66207ee7 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -12,6 +12,7 @@ module.exports = function(grunt) { grunt.loadNpmTasks('grunt-contrib-jshint'); grunt.loadNpmTasks('grunt-ddescribe-iit'); grunt.loadNpmTasks('grunt-jasmine-node'); + grunt.loadNpmTasks("grunt-jscs-checker"); grunt.loadNpmTasks('grunt-merge-conflict'); grunt.loadNpmTasks('grunt-parallel'); grunt.loadNpmTasks('grunt-shell'); @@ -145,6 +146,13 @@ module.exports = function(grunt) { } }, + jscs: { + src: ['src/**/*.js', 'test/**/*.js'], + options: { + config: ".jscs.json" + } + }, + build: { scenario: { dest: 'build/angular-scenario.js', @@ -301,6 +309,6 @@ module.exports = function(grunt) { grunt.registerTask('webserver', ['connect:devserver']); grunt.registerTask('package', ['bower','clean', 'buildall', 'minall', 'collect-errors', 'docs', 'copy', 'write', 'compress']); grunt.registerTask('package-without-bower', ['clean', 'buildall', 'minall', 'collect-errors', 'docs', 'copy', 'write', 'compress']); - grunt.registerTask('ci-checks', ['ddescribe-iit', 'merge-conflict', 'jshint']); + grunt.registerTask('ci-checks', ['ddescribe-iit', 'merge-conflict', 'jshint', 'jscs']); grunt.registerTask('default', ['package']); }; diff --git a/package.json b/package.json index eeec930e7f03..7edcd9f46349 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,9 @@ "grunt-shell": "~0.4.0", "semver": "~2.1.0", "lodash": "~2.1.0", - "browserstacktunnel-wrapper": "~1.1.1" + "browserstacktunnel-wrapper": "~1.1.1", + "jscs": "~1.2.4", + "grunt-jscs-checker": "~0.3.2" }, "licenses": [ { From c16c779e5c2b1cc0488db7b6ecc7601e95f1ff03 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Thu, 30 Jan 2014 11:04:09 -0800 Subject: [PATCH 3/5] WIP: fix grunt dependency issue --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7edcd9f46349..591cf8583554 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "url": "https://github.com/angular/angular.js.git" }, "devDependencies": { - "grunt": "~0.4.1", + "grunt": "~0.4.2", "bower": "~1.2.2", "grunt-bump": "~0.0.13", "grunt-contrib-clean": "~0.5.0", From 082701f6f72f4cf507466e2a8b236096719bb171 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Thu, 30 Jan 2014 11:15:24 -0800 Subject: [PATCH 4/5] WIP: fix typo --- .jscs.json.todo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.jscs.json.todo b/.jscs.json.todo index de551fbdd652..1a5cb5bb5148 100644 --- a/.jscs.json.todo +++ b/.jscs.json.todo @@ -1,6 +1,6 @@ // This is an incomplete TODO list of checks we want to start enforcing // -// The goal is to enable this checks one by one into .jscs.json along with commits that +// The goal is to enable this checks one by one by moving them to .jscs.json along with commits that // correct the existing code-base issues and make the check pass. { From 0e6424ad3fe4f03ccd362b3ddd79f2a230424d74 Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Thu, 30 Jan 2014 11:16:17 -0800 Subject: [PATCH 5/5] WIP: remove more typos --- .jscs.json.todo | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.jscs.json.todo b/.jscs.json.todo index 1a5cb5bb5148..6f6f041672c2 100644 --- a/.jscs.json.todo +++ b/.jscs.json.todo @@ -1,7 +1,7 @@ // This is an incomplete TODO list of checks we want to start enforcing // -// The goal is to enable this checks one by one by moving them to .jscs.json along with commits that -// correct the existing code-base issues and make the check pass. +// The goal is to enable these checks one by one by moving them to .jscs.json along with commits +// that correct the existing code base issues and make the new check pass. { "requireCurlyBraces": ["if", "else", "for", "while", "do", "try", "catch"],