-
Notifications
You must be signed in to change notification settings - Fork 0
/
.jscsrc
93 lines (81 loc) · 3.05 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
// Author: Ian Stewart
// JSCS ^1.5.9
//
// Derived from AirBnB + LinkedIn Idiomatic + Crockford
// https://github.com/airbnb/javascript
// https://github.com/linkedin/idiomatic.js (Idiomatic fork with Crockford inner spacing)
// http://javascript.crockford.com/code.html
{
// Keywords
"requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch"],
"disallowKeywords": ["with", "eval"],
// Functions
"requireParenthesesAroundIIFE": true,
"disallowSpacesInNamedFunctionExpression": {
"beforeOpeningRoundBrace": true
},
"requireSpacesInAnonymousFunctionExpression": {
"beforeOpeningRoundBrace": true
},
// Blocks
"disallowEmptyBlocks": true,
"disallowNewlineBeforeBlockStatements": true,
"requireSpaceBeforeBlockStatements": true,
// Curlies, brackets, parens
"disallowSpaceAfterObjectKeys": true,
"requireSpacesInsideObjectBrackets": "allButNested",
"disallowSpacesInsideArrayBrackets": true,
"disallowSpacesInsideParentheses": true,
"requireCurlyBraces": ["for", "while", "do", "try", "catch"],
// Line breaking
"requireCommaBeforeLineBreak": true,
"requireOperatorBeforeLineBreak": ["+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="],
"disallowMultipleLineBreaks": true,
// Unary operators
"disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"],
"disallowSpaceBeforePostfixUnaryOperators": ["++", "--"],
// Binary operators
"disallowSpaceBeforeBinaryOperators": [","],
"requireSpaceBeforeBinaryOperators": ["?", "+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<=", "&&", "||"],
"requireSpaceAfterBinaryOperators": [",", "?", "+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<=", "&&", "||"],
// Ternary operator
"requireSpacesInConditionalExpression": {
"afterTest": true,
"beforeConsequent": true,
"afterConsequent": true,
"beforeAlternate": true
},
// Per-line whitespace
"validateIndentation": 2,
"disallowTrailingWhitespace": true,
"requireLineFeedAtFileEnd": true,
// Do not allow reassignment of "this" (prefer bind instead)
"safeContextKeyword": "bind",
// Misc
"disallowMultipleLineStrings": true,
"requireDotNotation": true,
"requireSpaceAfterLineComment": true,
"disallowYodaConditions": true,
"disallowTrailingComma": true,
// JSHint formatting
"requireCapitalizedConstructors": true,
"maximumLineLength": 100,
"validateQuoteMarks": { "mark": "'", "escape": true },
"requireCamelCaseOrUpperCaseIdentifiers": true,
"disallowMultipleVarDecl": true
// TODOs (require new JSCS development)
// - disallow "}else", require "} else"
// - disallow "{ a:1 }", require "{ a: 1 }"
// - allow
// if (true) doThis();
// if (true) {
// doThis();
// }
// disallow
// if (true)
// doThis();
// - disallowMultipleVarDecl: option to except multiple vars without assignments
// allow: var one, two, three;
// disallow: var one = 1, two = 2, three = 3;
// - disallow "test() ;", require "test();"
}