]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
integrate JSCS 11761/head
authorChris Rebert <code@rebertia.com>
Sat, 7 Dec 2013 00:51:38 +0000 (16:51 -0800)
committerChris Rebert <code@rebertia.com>
Sat, 7 Dec 2013 01:26:07 +0000 (17:26 -0800)
Gruntfile.js
js/.jscs.json [new file with mode: 0644]
package.json

index 9c8cc854bc42e0ab489689cd8047175d0aacb42a..4e713d7c851e567441d54901c610893df6b3ed14 100644 (file)
@@ -40,6 +40,21 @@ module.exports = function (grunt) {
       }
     },
 
+    jscs: {
+      options: {
+        config: 'js/.jscs.json',
+      },
+      gruntfile: {
+        src: ['Gruntfile.js']
+      },
+      src: {
+        src: ['js/*.js']
+      },
+      test: {
+        src: ['js/tests/unit/*.js']
+      }
+    },
+
     concat: {
       options: {
         banner: '<%= banner %><%= jqueryCheck %>',
@@ -288,6 +303,7 @@ module.exports = function (grunt) {
   grunt.loadNpmTasks('grunt-contrib-watch');
   grunt.loadNpmTasks('grunt-html-validation');
   grunt.loadNpmTasks('grunt-jekyll');
+  grunt.loadNpmTasks('grunt-jscs-checker');
   grunt.loadNpmTasks('grunt-recess');
   grunt.loadNpmTasks('grunt-saucelabs');
   grunt.loadNpmTasks('grunt-sed');
@@ -296,7 +312,7 @@ module.exports = function (grunt) {
   grunt.registerTask('validate-html', ['jekyll', 'validation']);
 
   // Test task.
-  var testSubtasks = ['dist-css', 'jshint', 'qunit', 'validate-html'];
+  var testSubtasks = ['dist-css', 'jshint', 'jscs', 'qunit', 'validate-html'];
   // Only run Sauce Labs tests if there's a Sauce access key
   if (typeof process.env.SAUCE_ACCESS_KEY !== 'undefined') {
     testSubtasks.push('connect');
diff --git a/js/.jscs.json b/js/.jscs.json
new file mode 100644 (file)
index 0000000..2f04d9c
--- /dev/null
@@ -0,0 +1,14 @@
+{
+    "requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return"],
+    "requireSpacesInFunctionExpression": { "beforeOpeningCurlyBrace": true },
+    "disallowLeftStickedOperators": ["?", "+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="],
+    "requireRightStickedOperators": ["!"],
+    "disallowRightStickedOperators": ["?", "/", "*", ":", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="],
+    "disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"],
+    "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"],
+    "requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="],
+    "requireSpaceAfterBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="],
+    "disallowKeywords": ["with"],
+    "validateLineBreaks": "LF",
+    "requireLineFeedAtFileEnd": true
+}
index 813cf1d13592d121ebb1d82e326abb63880c5f7a..3c9fd7fe66ee50ed9142577e48ce914dae0f32a6 100644 (file)
@@ -32,6 +32,7 @@
     , "grunt-contrib-watch": "~0.5.3"
     , "grunt-html-validation": "~0.1.6"
     , "grunt-jekyll": "~0.4.0"
+    , "grunt-jscs-checker": "~0.2.5"
     , "grunt-recess": "~0.5.0"
     , "grunt-saucelabs": "~4.1.2"
     , "grunt-sed": "~0.1.1"