Add JSCS support.
authorXhmikosR <xhmikosr@users.sourceforge.net>
Sun, 9 Mar 2014 07:47:19 +0000 (09:47 +0200)
committerXhmikosR <xhmikosr@users.sourceforge.net>
Tue, 11 Mar 2014 05:25:02 +0000 (07:25 +0200)
Config taken from fabric.js.

.jscsrc [new file with mode: 0644]
Gruntfile.js
package.json

diff --git a/.jscsrc b/.jscsrc
new file mode 100644 (file)
index 0000000..e33dbf0
--- /dev/null
+++ b/.jscsrc
@@ -0,0 +1,37 @@
+{
+    "requireCurlyBraces": [ "if", "else", "for", "while", "do", "switch", "return", "try", "catch"],
+    "requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch"],
+    "requireSpaceBeforeBinaryOperators": ["+", "-", "*", "=", "==", "===", "!=", "!=="],
+    "requireSpaceAfterBinaryOperators": ["+", "-", "*", "=", "==", "===", "!=", "!=="],
+
+    "requireParenthesesAroundIIFE": true,
+    "requireSpacesInsideObjectBrackets": "all",
+    "requireCommaBeforeLineBreak": true,
+    "requireRightStickedOperators": ["!"],
+    "requireLeftStickedOperators": [","],
+    "requireCamelCaseOrUpperCaseIdentifiers": true,
+    "requireKeywordsOnNewLine": ["else"],
+    "requireLineFeedAtFileEnd": true,
+    "requireCapitalizedConstructors": true,
+    "requireDotNotation": true,
+    "requireMultipleVarDecl": true,
+
+    "disallowEmptyBlocks": true,
+    "disallowQuotedKeysInObjects": "allButReserved",
+    "disallowSpaceAfterObjectKeys": true,
+
+    "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"],
+    "disallowSpaceAfterPrefixUnaryOperators": ["++", "--"],
+
+    "disallowKeywords": ["with"],
+    "disallowMultipleLineStrings": true,
+    "disallowMultipleLineBreaks": true,
+    "disallowMixedSpacesAndTabs": true,
+    "disallowTrailingWhitespace": true,
+
+    "validateLineBreaks": "LF",
+    "validateQuoteMarks": "'",
+    "validateIndentation": 2,
+
+    "safeContextKeyword": "_this"
+}
index eb757f6..6e951b3 100644 (file)
@@ -28,6 +28,24 @@ module.exports = function(grunt) {
       }
     },
 
+    jscs: {
+      options: {
+        config: '.jscsrc'
+      },
+      grunt: {
+        src: '<%= jshint.gruntfile.src %>'
+      },
+      src: {
+        src: '<%= jshint.src.src %>'
+      },
+      tests: {
+        src: '<%= jshint.tests.src %>'
+      },
+      web: {
+        src: '<%= jshint.web.src %>'
+      }
+    },
+
     exec: {
       test: {
         command: 'node ./test.js'
@@ -79,6 +97,7 @@ module.exports = function(grunt) {
   grunt.registerTask('test', [
     'concat',
     'jshint',
+    'jscs',
     'exec'
   ]);
 
index 88803e6..66dddbb 100644 (file)
@@ -44,6 +44,7 @@
     "grunt-contrib-qunit": "0.4.x",
     "grunt-contrib-uglify": "0.3.x",
     "grunt-exec": "0.4.x",
+    "grunt-jscs-checker": "~0.4.0",
     "load-grunt-tasks": "0.3.x",
     "qunit": "0.6.x",
     "time-grunt": "0.2.x"