Created
February 10, 2014 19:43
-
-
Save tbranyen/8922785 to your computer and use it in GitHub Desktop.
My JSCS style configuration.
This file contains hidden or 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
{ | |
"maximumLineLength": 80, | |
"validateJSDoc": { | |
"checkParamNames": true, | |
"checkRedundantParams": true, | |
"requireParamTypes": true | |
}, | |
"validateLineBreaks": "LF", | |
"validateQuoteMarks": true, | |
"validateIndentation": 2, | |
"requireCurlyBraces": [ | |
"if", | |
"else", | |
"for", | |
"while", | |
"do", | |
"try", | |
"catch" | |
], | |
"requireSpaceAfterKeywords": [ | |
"if", | |
"else", | |
"for", | |
"while", | |
"do", | |
"switch", | |
"return", | |
"try", | |
"catch" | |
], | |
"requireOperatorBeforeLineBreak": [ | |
"?", | |
"+", | |
"-", | |
"/", | |
"*", | |
"=", | |
"==", | |
"===", | |
"!=", | |
"!==", | |
">", | |
">=", | |
"<", | |
"<=" | |
], | |
"requireSpaceBeforeBinaryOperators": [ | |
"+", | |
"-", | |
"/", | |
"*", | |
"=", | |
"==", | |
"===", | |
"!=", | |
"!==" | |
], | |
"requireSpaceAfterBinaryOperators": [ | |
"+", | |
"-", | |
"/", | |
"*", | |
"=", | |
"==", | |
"===", | |
"!=", | |
"!==" | |
], | |
"requireRightStickedOperators": [ | |
"!" | |
], | |
"requireLeftStickedOperators": [ | |
"," | |
], | |
"requireKeywordsOnNewLine": [ | |
"else", | |
"catch", | |
"while" | |
], | |
"requireSpacesInFunctionExpression": { | |
"beforeOpeningCurlyBrace": true | |
}, | |
"requireParenthesesAroundIIFE": true, | |
"requireCommaBeforeLineBreak": true, | |
"requireCamelCaseOrUpperCaseIdentifiers": true, | |
"requireCapitalizedConstructors": true, | |
"requireDotNotation": true, | |
"disallowLeftStickedOperators": [ | |
"?", | |
"+", | |
"-", | |
"/", | |
"*", | |
"=", | |
"==", | |
"===", | |
"!=", | |
"!==", | |
">", | |
">=", | |
"<", | |
"<=" | |
], | |
"disallowSpaceAfterPrefixUnaryOperators": [ | |
"++", | |
"--", | |
"+", | |
"-", | |
"~", | |
"!" | |
], | |
"disallowRightStickedOperators": [ | |
"?", | |
"+", | |
"/", | |
"*", | |
":", | |
"=", | |
"==", | |
"===", | |
"!=", | |
"!==", | |
">", | |
">=", | |
"<", | |
"<=" | |
], | |
"disallowSpaceBeforePostfixUnaryOperators": [ | |
"++", | |
"--" | |
], | |
"disallowImplicitTypeConversion": [ | |
"numeric", | |
"boolean", | |
"binary", | |
"string" | |
], | |
"disallowKeywords": [ | |
"with" | |
], | |
"disallowMultipleLineStrings": true, | |
"disallowMultipleLineBreaks": true, | |
"disallowEmptyBlocks": true, | |
"disallowSpacesInsideArrayBrackets": true, | |
"disallowSpacesInsideParentheses": true, | |
"disallowQuotedKeysInObjects": true, | |
"disallowSpaceAfterObjectKeys": true, | |
"disallowTrailingWhitespace": true, | |
"disallowMixedSpacesAndTabs": "smart" | |
} |
@michael-benin-CN it's not checking your code for errors so much as checking it for stylistic problems. It's specifically finding style inconsistencies.
Doesn't JSHint solve that?
I guess what I'm asking is what can this library do that JSHint can't, or what it does better.
After talking to a coworker, apparently JSHint is removing a lot of functionality, and that is being replaced by this.
@michael-benin-CN just check out the options compared to JSHint. JSCS handles things like braces on different lines, IIFE style, jsdoc style, etc. These aren't things that JSHint can handle as it works with an AST.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm new to https://github.com/mdevils/node-jscs
So we should use jscs with jshint and jsvalidate?
I'm confused to the benefits of jscs, what does it catch that jshint and jsvalidate won't?