| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- module.exports = function( grunt ) {
- grunt.initConfig( {
- pkg: grunt.file.readJSON( 'package.json' ),
- jshint: {
- files: [ '*.js' ],
- options: jshintConfig
- },
- jscs: {
- src: '*.js',
- options: jscsConfig
- }
- } );
- grunt.loadNpmTasks( 'grunt-contrib-jshint' );
- grunt.loadNpmTasks( 'grunt-jscs' );
- // 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
- };
|