| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- 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
- };
|