Last active
August 29, 2015 14:06
-
-
Save bryanforbes/f5f6c13824e0237817de to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"requireCurlyBraces": [ | |
"if", "else", "for", "while", "do", "try", | |
"catch" | |
], | |
"requireSpaceAfterKeywords": [ | |
"if", "else", "for", "while", "do", "switch", | |
"return", "try", "catch" | |
], | |
"requireSpaceBeforeBlockStatements": true, | |
"requireParenthesesAroundIIFE": true, | |
"requireSpacesInConditionalExpression": true, | |
"requireSpacesInAnonymousFunctionExpression": { | |
"beforeOpeningRoundBrace": true, | |
"beforeOpeningCurlyBrace": true | |
}, | |
"requireSpacesInNamedFunctionExpression": { | |
"beforeOpeningCurlyBrace": true | |
}, | |
"disallowSpacesInNamedFunctionExpression": { | |
"beforeOpeningRoundBrace": true | |
}, | |
"requireSpacesInFunctionDeclaration": { | |
"beforeOpeningCurlyBrace": true | |
}, | |
"disallowSpacesInFunctionDeclaration": { | |
"beforeOpeningRoundBrace": true | |
}, | |
"disallowMultipleVarDecl": true, | |
"requireBlocksOnNewline": true, | |
"disallowEmptyBlocks": true, | |
"requireSpacesInsideObjectBrackets": "allButNested", | |
"requireSpacesInsideArrayBrackets": "allButNested", | |
"disallowQuotedKeysInObjects": "allButReserved", | |
"disallowSpaceAfterObjectKeys": true, | |
"requireCommaBeforeLineBreak": true, | |
"requireOperatorBeforeLineBreak": true, | |
"disallowSpaceAfterPrefixUnaryOperators": true, | |
"disallowSpaceBeforePostfixUnaryOperators": true, | |
"requireSpaceBeforeBinaryOperators": true, | |
"requireSpaceAfterBinaryOperators": true, | |
"disallowImplicitTypeConversion": [ | |
"binary" | |
], | |
"requireCamelCaseOrUpperCaseIdentifiers": true, | |
"disallowKeywords": [ | |
"with" | |
], | |
"disallowMultipleLineStrings": true, | |
"disallowMultipleLineBreaks": true, | |
"validateQuoteMarks": { | |
"mark": "'", | |
"escape": true | |
}, | |
"validateIndentation": "\t", | |
"disallowMixedSpacesAndTabs": "smart", | |
"disallowTrailingWhitespace": true, | |
"disallowTrailingComma": true, | |
"requireKeywordsOnNewLine": [ | |
"else" | |
], | |
"requireLineFeedAtFileEnd": true, | |
"maximumLineLength": 120, | |
"requireCapitalizedConstructors": true, | |
"requireDotNotation": true, | |
"disallowYodaConditions": true, | |
"requireSpaceAfterLineComment": true | |
} |
A couple more comments:
- Scratch what I said above about
allButNested
, I see why it's useful now (e.g.[{ ... }]
... mysteriously though, it's not working for me locally :/- Oh, whoops,
allButNested
only covers arrays-in-arrays and objects-in-objects. See jscs-dev/node-jscs#111
- Oh, whoops,
- Seems to me that
requireSpaceAfterLineComment
gripes at dojo-doc style comments because apparently it considers tab to not be spacey enough. I had to remove it when testing this against dgrid.- Yup... jscs-dev/node-jscs#592
Thanks for the suggestions, Ken. I have updated them all except for the following:
- I'd like more input on
"disallowMultipleLineBreaks": true
before removing it. - Since git takes care of line break normalization, I'd rather not add
"validateLineBreaks": "LF"
.
Some other comments:
- The
"disallowSpaceBeforeBinaryOperators": [ ":" ]
rule was to get around a bug in jscs which has since been fixed. - The exact reason I chose
escape: true
forvalidateQuoteMarks
was for locale strings.
Once the two issues you noted get resolved, I think this config file is good to go.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
disallowMultipleVarDecl
, I'd suggest adding:allButNested
vs. just plainall
for requiring spaces inside object/array brackets."disallowSpaceBeforeBinaryOperators": [ ":" ]
intending to accomplish? (There's already a rule about colons between object keys/values...is this affecting that?)requireSpaceAfterBinaryOperators
, I'd suggest adding"disallowImplicitTypeConversion": ["binary"]
"disallowMultipleLineBreaks": true
. Although it's rare, it can help make things more readable, and it seems like an odd thing to disallow."validateLineBreaks": "LF"
?escape: true
forvalidateQuoteMarks
. I think I'd be willing to agree with it - e.g. single quotes get really annoying really fast for locale strings."disallowMixedSpacesAndTabs": "smart"
is somewhat more lenient than we'd like, but I guess there's no better alternative, iftrue
is going to get in the way of jsdoc / dojodoc comments.requireKeywordsOnNewLine
, should we add"requireLineFeedAtFileEnd": true
? This would match our style guide."disallowNewlineBeforeBlockStatements": true