From: XhmikosR Date: Sun, 9 Mar 2014 07:47:19 +0000 (+0200) Subject: Add JSCS support. X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=9a485e037953a142eb9a750d15b05b16d3e1bd9e;p=html-minifier.git Add JSCS support. Config taken from fabric.js. --- diff --git a/.jscsrc b/.jscsrc new file mode 100644 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" +} diff --git a/Gruntfile.js b/Gruntfile.js index eb757f6..6e951b3 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -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' ]); diff --git a/package.json b/package.json index 88803e6..66dddbb 100644 --- a/package.json +++ b/package.json @@ -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"