-
Notifications
You must be signed in to change notification settings - Fork 71
/
.eslintrc
348 lines (344 loc) · 11.8 KB
/
.eslintrc
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
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
{
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true
}
},
"env": {
"node": true,
"browser" : true,
"es6": true,
"mongo": true,
"jquery": true,
"mocha": true
},
"globals": {
"assert": true,
"__DEV__" : true,
"object": true,
"app": true,
"iod": true,
"React": true,
"__insp": true,
"c3": true,
"mixpanel": true,
"translate": true,
"ReactBootstrap": true,
"d3": true,
"Bloodhound": true,
"server": true,
"reactPage": true,
"FastClick": true,
"Headroom": true,
"Chart": true
},
"plugins": [
"babel",
"react"
],
"ecmaFeatures": {
"arrowFunctions": true,
"blockBindings": true,
"classes": true,
"defaultParams": true,
"destructuring": true,
"forOf": true,
"generators": false,
"modules": true,
"objectLiteralComputedProperties": true,
"objectLiteralDuplicateProperties": false,
"objectLiteralShorthandMethods": true,
"objectLiteralShorthandProperties": true,
"spread": true,
"superInFunctions": true,
"templateStrings": true,
"jsx": true
},
"rules": {
// treat var statements as if they were block scoped
"block-scoped-var": 1,
// require default case in switch statements
"default-case": 1,
// encourages use of dot notation whenever possible
"dot-notation": [1, { "allowKeywords": true}],
// require the use of === and !==
"eqeqeq": 1,
// make sure for-in loops have an if statement
"guard-for-in": 1,
// disallow the use of alert, confirm, and prompt
"no-alert": 1,
// disallow use of arguments.caller or arguments.callee
"no-caller": 1,
// disallow else after a return in an if
"no-else-return": 1,
// disallow comparisons to null without a type-checking operator
"no-eq-null": 1,
// disallow use of eval()
"no-eval": 1,
// disallow adding to native types
"no-extend-native": 1,
// disallow unnecessary function binding
"no-extra-bind": 1,
// disallow fallthrough of case statements
"no-fallthrough": 1,
// disallow the use of leading or trailing decimal points in numeric literals
"no-floating-decimal": 1,
// disallow the type conversions with shorter notations
"no-implicit-coercion": [2, {
"boolean": false,
"number": true,
"string": true
}],
// disallow use of eval()-like methods
"no-implied-eval": 1,
// disallow this keywords outside of classes or class-like objects
"no-invalid-this": 1,
// disallow usage of __iterator__ property
"no-iterator": 1,
// disallow use of labeled statements
"no-labels": 1,
// disallow unnecessary nested blocks
"no-lone-blocks": 1,
// disallow creation of functions within loops
"no-loop-func": 1,
// disallow use of multiple spaces
"no-multi-spaces": 1,
// disallow use of multiline strings
"no-multi-str": 1,
// disallow reassignments of native objects
"no-native-reassign": 1,
// disallow use of new operator when not part of the assignment or comparison
"no-new": 1,
// disallow use of new operator for Function object
"no-new-func": 1,
// disallows creating new instances of String,Number, and Boolean
"no-new-wrappers": 1,
// disallow use of (old style) octal literals
"no-octal": 1,
// disallow use of octal escape sequences in string literals, such as
// var foo = "Copyright \151";
"no-octal-escape": 1,
// disallow reassignment of function parameters
"no-param-reassign": 1,
// disallow use of process.env
"no-process-env": 0,
// disallow usage of __proto__ property
"no-proto": 1,
// disallow declaring the same variable more then once
"no-redeclare": 1,
// disallow use of assignment in return statement
"no-return-assign": 1,
// disallow use of `javascript:` urls.
"no-script-url": 1,
// disallow comparisons where both sides are exactly the same
"no-self-compare": 1,
// disallow use of comma operator
"no-sequences": 1,
// restrict what can be thrown as an exception
"no-throw-literal": 1,
// disallow usage of expressions in statement position
"no-unused-expressions": 1,
// disallow unnecessary .call() and .apply()
"no-useless-call": 1,
// disallow use of void operator
"no-void": 1,
// disallow use of the with statement
"no-with": 1,
// require use of the second argument for parseInt()
"radix": 1,
// requires to declare all vars on top of their containing scope
"vars-on-top": 1,
// require immediate function invocation to be wrapped in parentheses
"wrap-iife": [1, "any"],
// require or disallow Yoda conditions
"yoda": 1,
// es6 specific rules
// require space before/after arrow function"s arrow
"arrow-spacing": 1,
// verify super() callings in constructors
"constructor-super": 1,
// enforce the spacing around the * in generator functions
"generator-star-spacing": 1,
// disallow modifying variables of class declarations
"no-class-assign": 1,
// disallow modifying variables that are declared using const
"no-const-assign": 1,
// disallow to use this/super before super() calling in constructors.
"no-this-before-super": 1,
// require let or const instead of var
"no-var": 1,
// suggest using of const declaration for variables that are never modified after declared
"prefer-const": 1,
// suggest using the spread operator instead of .apply()
"prefer-spread": 1,
// disallow generator functions that do not have yield
"require-yield": 1,
// node specific rules
// enforce return after a callback
"callback-return": 1,
// enforces error handling in callbacks (node environment)
"handle-callback-err": 1,
// disallow mixing regular variable and require declarations
"no-mixed-requires": [1, false],
// disallow use of new operator with the require function
"no-new-require": 1,
// disallow process.exit()
"no-process-exit": 1,
// restrict usage of specified node modules
"no-restricted-modules": 1,
// disallow use of synchronous methods (off by default)
"no-sync": 1,
// react rules
// Prevent missing displayName in a React component definition
// react does this by default but sometimes
// it messes up (error in Component, which component?)
"react/display-name": 1,
// Enforce boolean attributes notation in JSX
"react/jsx-boolean-value": 1,
// Enforce or disallow spaces inside of curly braces in JSX attributes
"react/jsx-curly-spacing": 0,
// Prevent duplicate props in JSX
"react/jsx-no-duplicate-props": 1,
// Disallow undeclared variables in JSX
"react/jsx-no-undef": 1,
// Enforce quote style for JSX attributes
"jsx-quotes": [1, "prefer-single"],
// Prevent React to be incorrectly marked as unused
"react/jsx-uses-react": 1,
// Prevent variables used in JSX to be incorrectly marked as unused
"react/jsx-uses-vars": 1,
// Prevent usage of setState in componentDidMount
"react/no-did-mount-set-state": 1,
// Prevent usage of setState in componentDidUpdate
"react/no-did-update-set-state": 1,
// Prevent multiple component definition per file
"react/no-multi-comp": 0,
// Prevent usage of unknown DOM property
"react/no-unknown-property": 1,
// Restrict file extensions that may be required
"react/jsx-filename-extension": 1,
// Prevent extra closing tags for components without children
"react/self-closing-comp": 1,
// Prevent missing parentheses around multilines JSX
"react/jsx-wrap-multilines": 1,
// style-centric rules below
// enforce spacing inside array brackets
"array-bracket-spacing": [1, "never"],
// enforce one true brace style
// this is off because i prefer stroustrup
// but we haven't been writing code that way
"brace-style": [1,
"stroustrup", {
"allowSingleLine": true
}
],
// enforce spacing before and after comma
"comma-spacing": [1, {
"before": false,
"after": true
}],
// enforce one true comma style
"comma-style": [1, "last"],
// require or disallow padding inside computed properties
"computed-property-spacing": [1, "never"],
// enforces consistent naming when capturing the current execution context
"consistent-this": 1,
// enforce newline at the end of file, with no multiple empty lines
"eol-last": 1,
// require function expressions to have a name
// "func-names": 1,
// enforces use of function declarations or expressions
"func-style": 1,
// this option enforces minimum and maximum identifier lengths (variable names, property names etc.)
"id-length": [1, {
"min": 1,
"max": 30,
"properties": "never"
}],
// this option sets a specific tab width for your code
"indent": [1, 2],
// enforces spacing between keys and values in object literal properties
"key-spacing": [1, {
"beforeColon": false,
"afterColon": true
}],
// disallow mixed "LF" and "CRLF" as linebreaks
"linebreak-style": 1,
// disallow the omission of parentheses when invoking a constructor with no arguments
"new-parens": 1,
// disallow use of the Array constructor
"no-array-constructor": 1,
// disallow use of the continue statement
"no-continue": 1,
"no-inline-comments": 1,
// disallow mixed spaces and tabs for indentation
"no-mixed-spaces-and-tabs": 1,
// disallow multiple empty lines
"no-multiple-empty-lines": [1, {"max": 2}],
// disallow nested ternary expressions
// don't allow this madness!
"no-nested-ternary": 1,
// disallow use of the Object constructor
"no-new-object": 1,
// disallow space between function identifier and application
"no-spaced-func": 1,
// disallow the use of ternary operators
"no-ternary": 0,
// disallow trailing whitespace at the end of lines
"no-trailing-spaces": 1,
// disallow the use of Boolean literals in conditional expressions
"no-unneeded-ternary": 1,
// allow just one var statement per function (never means we don't allow this)
"one-var": [1, "never"],
// enforce padding within blocks
"padded-blocks": [0, "never"],
// specify whether double or single quotes should be used
"quotes": [0, "single", "avoid-escape"],
// enforce spacing before and after semicolons
"semi-spacing": [1, {"before": false, "after": true}],
// require or disallow use of semicolons instead of ASI
"semi": [1, "never"],
// sort variables within the same declaration block
"sort-vars": 1,
// require a space after certain keywords
"keyword-spacing": [1, {
"before": true,
"after": true,
"overrides": {}
}],
// require or disallow space before blocks
"space-before-blocks": 1,
// require or disallow space before function opening parenthesis
"space-before-function-paren": [1, "always"],
// require or disallow spaces inside parentheses
"space-in-parens": [1, "never"],
// require spaces around operators
"space-infix-ops": 1,
// Require or disallow spaces before/after unary operators
"space-unary-ops": [1, {
"words": true,
"nonwords": false
}],
// require or disallow a space immediately following the // or /* in a comment
"spaced-comment": [1, "always", {
"exceptions": ["-", "+", "*"],
"markers": ["=", "!"]
}],
"camelcase": 1,
"no-dupe-keys": 1,
"no-extra-semi": 1,
"no-extra-boolean-cast": 1,
"no-unused-vars": [1, {
"vars": "all",
"args": "after-used",
"varsIgnorePattern": "React"
}],
// document your work!
"valid-jsdoc": 1,
// Disallow undeclared variables in general
"no-undef": 1
}
}