-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.jscsrc
133 lines (126 loc) · 4.11 KB
/
.jscsrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/**
* Adheres to Google's JavaScript style guide, unless otherwise noted.
*
* @see https://google.github.io/styleguide/javascriptguide.xml
*/
{
"requireCurlyBraces": [
"if",
"else",
"for",
"while",
"do",
"try",
"catch"
],
"requireOperatorBeforeLineBreak": true,
"requireCamelCaseOrUpperCaseIdentifiers": true,
"maximumLineLength": {
"value": 150, // 80 characters is the default. We aren't on teletype machines or using VIM all day.
"allExcept": ["comments", "regex"]
},
"validateIndentation": 2,
"validateQuoteMarks": "'",
"disallowMultipleLineStrings": true,
"disallowMixedSpacesAndTabs": true,
"disallowTrailingWhitespace": true,
"disallowSpaceAfterPrefixUnaryOperators": true,
/**
* "disallowMultipleVarDecl" - the reason behind this change demands a bit of elaboration.
*
* `true` is the default value. Forcing every var to be declared separately is generally a good thing, but can
* make the code unnecessarily cumbersome in some circumstances. Consider the following case:
*
* var buffer, fs, stream;
* var name, png;
*
* Here, we can see two, logically grouped sets of undefined variables. It demonstrates purpose in just two lines
* and is easy to refactor. This is preferred over the stricter Google standard, which would look like this:
*
* var buffer;
* var fs;
* var name;
* var png;
* var stream;
*
* Our screens are wider than they are long! And each variable here averages about 4 characters in length.
* All that said, we still generally want to adopt the Google standard, and declare variables separately:
*
* var someVariable;
* var anotherVariable;
* var aThirdVariable = 'foo';
* var aFourthVariable;
* var aFifthVariable = 'bar';
*
* The benefits for breaking it up like this as opposed to using a single `var` statement are not superfluous,
* and are well depicted here: http://benalman.com/news/2012/05/multiple-var-statements-javascript/
*/
"disallowMultipleVarDecl": {
"allExcept": ["undefined"]
},
"disallowKeywordsOnNewLine": ["else"],
"requireSpaceAfterKeywords": [
"if",
"else",
"for",
"while",
"do",
"switch",
"return",
"try",
"catch"
],
"requireSpaceBeforeBinaryOperators": [
"=", "+=", "-=", "*=", "/=", "%=", "<<=", ">>=", ">>>=",
"&=", "|=", "^=", "+=",
"+", "-", "*", "/", "%", "<<", ">>", ">>>", "&",
"|", "^", "&&", "||", "===", "==", ">=",
"<=", "<", ">", "!=", "!=="
],
"requireSpaceAfterBinaryOperators": true,
"requireSpacesInConditionalExpression": true,
"requireSpaceBeforeBlockStatements": true,
"requireSpacesInForStatement": true,
"requireLineFeedAtFileEnd": true,
"requireSpacesInFunctionExpression": {
"beforeOpeningCurlyBrace": true
},
"disallowSpacesInAnonymousFunctionExpression": {
"beforeOpeningRoundBrace": true
},
"disallowSpacesInsideObjectBrackets": "all",
"disallowSpacesInsideArrayBrackets": "all",
"disallowSpacesInsideParentheses": true,
"disallowMultipleLineBreaks": true,
"disallowNewlineBeforeBlockStatements": true,
"disallowKeywords": ["with"],
"disallowSpacesInFunctionExpression": {
"beforeOpeningRoundBrace": true
},
"disallowSpacesInFunctionDeclaration": {
"beforeOpeningRoundBrace": true
},
"disallowSpacesInCallExpression": true,
"disallowSpaceAfterObjectKeys": true,
"requireSpaceBeforeObjectValues": true,
"requireCapitalizedConstructors": true,
"requireDotNotation": true,
"requireSemicolons": true,
"validateParameterSeparator": ", ",
// We don't have docs set up yet
"jsDoc": false
/**
"jsDoc": {
"checkAnnotations": "closurecompiler",
"checkParamNames": true,
"requireParamTypes": true,
"checkRedundantParams": true,
"checkReturnTypes": true,
"checkRedundantReturns": true,
"requireReturnTypes": true,
"checkTypes": true,
"checkRedundantAccess": true,
"requireNewlineAfterDescription": true
}
*/
}