forked from rlidwka/sinopia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.eslint.js
264 lines (196 loc) · 5.97 KB
/
.eslint.js
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
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
module.exports = {
env: {
node: true,
},
/*
* 0 - disable
* Rules that more harmful than useful, or just buggy.
*
* 1 - warning
* Rules that we didn't encounter yet. You can safely ignore them,
* but I'd like to know any interesting use-cases they forbid.
*
* 2 - error
* Rules that have proven to be useful, please follow them.
*/
rules: {
// didn't understand what it does, but it fails a good code
'block-scoped-var': 0,
// fails where newlines are used to format pretty big "if":
// if (
// name.charAt(0) === "." ||
// name.match(/[\/@\s\+%:]/) ||
// name !== encodeURIComponent(name) ||
// name.toLowerCase() === "node_modules"
// ) {
'brace-style': 0,
// snake_case is more readable, what's up with you guys?
'camelcase': 0,
// if some functions are complex, they are for a good reason,
// ain't worth it
'complexity': [0, 10],
// never saw it, but self is preferred
'consistent-this': [1, 'self'],
// fails good code
'curly': 0,
// fails good code, where this notation is used for consistency:
// something['foo-bar'] = 123
// something['blahblah'] = 234
'dot-notation': 0,
// pointless in many cases (like indexOf() == -1), harmful in a few
// cases (when you do want to ignore types), fails good code
'eqeqeq': 0,
// if someone is changing prototype and makes properties enumerable,
// it's their own fault
'guard-for-in': 0,
// if some functions are complex, they are for a good reason,
// ain't worth it
'max-depth': [0, 4],
// should it really throw for every long URL?
'max-len': [0, 80, 4],
// that's obvious by just looking at the code, you don't need lint for that
'max-params': [0, 3],
// if some functions are complex, they are for a good reason,
// ain't worth it
'max-statements': [0, 10],
// that one makes sense
'new-cap': 2,
'new-parens': 1,
'no-alert': 1,
// I'm writing javascript, not some weird reduced version of it
'no-bitwise': 0,
'no-caller': 1,
// not working around IE bugs, sorry
'no-catch-shadow': 0,
// see above, IE is useful for downloading other browsers only
'no-comma-dangle': 0,
'no-cond-assign': 1,
// good for removing debugging code
'no-console': 2,
'no-control-regex': 1,
// good for removing debugging code
'no-debugger': 2,
'no-delete-var': 1,
'no-div-regex': 1,
'no-dupe-keys': 1,
// why would anyone need to check against that?
'no-else-return': 0,
// sometimes empty statement contains useful comment
'no-empty': 0,
'no-empty-class': 1,
'no-empty-label': 1,
// stupid rule
// "x == null" is "x === null || x === undefined"
'no-eq-null': 0,
'no-eval': 1,
'no-ex-assign': 1,
'no-extend-native': 1,
// fails good code, when parens are used for grouping:
// (req && req.headers['via']) ? req.headers['via'] + ', ' : ''
// not everyone remembers priority tables, you know
'no-extra-parens': 0,
// fails defensive semicolons:
// ;['foo', 'bar'].forEach(function(x) {})
'no-extra-semi': 0,
'no-fallthrough': 1,
'no-floating-decimal': 1,
'no-func-assign': 1,
'no-global-strict': 1,
'no-implied-eval': 1,
'no-invalid-regexp': 1,
'no-iterator': 1,
'no-label-var': 1,
'no-loop-func': 1,
// fails good code:
// var fs = require('fs'),
// , open = fs.open
'no-mixed-requires': [0, false],
'no-multi-str': 1,
'no-native-reassign': 1,
'no-negated-in-lhs': 1,
// XXX: not released yet
//'no-nested-ternary': 1,
'no-new': 1,
// new Array(12) is used to pre-allocate arrays
'no-new-array': 0,
'no-new-func': 1,
'no-new-object': 1,
'no-new-wrappers': 1,
'no-obj-calls': 1,
// fails good code:
// fs.open('/file', 0666, function(){})
'no-octal': 0,
// fails good code:
// console.log('\033[31m' + str + '\033[39m')
// also fails \0 which is not octal escape
'no-octal-escape': 0,
// I'm writing javascript, not some weird reduced version of it
'no-plusplus': 0,
'no-proto': 1,
// fails good code:
// if (a) {
// var x = 'foo'
// } else {
// var x = bar
// }
'no-redeclare': 0,
'no-return-assign': 1,
'no-script-url': 1,
'no-self-compare': 1,
// sometimes useful, often isn't
// probably worth enforcing
'no-shadow': 2,
'no-shadow-restricted-names': 1,
'no-spaced-func': 1,
// can't agree more, but it's a task for code review, not for lint
'no-sync': 0,
// I'm writing javascript, not some weird reduced version of it
'no-ternary': 0,
// the single most important rule in the entire ruleset
'no-undef': 2,
'no-undef-init': 1,
// it is failing our own underscores
'no-underscore-dangle': 0,
// fails function hoisting
'no-unreachable': 0,
// fails npm-style code, it's good once you get used to it:
// if (typeof(options) === 'function') callback = options, options = {}
'no-unused-expressions': 0,
// fails (function(_err) {}) where named argument is used to show what
// nth function argument means
'no-unused-vars': 0,
// fails function hoisting
'no-use-before-define': 0,
'no-with': 1,
// fails foobar( (function(){}).bind(this) )
// parens are added for readability
'no-wrap-func': 0,
// fails good code:
// var x
// if (something) {
// var y
'one-var': 0,
// the most stupid rule I ever saw
'quote-props': 0,
// fails situation when different quotes are used to avoid escaping
'quotes': [0, 'single'],
'radix': 1,
'regex-spaces': 1,
// http://blog.izs.me/post/2353458699/an-open-letter-to-javascript-leaders-regarding
'semi': 0,
// fails good code where spaces are used for grouping:
// (x+y * y+z)
'space-infix-ops': 0,
'space-return-throw-case': 1,
// typeof(something) should have braces to look like a function
// a matter of taste I suppose
'space-unary-word-ops': 0,
// strict mode is just harmful,
// can I have a check to enforce not using it?
'strict': 0,
'unnecessary-strict': 1,
'use-isnan': 1,
'wrap-iife': 1,
'wrap-regex': 1,
},
}