Authored by xuqi

use eslint

gulpfile.js
\ No newline at end of file
... ...
{
"extends": "yoho"
}
\ No newline at end of file
... ...
{
"disallowEmptyBlocks": true,
"disallowKeywordsOnNewLine": ["else", "else if"],
"disallowKeywords": ["with", "eval"],
"disallowMixedSpacesAndTabs": true,
"disallowMultipleLineStrings": true,
"disallowMultipleSpaces": {"allowEOLComments": true},
"disallowNamedUnassignedFunctions": true,
"disallowNewlineBeforeBlockStatements": true,
"disallowOperatorBeforeLineBreak": ["."],
"disallowQuotedKeysInObjects": true,
"disallowSpaceAfterObjectKeys": true,
"disallowSpaceAfterPrefixUnaryOperators": true,
"disallowSpaceBeforeComma": true,
"disallowSpaceBeforePostfixUnaryOperators": true,
"disallowSpaceBeforeSemicolon": true,
"disallowSpacesInCallExpression": true,
"disallowSpacesInFunction": {
"beforeOpeningRoundBrace": true
},
"disallowSpacesInsideArrayBrackets": true,
"disallowSpacesInsideObjectBrackets": true,
"disallowSpacesInsideParentheses": true,
"disallowTrailingComma": true,
"disallowTrailingWhitespace": true,
"maximumLineLength": 120,
"requireAnonymousFunctions": {
"allExcept": ["declarations"]
},
"requireBlocksOnNewline": {
"includeComments": true
},
"requireCamelCaseOrUpperCaseIdentifiers": "ignoreProperties",
"requireCapitalizedConstructors": true,
"requireCommaBeforeLineBreak": true,
"requireCurlyBraces": [
"if",
"else",
"for",
"while",
"do",
"try",
"catch"
],
"requireDollarBeforejQueryAssignment": true,
"requireDotNotation": true,
"requireLineBreakAfterVariableAssignment": true,
"requireObjectKeysOnNewLine": true,
"requireOperatorBeforeLineBreak": true,
"requirePaddingNewLineAfterVariableDeclaration": true,
"requirePaddingNewLinesBeforeLineComments": true,
"requirePaddingNewLinesInObjects": true,
"requireParenthesesAroundIIFE": true,
"requireSpaceAfterBinaryOperators": true,
"requireSpaceAfterKeywords": [
"do",
"for",
"if",
"else",
"switch",
"case",
"try",
"catch",
"void",
"while",
"with",
"return",
"typeof"
],
"requireSpaceBeforeBinaryOperators": true,
"requireSpaceBeforeBlockStatements": 1,
"requireSpaceBeforeKeywords": [
"else",
"while",
"catch"
],
"requireSpaceBeforeObjectValues": true,
"requireSpaceBetweenArguments": true,
"requireSpacesInAnonymousFunctionExpression": {
"beforeOpeningCurlyBrace": true
},
"requireSpacesInConditionalExpression": {
"afterTest": true,
"beforeConsequent": true,
"afterConsequent": true,
"beforeAlternate": true
},
"requireSpacesInForStatement": true,
"requireSpacesInFunction": {
"beforeOpeningCurlyBrace": true
},
"requireVarDeclFirst": true,
"validateAlignedFunctionParameters": {
"lineBreakAfterOpeningBrace": true,
"lineBreakBeforeClosingBrace": true
},
"validateIndentation": 4,
"validateParameterSeparator": ", ",
"maxErrors": 20
}
{
"asi": false,
"bitwise": false,
"boss": false,
"browser": true,
"couch": false,
"curly": true,
"debug": false,
"devel": true,
"dojo": false,
"eqeqeq": true,
"eqnull": true,
"es3": false,
"esnext": false,
"evil": false,
"expr": true,
"forin": true,
"funcscope": true,
"gcl": false,
"globalstrict": false,
"immed": true,
"iterator": false,
"jquery": false,
"lastsemic": false,
"latedef": true,
"laxbreak": true,
"laxcomma": false,
"loopfunc": false,
"mootools": false,
"moz": false,
"multistr": false,
"newcap": true,
"noarg": true,
"node": true,
"noempty": false,
"nonew": true,
"nonstandard": false,
"nomen": false,
"onecase": false,
"onevar": false,
"passfail": false,
"phantom": false,
"plusplus": false,
"proto": false,
"prototypejs": false,
"regexdash": true,
"regexp": false,
"rhino": false,
"scripturl": true,
"shadow": false,
"shelljs": false,
"smarttabs": true,
"strict": false,
"sub": false,
"supernew": false,
"trailing": true,
"undef": true,
"unused": "vars",
"validthis": true,
"withstmt": false,
"white": true,
"worker": false,
"wsh": false,
"yui": false,
"maxerr": 20,
"predef": ["define", "seajs", "wx"],
"quotmark": "single"
}
... ... @@ -3,7 +3,8 @@
"version": "0.0.0",
"private": true,
"scripts": {
"start": "node ./bin/www"
"start": "node ./bin/www",
"lint": "eslint -c .eslintrc --cache public/**/*.js"
},
"dependencies": {
"body-parser": "~1.13.2",
... ... @@ -14,5 +15,10 @@
"morgan": "~1.6.1",
"request-promise": "^2.0.1",
"serve-favicon": "^2.3.0"
},
"pre-commit": ["lint"],
"devDependencies": {
"eslint-config-yoho": "^0.1.1",
"precommit-hook": "^3.0.0"
}
}
... ...