Explorar el Código

Moved jscs and jshint config out of gruntfile.js.

fredck hace 11 años
padre
commit
2af6b8dacd
Se han modificado 3 ficheros con 75 adiciones y 76 borrados
  1. 68 0
      dev/tasks/jscs-config.json
  2. 1 0
      dev/tasks/jshint-config.json
  3. 6 76
      gruntfile.js

+ 68 - 0
dev/tasks/jscs-config.json

@@ -0,0 +1,68 @@
+{
+	"excludeFiles": [
+		"node_modules/*"
+	],
+	"requireCurlyBraces": [
+		"if", "else", "for", "while", "do", "switch", "try", "catch"
+	],
+	"requireSpaceAfterKeywords": [
+		"if", "else", "for", "while", "do", "switch", "return", "try", "catch"
+	],
+	"requireSpaceBeforeBlockStatements": true,
+	"requireParenthesesAroundIIFE": true,
+	"requireSpacesInConditionalExpression": {
+		"afterTest": true,
+		"beforeConsequent": true,
+		"afterConsequent": true,
+		"beforeAlternate": true
+	},
+	"requireSpacesInFunctionExpression": {
+		"beforeOpeningCurlyBrace": true
+	},
+	"disallowSpacesInFunctionExpression": {
+		"beforeOpeningRoundBrace": true
+	},
+	"requireBlocksOnNewline": true,
+	"requireSpacesInsideObjectBrackets": "all",
+	"requireSpacesInsideArrayBrackets": "all",
+	"disallowSpaceAfterObjectKeys": true,
+	"requireCommaBeforeLineBreak": true,
+	"requireOperatorBeforeLineBreak": [
+		"?", "=", "+", "-", "/", "*", "==", "===", "!=", "!==", ">", ">=", "<", "<=", "|", "||", "&", "&&", "^", "+=", "*=",
+		"-=", "/=", "^="
+	],
+	"requireSpaceBeforeBinaryOperators": [
+		"+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<=", "|", "||", "&", "&&", "^", "+=", "*=", "-=",
+		"/=", "^="
+	],
+	"requireSpaceAfterBinaryOperators": [
+		"+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<=", "|", "||", "&", "&&", "^", "+=", "*=", "-=",
+		"/=", "^="
+	],
+	"disallowSpaceAfterPrefixUnaryOperators": [
+		"++", "--", "+", "-", "~", "!"
+	],
+	"disallowSpaceBeforePostfixUnaryOperators": [
+		"++", "--"
+	],
+	"disallowKeywords": [
+		"with"
+	],
+	"validateLineBreaks": "LF",
+	"validateQuoteMarks": {
+		"mark": "'",
+		"escape": true
+	},
+	"validateIndentation": "\t",
+	"disallowMixedSpacesAndTabs": true,
+	"disallowTrailingWhitespace": true,
+	"disallowKeywordsOnNewLine": [
+		"else", "catch"
+	],
+	"maximumLineLength": 120,
+	"safeContextKeyword": [
+		"that"
+	],
+	"requireDotNotation": true,
+	"disallowYodaConditions": true
+}

+ 1 - 0
dev/tasks/jshint-config.json

@@ -0,0 +1 @@
+{}

+ 6 - 76
gruntfile.js

@@ -4,12 +4,16 @@ module.exports = function( grunt ) {
 
 		jshint: {
 			files: [ '*.js' ],
-			options: jshintConfig
+			options: {
+				jshintrc: 'dev/tasks/jshint-config.json'
+			}
 		},
 
 		jscs: {
 			src: '*.js',
-			options: jscsConfig
+			options: {
+				config: 'dev/tasks/jscs-config.json'
+			}
 		},
 
 		githooks: {
@@ -25,77 +29,3 @@ module.exports = function( grunt ) {
 	// Default tasks.
 	grunt.registerTask( 'default', [ 'jshint', 'jscs' ] );
 };
-
-// Configurations for JSHint
-var jshintConfig = {
-};
-
-// Configurations for JSCS (JavaScript Code Style checker)
-var jscsConfig = {
-	'excludeFiles': [
-		'node_modules/*'
-	],
-	'requireCurlyBraces': [
-		'if', 'else', 'for', 'while', 'do', 'switch', 'try', 'catch'
-	],
-	'requireSpaceAfterKeywords': [
-		'if', 'else', 'for', 'while', 'do', 'switch', 'return', 'try', 'catch'
-	],
-	'requireSpaceBeforeBlockStatements': true,
-	'requireParenthesesAroundIIFE': true,
-	'requireSpacesInConditionalExpression': {
-		'afterTest': true,
-		'beforeConsequent': true,
-		'afterConsequent': true,
-		'beforeAlternate': true
-	},
-	'requireSpacesInFunctionExpression': {
-		'beforeOpeningCurlyBrace': true
-	},
-	'disallowSpacesInFunctionExpression': {
-		'beforeOpeningRoundBrace': true
-	},
-	'requireBlocksOnNewline': true,
-	'requireSpacesInsideObjectBrackets': 'all',
-	'requireSpacesInsideArrayBrackets': 'all',
-	'disallowSpaceAfterObjectKeys': true,
-	'requireCommaBeforeLineBreak': true,
-	'requireOperatorBeforeLineBreak': [
-		'?', '=', '+', '-', '/', '*', '==', '===', '!=', '!==', '>', '>=', '<', '<=', '|', '||', '&', '&&', '^', '+=', '*=',
-		'-=', '/=', '^='
-	],
-	'requireSpaceBeforeBinaryOperators': [
-		'+', '-', '/', '*', '=', '==', '===', '!=', '!==', '>', '>=', '<', '<=', '|', '||', '&', '&&', '^', '+=', '*=', '-=',
-		'/=', '^='
-	],
-	'requireSpaceAfterBinaryOperators': [
-		'+', '-', '/', '*', '=', '==', '===', '!=', '!==', '>', '>=', '<', '<=', '|', '||', '&', '&&', '^', '+=', '*=', '-=',
-		'/=', '^='
-	],
-	'disallowSpaceAfterPrefixUnaryOperators': [
-		'++', '--', '+', '-', '~', '!'
-	],
-	'disallowSpaceBeforePostfixUnaryOperators': [
-		'++', '--'
-	],
-	'disallowKeywords': [
-		'with'
-	],
-	'validateLineBreaks': 'LF',
-	'validateQuoteMarks': {
-		'mark': '\'',
-		'escape': true
-	},
-	'validateIndentation': '\t',
-	'disallowMixedSpacesAndTabs': true,
-	'disallowTrailingWhitespace': true,
-	'disallowKeywordsOnNewLine': [
-		'else', 'catch'
-	],
-	'maximumLineLength': 120,
-	'safeContextKeyword': [
-		'that'
-	],
-	'requireDotNotation': true,
-	'disallowYodaConditions': true
-};