module.exports = function( grunt ) { grunt.initConfig( { pkg: grunt.file.readJSON( 'package.json' ), jshint: { files: [ '*.js' ], options: jshintConfig }, jscs: { src: '*.js', options: jscsConfig }, githooks: { all: { 'pre-commit': 'default' } } } ); // Load all grunt plugins. require( 'load-grunt-tasks' )( 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 };