Skip to content

Instantly share code, notes, and snippets.

@tbranyen
Created February 10, 2014 19:43
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tbranyen/8922785 to your computer and use it in GitHub Desktop.
Save tbranyen/8922785 to your computer and use it in GitHub Desktop.
My JSCS style configuration.
{
"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
Copy link

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?

@tbranyen
Copy link
Author

@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.

@michael-benin-CN
Copy link

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.

@michael-benin-CN
Copy link

After talking to a coworker, apparently JSHint is removing a lot of functionality, and that is being replaced by this.

@tbranyen
Copy link
Author

@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