-
Notifications
You must be signed in to change notification settings - Fork 2
/
.eslintrc.json
188 lines (188 loc) · 4.73 KB
/
.eslintrc.json
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
{
"env": {
"es6": true,
"node": true,
"mocha": true
},
"extends": [
"eslint:recommended",
"plugin:import-order/recommended"
],
"parserOptions": {
"sourceType": "script"
},
"plugins": [
"import-order"
],
"rules": {
"indent": [ // indentation is 2 spaces
"error",
2,
{
"SwitchCase": 1 // indent case clauses with 2 spaces with respect to switch statements
}
],
"strict": [ // use strict mode
"error",
"global"
],
/*"valid-jsdoc": [ // enforce valid JSDoc comments // TODO enable
"error"
],*/
"no-unused-vars": 0, /*[ // TODO enable
"error"
],*/
"no-constant-condition": 0, /*[ // TODO enable
"error"
],*/
"semi": [ // semicolons are required
"error",
"always"
],
"max-len": [ // max line length is 100 chars (except for comments)
"error",
100, {
"ignoreComments": true
}
],
"eol-last": [ // \n is required at the end of the file
"error",
"always"
],
"camelcase": [ // enforce camelcase style for variable names and property names
"error", {
"properties": "always"
}
],
"dot-notation": [ // always use the dot notation to access properties, except if property contains '_'
"error", {
"allowPattern": "^.*_.*$"
}
],
"quotes": [ // use single quotes (or backticks if there is a substitution)
"error",
"single"
],
"comma-dangle": [ // no trailing commas in object or array literals
"error",
"never"
],
"no-multi-str": [ // no multi line strings using \
"error"
],
"no-multiple-empty-lines": [
"error"
],
"no-trailing-spaces": [
"error"
],
"no-mixed-spaces-and-tabs": [
"error"
],
"curly": [ // `if (foo) foo++` is not allowed. Curly braces are always required
"error",
"all"
],
"brace-style": [ // use K&R style
"error",
"1tbs", {
"allowSingleLine": true // `if (foo) {foo++}` is allowed
}
],
"keyword-spacing": [ // in `} else {` both spaces are required (in general, around keywords)
"error", {
"before": true,
"after": true,
"overrides": {
"catch": {
"before": true,
"after": false
}
}
}
],
"space-before-blocks": [ // in `if (foo) {` the second space is required
"error",
"always"
],
"arrow-spacing": [ // in `(foo) => {` both spaces are required
"error", {
"before": true,
"after": true
}
],
"operator-linebreak": [ // linebreak goes after the operator except for '?' and ':'
"error",
"after", {
"overrides": {
"?": "before",
":": "before"
}
}
],
"space-unary-ops": [ // space is required for new, delete, etc. but not for +, -, ++, --, etc.
"error", {
"words": true,
"nonwords": false,
"overrides": {
"typeof": false // also no space for typeof(...)
}
}
],
"space-infix-ops": [ // space is required around infix operators, e.g: 'a + b'
"error"
],
"comma-spacing": [ // space is required after a comma
"error", {
"after": true
}
],
"array-bracket-spacing": [ // '[ x, y ]' is not allowed
"error",
"never"
],
"space-in-parens": [ // '( x + y )' is not allowed, use '(x + y)'
"error",
"never"
],
"key-spacing": [ // `{property :'value'}` is not allowed, use `{property: 'value'}`
"error", {
"beforeColon": false,
"afterColon": true,
"mode": "strict"
}
],
"yoda": [ // disallow yoda conditions, e.g. `(true === foo)`
"error",
"never"
],
"no-with": [ // the with statements is not allowed
"error"
],
"linebreak-style": [ // use unix linebreak '\n'
"error",
"unix"
],
"wrap-iife": [ // require IIFE to be wrapped in parenthesis
"error"
],
"func-call-spacing": [ // no space between the function name and the opening parenthesis on invocation
"error",
"never"
],
"space-before-function-paren": [ // no space between the function name and the opening parenthesis on declaration
"error", {
"anonymous": "never",
"named": "never"
}
],
"no-cond-assign": [ // no assignment operators in if, for and while except if enclosed in parentheses
"error",
"except-parens"
],
"no-console": 0, // `console.log(...)` is allowed
"import-order/import-order": 0 /*[ // enforce import order ("builtin", "external", "parent", "sibling", "index")
"error" // TODO enable
]*/
}
}