forked from IBMDataScience/datascix
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.eslintrc.js
More file actions
388 lines (385 loc) · 9.71 KB
/
.eslintrc.js
File metadata and controls
388 lines (385 loc) · 9.71 KB
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
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
/*******************************************************************************
* Licensed Materials - Property of IBM
* (c) Copyright IBM Corporation 2016. All Rights Reserved.
*
* Note to U.S. Government Users Restricted Rights:
* Use, duplication or disclosure restricted by GSA ADP Schedule
* Contract with IBM Corp.
*******************************************************************************/
"use strict";
module.exports = {
"env": {
"es6": true,
"browser": false,
"node": true
},
"parserOptions": {
"ecmaVersion": 6,
"ecmaFeatures": {
"generators": false,
"objectLiteralDuplicateProperties": false
}
},
"extends": "eslint:recommended",
"rules": {
// Enforces getter/setter pairs in objects
"accessor-pairs": "error",
// Enforce spacing inside array brackets
"array-bracket-spacing": [
"error",
"never"
],
"array-callback-return": "error",
"arrow-body-style": "error",
"arrow-parens": "error",
"arrow-spacing": "error",
"block-scoped-var": "error",
"block-spacing": "error",
"brace-style": [
"error",
"1tbs"
],
// Enforce return after a callback
"callback-return": "error",
// Require camelcase
"camelcase": [
"error",
{
"properties": "never"
}
],
// Require or disallow trailing commas
"comma-dangle": [
"error",
"never"
],
"comma-spacing": [
"error",
{
"after": true,
"before": false
}
],
"comma-style": [
"error",
"last"
],
// Limit Cyclomatic Complexity
"complexity": [
"error",
20
],
"computed-property-spacing": [
"error",
"never"
],
// Require return statements to either always or never specify values
"consistent-return": "error",
"consistent-this": "error",
// Specify curly brace conventions for all control statements
"curly": "error",
"default-case": "error",
// Enforce newline before and after dot (dot-location)
"dot-location": [
"error",
"property"
],
"dot-notation": "error",
"eol-last": "error",
"eqeqeq": "error",
// Require function expressions to have a name
"func-names": "off",
// Enforce use of function declarations or expressions
"func-style": "off",
"generator-star-spacing": "error",
// Enforce require() on top-level module scope
"global-require": "error",
"guard-for-in": "error",
"handle-callback-err": "error",
"id-blacklist": "error",
"id-length": "error",
"id-match": "error",
// Specify tab or space width for your code
"indent": [
"error",
"tab"
],
// Enforce or disallow variable initializations at definition
// TODO: Revisit
"init-declarations": "off",
"jsx-quotes": "error",
// Enforce spacing between keys and values in object literal properties
"key-spacing": [
"error",
{
"beforeColon": false,
"afterColon": true
}
],
"keyword-spacing": [
"error",
{
"after": true,
"before": true
}
],
"linebreak-style": [
"error",
"unix"
],
"lines-around-comment": "error",
"max-depth": "error",
"max-len": [
"error",
{
"code": 120,
"tabWidth": 4,
"ignoreUrls": true
}
],
"max-nested-callbacks": "error",
// Limits the number of parameters that can be used in the function declaration
// TODO: Revisit
"max-params": "off",
// Specify the maximum number of statement allowed in a function
"max-statements": "off",
"new-parens": "error",
// Require or disallow an empty newline after variable declarations
// TODO: Revisit
"newline-after-var": "off",
// Require newline before return statement
// TODO: Revisit
"newline-before-return": "off",
"newline-per-chained-call": "error",
"no-alert": "error",
"no-array-constructor": "error",
// Disallow use of bitwise operators
"no-bitwise": "error",
"no-caller": "error",
"no-catch-shadow": "error",
"no-confusing-arrow": "error",
// Disallow use of console
"no-console": [
"error",
{
"allow": ["warn", "error"]
}
],
// Disallow continue (no-continue)
"no-continue": "off",
"no-div-regex": "error",
// Disallow else after a return in an if
"no-else-return": "error",
"no-empty-function": "error",
"no-eq-null": "error",
"no-eval": "error",
"no-extend-native": "error",
"no-extra-bind": "error",
"no-extra-label": "error",
// Disallow unnecessary parentheses
"no-extra-parens": [
"error",
"functions"
],
"no-floating-decimal": "error",
"no-implicit-coercion": "error",
"no-implicit-globals": "error",
"no-implied-eval": "error",
// Disallow comments inline after code
"no-inline-comments": "off",
"no-inner-declarations": [
"error",
"functions"
],
// Disallow this keywords outside of classes or class-like objects
"no-invalid-this": "error",
"no-iterator": "error",
"no-label-var": "error",
"no-labels": "error",
"no-lone-blocks": "error",
// Disallow if as the only statement in an else block
"no-lonely-if": "error",
"no-loop-func": "error",
// Disallow the use of magic numbers
// TODO: Revisit
"no-magic-numbers": "off",
"no-mixed-requires": "error",
// Disallow use of multiple spaces
"no-multi-spaces": "error",
"no-multi-str": "error",
"no-multiple-empty-lines": "error",
"no-native-reassign": "error",
// Disallow negated conditions
"no-negated-condition": "off",
"no-nested-ternary": "error",
"no-new": "error",
"no-new-func": "error",
"no-new-object": "error",
"no-new-require": "error",
"no-new-wrappers": "error",
"no-octal-escape": "error",
// Disallow reassignment of function parameters
"no-param-reassign": "error",
"no-path-concat": "error",
// Disallow use of unary operators, ++ and --
"no-plusplus": "off",
// Disallow use of process.env
"no-process-env": "off",
// Disallow process.exit()
"no-process-exit": "error",
"no-proto": "error",
"no-restricted-globals": "error",
"no-restricted-imports": "error",
"no-restricted-modules": "error",
"no-restricted-syntax": "error",
"no-return-assign": "error",
"no-script-url": "error",
"no-self-compare": "error",
"no-sequences": "error",
// Disallow declaration of variables already declared in the outer scope
"no-shadow": [
"error",
{
"builtinGlobals": true,
"hoist": "all"
}
],
"no-shadow-restricted-names": "error",
"no-spaced-func": "error",
// Disallow use of synchronous methods
"no-sync": "error",
// Disallow the use of ternary operators
"no-ternary": "off",
"no-throw-literal": "error",
// Disallow trailing whitespace at the end of lines
"no-trailing-spaces": "error",
"no-undef-init": "error",
"no-undefined": "error",
// Disallow dangling underscores in identifiers
"no-underscore-dangle": "off",
"no-unmodified-loop-condition": "error",
"no-unneeded-ternary": "error",
"no-unused-expressions": "error",
// Disallow declaration of variables that are not used in the code
// TODO: Revisit
"no-unused-vars": [
"error",
{
"vars": "all",
"args": "none"
}
],
// Disallow use of variables before they are defined
"no-use-before-define": "off",
"no-useless-call": "error",
// Disallow unnecessary concatenation of literals or template literals
"no-useless-concat": "error",
"no-useless-constructor": "error",
// Require let or const instead of var
// TODO: Revisit
"no-var": "off",
"no-void": "error",
// Disallow usage of configurable warning terms in comments - e.g. TODO or FIXME
"no-warning-comments": "off",
"no-whitespace-before-property": "error",
"no-with": "error",
"object-curly-spacing": [
"error",
"always"
],
// Require method and property shorthand syntax for object literals
// TODO: Revisit
"object-shorthand": "off",
// Require or disallow one variable declaration per function
"one-var": [
"error",
"never"
],
"one-var-declaration-per-line": "error",
"operator-assignment": [
"error",
"always"
],
"operator-linebreak": "error",
// Enforce padding within blocks
// TODO: Revisit
"padded-blocks": "off",
// Suggest using arrow functions as callbacks
"prefer-arrow-callback": "off",
"prefer-const": "error",
// Suggest using Reflect methods where applicable
"prefer-reflect": "off",
"prefer-rest-params": "error",
"prefer-spread": "error",
// Suggest using template literals instead of strings concatenation
// TODO: Revisit
"prefer-template": "off",
// Require quotes around object literal property names
// TODO: Revisit
"quote-props": [
"error",
"consistent"
],
"quotes": [
"error",
"double"
],
"radix": "error",
// Require JSDoc comment
"require-jsdoc": "off",
"require-yield": "error",
"semi": "error",
"semi-spacing": "error",
"sort-imports": "error",
"sort-vars": "error",
"space-before-blocks": "error",
// Require or disallow a space before function parenthesis
"space-before-function-paren": [
"error",
"never"
],
"space-in-parens": [
"error",
"never"
],
"space-infix-ops": "error",
"space-unary-ops": "error",
// Require or disallow a space immediately following the // or /* in a comment
"spaced-comment": [
"error",
"always",
{
"block": {
"exceptions": ["*"]
}
}
],
// Require effective use of strict mode directives
// TODO: Revisit. Not required when using ES6 imports
"strict": "error",
"template-curly-spacing": "error",
// Ensure JSDoc comments are valid
// TODO: Revisit
"valid-jsdoc": "off",
// Require declaration of all vars at the top of their containing scope
// TODO: Revisit
"vars-on-top": "off",
"wrap-iife": "error",
"wrap-regex": "error",
"yield-star-spacing": "error",
"yoda": [
"error",
"never"
]
}
};
// Rule overrides only for "development" mode
if (process.env.NODE_ENV !== "production") {
// Disallow use of console
module.exports.rules["no-console"] = [
1,
{
"allow": ["warn", "error"]
}
];
}