@innovixx/eslint-config 3.0.7 → 3.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,524 +1,524 @@
1
1
  /** @type {import('eslint').Linter.Config} */
2
2
 
3
3
  const styleRules = {
4
- rules: {
5
- // enforce line breaks after opening and before closing array brackets
6
- // https://eslint.org/docs/rules/array-bracket-newline
7
- // TODO: enable? semver-major
8
- 'array-bracket-newline': ['off', 'consistent'], // object option alternative: { multiline: true, minItems: 3 }
9
-
10
- // enforce line breaks between array elements
11
- // https://eslint.org/docs/rules/array-element-newline
12
- // TODO: enable? semver-major
13
- 'array-element-newline': ['off', { multiline: true, minItems: 3 }],
14
-
15
- // enforce spacing inside array brackets
16
- 'array-bracket-spacing': ['error', 'never'],
17
-
18
- // enforce spacing inside single-line blocks
19
- // https://eslint.org/docs/rules/block-spacing
20
- 'block-spacing': ['error', 'always'],
21
-
22
- // enforce one true brace style
23
- 'brace-style': ['error', '1tbs', { allowSingleLine: true }],
24
-
25
- // require camel case names
26
- camelcase: ['error', { properties: 'never', ignoreDestructuring: false }],
27
-
28
- // enforce or disallow capitalization of the first letter of a comment
29
- // https://eslint.org/docs/rules/capitalized-comments
30
- 'capitalized-comments': ['off', 'never', {
31
- line: {
32
- ignorePattern: '.*',
33
- ignoreInlineComments: true,
34
- ignoreConsecutiveComments: true,
35
- },
36
- block: {
37
- ignorePattern: '.*',
38
- ignoreInlineComments: true,
39
- ignoreConsecutiveComments: true,
40
- },
41
- }],
42
-
43
- // require trailing commas in multiline object literals
44
- 'comma-dangle': ['error', {
45
- arrays: 'always-multiline',
46
- objects: 'always-multiline',
47
- imports: 'always-multiline',
48
- exports: 'always-multiline',
49
- functions: 'always-multiline',
50
- }],
51
-
52
- // enforce spacing before and after comma
53
- 'comma-spacing': ['error', { before: false, after: true }],
54
-
55
- // enforce one true comma style
56
- 'comma-style': ['error', 'last', {
57
- exceptions: {
58
- ArrayExpression: false,
59
- ArrayPattern: false,
60
- ArrowFunctionExpression: false,
61
- CallExpression: false,
62
- FunctionDeclaration: false,
63
- FunctionExpression: false,
64
- ImportDeclaration: false,
65
- ObjectExpression: false,
66
- ObjectPattern: false,
67
- VariableDeclaration: false,
68
- NewExpression: false,
69
- },
70
- }],
71
-
72
- // disallow padding inside computed properties
73
- 'computed-property-spacing': ['error', 'never'],
74
-
75
- // enforces consistent naming when capturing the current execution context
76
- 'consistent-this': 'off',
77
-
78
- // enforce newline at the end of file, with no multiple empty lines
79
- 'eol-last': ['error', 'always'],
80
-
81
- // https://eslint.org/docs/rules/function-call-argument-newline
82
- // TODO: enable, semver-minor, once eslint v6.2 is required (which is a major)
83
- 'function-call-argument-newline': ['off', 'consistent'],
84
-
85
- // enforce spacing between functions and their invocations
86
- // https://eslint.org/docs/rules/func-call-spacing
87
- 'func-call-spacing': ['error', 'never'],
88
-
89
- // requires function names to match the name of the variable or property to which they are
90
- // assigned
91
- // https://eslint.org/docs/rules/func-name-matching
92
- 'func-name-matching': ['off', 'always', {
93
- includeCommonJSModuleExports: false,
94
- considerPropertyDescriptor: true,
95
- }],
96
-
97
- // require function expressions to have a name
98
- // https://eslint.org/docs/rules/func-names
99
- 'func-names': 'warn',
100
-
101
- // enforces use of function declarations or expressions
102
- // https://eslint.org/docs/rules/func-style
103
- // TODO: enable
104
- 'func-style': ['off', 'expression'],
105
-
106
- // enforce consistent line breaks inside function parentheses
107
- // https://eslint.org/docs/rules/function-paren-newline
108
- 'function-paren-newline': ['error', 'consistent'],
109
-
110
- // Blacklist certain identifiers to prevent them being used
111
- // https://eslint.org/docs/rules/id-blacklist
112
- 'id-blacklist': 'off',
113
-
114
- // this option enforces minimum and maximum identifier lengths
115
- // (variable names, property names etc.)
116
- 'id-length': 'off',
117
-
118
- // require identifiers to match the provided regular expression
119
- 'id-match': 'off',
120
-
121
- // Enforce the location of arrow function bodies with implicit returns
122
- // https://eslint.org/docs/rules/implicit-arrow-linebreak
123
- 'implicit-arrow-linebreak': ['error', 'beside'],
124
-
125
- // this option sets a specific tab width for your code
126
- // https://eslint.org/docs/rules/indent
127
- indent: ['error', 2, {
128
- SwitchCase: 1,
129
- VariableDeclarator: 1,
130
- outerIIFEBody: 1,
131
- // MemberExpression: null,
132
- FunctionDeclaration: {
133
- parameters: 1,
134
- body: 1,
135
- },
136
- FunctionExpression: {
137
- parameters: 1,
138
- body: 1,
139
- },
140
- CallExpression: {
141
- arguments: 1,
142
- },
143
- ArrayExpression: 1,
144
- ObjectExpression: 1,
145
- ImportDeclaration: 1,
146
- flatTernaryExpressions: false,
147
- // list derived from https://github.com/benjamn/ast-types/blob/HEAD/def/jsx.js
148
- ignoredNodes: ['JSXElement', 'JSXElement > *', 'JSXAttribute', 'JSXIdentifier', 'JSXNamespacedName', 'JSXMemberExpression', 'JSXSpreadAttribute', 'JSXExpressionContainer', 'JSXOpeningElement', 'JSXClosingElement', 'JSXText', 'JSXEmptyExpression', 'JSXSpreadChild'],
149
- ignoreComments: false,
150
- }],
151
-
152
- // specify whether double or single quotes should be used in JSX attributes
153
- // https://eslint.org/docs/rules/jsx-quotes
154
- 'jsx-quotes': ['off', 'prefer-double'],
155
-
156
- // enforces spacing between keys and values in object literal properties
157
- 'key-spacing': ['error', { beforeColon: false, afterColon: true }],
158
-
159
- // require a space before & after certain keywords
160
- 'keyword-spacing': ['error', {
161
- before: true,
162
- after: true,
163
- overrides: {
164
- return: { after: true },
165
- throw: { after: true },
166
- case: { after: true },
167
- },
168
- }],
169
-
170
- // enforce position of line comments
171
- // https://eslint.org/docs/rules/line-comment-position
172
- // TODO: enable?
173
- 'line-comment-position': ['off', {
174
- position: 'above',
175
- ignorePattern: '',
176
- applyDefaultPatterns: true,
177
- }],
178
-
179
- // disallow mixed 'LF' and 'CRLF' as linebreaks
180
- // https://eslint.org/docs/rules/linebreak-style
181
- 'linebreak-style': ['error', 'unix'],
182
-
183
- // require or disallow an empty line between class members
184
- // https://eslint.org/docs/rules/lines-between-class-members
185
- 'lines-between-class-members': ['error', 'always', { exceptAfterSingleLine: false }],
186
-
187
- // enforces empty lines around comments
188
- 'lines-around-comment': 'off',
189
-
190
- // require or disallow newlines around directives
191
- // https://eslint.org/docs/rules/lines-around-directive
192
- 'lines-around-directive': ['error', {
193
- before: 'always',
194
- after: 'always',
195
- }],
196
-
197
- // specify the maximum depth that blocks can be nested
198
- 'max-depth': ['off', 4],
199
-
200
- // specify the maximum length of a line in your program
201
- // https://eslint.org/docs/rules/max-len
202
- 'max-len': ['off'],
203
-
204
- // specify the max number of lines in a file
205
- // https://eslint.org/docs/rules/max-lines
206
- 'max-lines': ['off', {
207
- max: 300,
208
- skipBlankLines: true,
209
- skipComments: true,
210
- }],
211
-
212
- // enforce a maximum function length
213
- // https://eslint.org/docs/rules/max-lines-per-function
214
- 'max-lines-per-function': ['off', {
215
- max: 50,
216
- skipBlankLines: true,
217
- skipComments: true,
218
- IIFEs: true,
219
- }],
220
-
221
- // specify the maximum depth callbacks can be nested
222
- 'max-nested-callbacks': 'off',
223
-
224
- // limits the number of parameters that can be used in the function declaration.
225
- 'max-params': ['off', 3],
226
-
227
- // specify the maximum number of statement allowed in a function
228
- 'max-statements': ['off', 10],
229
-
230
- // restrict the number of statements per line
231
- // https://eslint.org/docs/rules/max-statements-per-line
232
- 'max-statements-per-line': ['off', { max: 1 }],
233
-
234
- // enforce a particular style for multiline comments
235
- // https://eslint.org/docs/rules/multiline-comment-style
236
- 'multiline-comment-style': ['off', 'starred-block'],
237
-
238
- // require multiline ternary
239
- // https://eslint.org/docs/rules/multiline-ternary
240
- // TODO: enable?
241
- 'multiline-ternary': ['off', 'never'],
242
-
243
- // require a capital letter for constructors
244
- 'new-cap': ['error', {
245
- newIsCap: true,
246
- newIsCapExceptions: [],
247
- capIsNew: false,
248
- capIsNewExceptions: ['Immutable.Map', 'Immutable.Set', 'Immutable.List'],
249
- }],
250
-
251
- // disallow the omission of parentheses when invoking a constructor with no arguments
252
- // https://eslint.org/docs/rules/new-parens
253
- 'new-parens': 'error',
254
-
255
- // allow/disallow an empty newline after var statement
256
- 'newline-after-var': 'off',
257
-
258
- // https://eslint.org/docs/rules/newline-before-return
259
- 'newline-before-return': 'off',
260
-
261
- // enforces new line after each method call in the chain to make it
262
- // more readable and easy to maintain
263
- // https://eslint.org/docs/rules/newline-per-chained-call
264
- 'newline-per-chained-call': ['error', { ignoreChainWithDepth: 4 }],
265
-
266
- // disallow use of the Array constructor
267
- 'no-array-constructor': 'error',
268
-
269
- // disallow use of bitwise operators
270
- // https://eslint.org/docs/rules/no-bitwise
271
- 'no-bitwise': 'error',
272
-
273
- // disallow use of the continue statement
274
- // https://eslint.org/docs/rules/no-continue
275
- 'no-continue': 'error',
276
-
277
- // disallow comments inline after code
278
- 'no-inline-comments': 'off',
279
-
280
- // disallow if as the only statement in an else block
281
- // https://eslint.org/docs/rules/no-lonely-if
282
- 'no-lonely-if': 'error',
283
-
284
- // disallow un-paren'd mixes of different operators
285
- // https://eslint.org/docs/rules/no-mixed-operators
286
- 'no-mixed-operators': ['error', {
287
- // the list of arthmetic groups disallows mixing `%` and `**`
288
- // with other arithmetic operators.
289
- groups: [
290
- ['%', '**'],
291
- ['%', '+'],
292
- ['%', '-'],
293
- ['%', '*'],
294
- ['%', '/'],
295
- ['/', '*'],
296
- ['&', '|', '<<', '>>', '>>>'],
297
- ['==', '!=', '===', '!=='],
298
- ['&&', '||'],
299
- ],
300
- allowSamePrecedence: false,
301
- }],
302
-
303
- // disallow mixed spaces and tabs for indentation
304
- 'no-mixed-spaces-and-tabs': 'error',
305
-
306
- // disallow use of chained assignment expressions
307
- // https://eslint.org/docs/rules/no-multi-assign
308
- 'no-multi-assign': ['error'],
309
-
310
- // disallow multiple empty lines, only one newline at the end, and no new lines at the beginning
311
- // https://eslint.org/docs/rules/no-multiple-empty-lines
312
- 'no-multiple-empty-lines': ['error', { max: 2, maxBOF: 1, maxEOF: 0 }],
313
-
314
- // disallow negated conditions
315
- // https://eslint.org/docs/rules/no-negated-condition
316
- 'no-negated-condition': 'off',
317
-
318
- // disallow nested ternary expressions
319
- 'no-nested-ternary': 'error',
320
-
321
- // disallow use of the Object constructor
322
- 'no-new-object': 'error',
323
-
324
- // disallow use of unary operators, ++ and --
325
- // https://eslint.org/docs/rules/no-plusplus
326
- 'no-plusplus': 'error',
327
-
328
- // disallow certain syntax forms
329
- // https://eslint.org/docs/rules/no-restricted-syntax
330
- 'no-restricted-syntax': [
331
- 'error',
332
- {
333
- selector: 'ForInStatement',
334
- message: 'for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.',
335
- },
336
- {
337
- selector: 'ForOfStatement',
338
- message: 'iterators/generators require regenerator-runtime, which is too heavyweight for this guide to allow them. Separately, loops should be avoided in favor of array iterations.',
339
- },
340
- {
341
- selector: 'LabeledStatement',
342
- message: 'Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.',
343
- },
344
- {
345
- selector: 'WithStatement',
346
- message: '`with` is disallowed in strict mode because it makes code impossible to predict and optimize.',
347
- },
348
- ],
349
-
350
- // disallow space between function identifier and application
351
- 'no-spaced-func': 'error',
352
-
353
- // disallow tab characters entirely
354
- 'no-tabs': 'off',
355
-
356
- // disallow the use of ternary operators
357
- 'no-ternary': 'off',
358
-
359
- // disallow trailing whitespace at the end of lines
360
- 'no-trailing-spaces': ['error', {
361
- skipBlankLines: false,
362
- ignoreComments: false,
363
- }],
364
-
365
- // disallow dangling underscores in identifiers
366
- // https://eslint.org/docs/rules/no-underscore-dangle
367
- 'no-underscore-dangle': 'off',
368
-
369
- // disallow the use of Boolean literals in conditional expressions
370
- // also, prefer `a || b` over `a ? a : b`
371
- // https://eslint.org/docs/rules/no-unneeded-ternary
372
- 'no-unneeded-ternary': ['error', { defaultAssignment: false }],
373
-
374
- // disallow whitespace before properties
375
- // https://eslint.org/docs/rules/no-whitespace-before-property
376
- 'no-whitespace-before-property': 'error',
377
-
378
- // enforce the location of single-line statements
379
- // https://eslint.org/docs/rules/nonblock-statement-body-position
380
- 'nonblock-statement-body-position': ['error', 'beside', { overrides: {} }],
381
-
382
- // require padding inside curly braces
383
- 'object-curly-spacing': ['error', 'always'],
384
-
385
- // enforce line breaks between braces
386
- // https://eslint.org/docs/rules/object-curly-newline
387
- 'object-curly-newline': ['error', {
388
- ObjectExpression: { multiline: true, consistent: true },
389
- ObjectPattern: { multiline: true, consistent: true },
390
- ImportDeclaration: { multiline: true, consistent: true },
391
- ExportDeclaration: { multiline: true, consistent: true },
392
- }],
393
-
394
- // enforce "same line" or "multiple line" on object properties.
395
- // https://eslint.org/docs/rules/object-property-newline
396
- 'object-property-newline': ['error', {
397
- allowAllPropertiesOnSameLine: true,
398
- }],
399
-
400
- // allow just one var statement per function
401
- 'one-var': ['error', 'never'],
402
-
403
- // require a newline around variable declaration
404
- // https://eslint.org/docs/rules/one-var-declaration-per-line
405
- 'one-var-declaration-per-line': ['error', 'always'],
406
-
407
- // require assignment operator shorthand where possible or prohibit it entirely
408
- // https://eslint.org/docs/rules/operator-assignment
409
- 'operator-assignment': ['error', 'always'],
410
-
411
- // Requires operator at the beginning of the line in multiline statements
412
- // https://eslint.org/docs/rules/operator-linebreak
413
- 'operator-linebreak': ['error', 'before', { overrides: { '=': 'none' } }],
414
-
415
- // disallow padding within blocks
416
- 'padded-blocks': ['error',
417
- {
418
- blocks: 'never',
419
- classes: 'never',
420
- switches: 'never',
421
- },
422
- {
423
- allowSingleLineBlocks: true,
424
- },
425
- ],
426
-
427
- // Require or disallow padding lines between statements
428
- // https://eslint.org/docs/rules/padding-line-between-statements
429
- 'padding-line-between-statements': 'off',
430
-
431
- // Disallow the use of Math.pow in favor of the ** operator
432
- // https://eslint.org/docs/rules/prefer-exponentiation-operator
433
- // TODO: enable, semver-major when eslint 5 is dropped
434
- 'prefer-exponentiation-operator': 'off',
435
-
436
- // Prefer use of an object spread over Object.assign
437
- // https://eslint.org/docs/rules/prefer-object-spread
438
- 'prefer-object-spread': 'error',
439
-
440
- // require quotes around object literal property names
441
- // https://eslint.org/docs/rules/quote-props.html
442
- 'quote-props': ['error', 'as-needed', { keywords: false, unnecessary: true, numbers: false }],
443
-
444
- // specify whether double or single quotes should be used
445
- quotes: ['error', 'single', { avoidEscape: true }],
446
-
447
- // do not require jsdoc
448
- // https://eslint.org/docs/rules/require-jsdoc
449
- 'require-jsdoc': 'off',
450
-
451
- // require or disallow use of semicolons instead of ASI
452
- semi: ['error', 'always'],
453
-
454
- // enforce spacing before and after semicolons
455
- 'semi-spacing': ['error', { before: false, after: true }],
456
-
457
- // Enforce location of semicolons
458
- // https://eslint.org/docs/rules/semi-style
459
- 'semi-style': ['error', 'last'],
460
-
461
- // requires object keys to be sorted
462
- 'sort-keys': ['off', 'asc', { caseSensitive: false, natural: true }],
463
-
464
- // sort variables within the same declaration block
465
- 'sort-vars': 'off',
466
-
467
- // require or disallow space before blocks
468
- 'space-before-blocks': 'error',
469
-
470
- // require or disallow space before function opening parenthesis
471
- // https://eslint.org/docs/rules/space-before-function-paren
472
- 'space-before-function-paren': ['error', {
473
- anonymous: 'always',
474
- named: 'never',
475
- asyncArrow: 'always',
476
- }],
477
-
478
- // require or disallow spaces inside parentheses
479
- 'space-in-parens': ['error', 'never'],
480
-
481
- // require spaces around operators
482
- 'space-infix-ops': 'error',
483
-
484
- // Require or disallow spaces before/after unary operators
485
- // https://eslint.org/docs/rules/space-unary-ops
486
- 'space-unary-ops': ['error', {
487
- words: true,
488
- nonwords: false,
489
- overrides: {
490
- },
491
- }],
492
-
493
- // require or disallow a space immediately following the // or /* in a comment
494
- // https://eslint.org/docs/rules/spaced-comment
495
- 'spaced-comment': ['error', 'always', {
496
- line: {
497
- exceptions: ['-', '+'],
498
- markers: ['=', '!'], // space here to support sprockets directives
499
- },
500
- block: {
501
- exceptions: ['-', '+'],
502
- markers: ['=', '!', ':', '::'], // space here to support sprockets directives and flow comment types
503
- balanced: true,
504
- },
505
- }],
506
-
507
- // Enforce spacing around colons of switch statements
508
- // https://eslint.org/docs/rules/switch-colon-spacing
509
- 'switch-colon-spacing': ['error', { after: true, before: false }],
510
-
511
- // Require or disallow spacing between template tags and their literals
512
- // https://eslint.org/docs/rules/template-tag-spacing
513
- 'template-tag-spacing': ['error', 'never'],
514
-
515
- // require or disallow the Unicode Byte Order Mark
516
- // https://eslint.org/docs/rules/unicode-bom
517
- 'unicode-bom': ['error', 'never'],
518
-
519
- // require regex literals to be wrapped in parentheses
520
- 'wrap-regex': 'off',
521
- },
4
+ rules: {
5
+ // enforce line breaks after opening and before closing array brackets
6
+ // https://eslint.org/docs/rules/array-bracket-newline
7
+ // TODO: enable? semver-major
8
+ 'array-bracket-newline': ['off', 'consistent'], // object option alternative: { multiline: true, minItems: 3 }
9
+
10
+ // enforce line breaks between array elements
11
+ // https://eslint.org/docs/rules/array-element-newline
12
+ // TODO: enable? semver-major
13
+ 'array-element-newline': ['off', { multiline: true, minItems: 3 }],
14
+
15
+ // enforce spacing inside array brackets
16
+ 'array-bracket-spacing': ['error', 'never'],
17
+
18
+ // enforce spacing inside single-line blocks
19
+ // https://eslint.org/docs/rules/block-spacing
20
+ 'block-spacing': ['error', 'always'],
21
+
22
+ // enforce one true brace style
23
+ 'brace-style': ['error', '1tbs', { allowSingleLine: true }],
24
+
25
+ // require camel case names
26
+ camelcase: ['error', { properties: 'never', ignoreDestructuring: false }],
27
+
28
+ // enforce or disallow capitalization of the first letter of a comment
29
+ // https://eslint.org/docs/rules/capitalized-comments
30
+ 'capitalized-comments': ['off', 'never', {
31
+ line: {
32
+ ignorePattern: '.*',
33
+ ignoreInlineComments: true,
34
+ ignoreConsecutiveComments: true,
35
+ },
36
+ block: {
37
+ ignorePattern: '.*',
38
+ ignoreInlineComments: true,
39
+ ignoreConsecutiveComments: true,
40
+ },
41
+ }],
42
+
43
+ // require trailing commas in multiline object literals
44
+ 'comma-dangle': ['error', {
45
+ arrays: 'always-multiline',
46
+ objects: 'always-multiline',
47
+ imports: 'always-multiline',
48
+ exports: 'always-multiline',
49
+ functions: 'always-multiline',
50
+ }],
51
+
52
+ // enforce spacing before and after comma
53
+ 'comma-spacing': ['error', { before: false, after: true }],
54
+
55
+ // enforce one true comma style
56
+ 'comma-style': ['error', 'last', {
57
+ exceptions: {
58
+ ArrayExpression: false,
59
+ ArrayPattern: false,
60
+ ArrowFunctionExpression: false,
61
+ CallExpression: false,
62
+ FunctionDeclaration: false,
63
+ FunctionExpression: false,
64
+ ImportDeclaration: false,
65
+ ObjectExpression: false,
66
+ ObjectPattern: false,
67
+ VariableDeclaration: false,
68
+ NewExpression: false,
69
+ },
70
+ }],
71
+
72
+ // disallow padding inside computed properties
73
+ 'computed-property-spacing': ['error', 'never'],
74
+
75
+ // enforces consistent naming when capturing the current execution context
76
+ 'consistent-this': 'off',
77
+
78
+ // enforce newline at the end of file, with no multiple empty lines
79
+ 'eol-last': ['error', 'always'],
80
+
81
+ // https://eslint.org/docs/rules/function-call-argument-newline
82
+ // TODO: enable, semver-minor, once eslint v6.2 is required (which is a major)
83
+ 'function-call-argument-newline': ['off', 'consistent'],
84
+
85
+ // enforce spacing between functions and their invocations
86
+ // https://eslint.org/docs/rules/func-call-spacing
87
+ 'func-call-spacing': ['error', 'never'],
88
+
89
+ // requires function names to match the name of the variable or property to which they are
90
+ // assigned
91
+ // https://eslint.org/docs/rules/func-name-matching
92
+ 'func-name-matching': ['off', 'always', {
93
+ includeCommonJSModuleExports: false,
94
+ considerPropertyDescriptor: true,
95
+ }],
96
+
97
+ // require function expressions to have a name
98
+ // https://eslint.org/docs/rules/func-names
99
+ 'func-names': 'warn',
100
+
101
+ // enforces use of function declarations or expressions
102
+ // https://eslint.org/docs/rules/func-style
103
+ // TODO: enable
104
+ 'func-style': ['off', 'expression'],
105
+
106
+ // enforce consistent line breaks inside function parentheses
107
+ // https://eslint.org/docs/rules/function-paren-newline
108
+ 'function-paren-newline': ['error', 'consistent'],
109
+
110
+ // Blacklist certain identifiers to prevent them being used
111
+ // https://eslint.org/docs/rules/id-blacklist
112
+ 'id-blacklist': 'off',
113
+
114
+ // this option enforces minimum and maximum identifier lengths
115
+ // (variable names, property names etc.)
116
+ 'id-length': 'off',
117
+
118
+ // require identifiers to match the provided regular expression
119
+ 'id-match': 'off',
120
+
121
+ // Enforce the location of arrow function bodies with implicit returns
122
+ // https://eslint.org/docs/rules/implicit-arrow-linebreak
123
+ 'implicit-arrow-linebreak': ['error', 'beside'],
124
+
125
+ // this option sets a specific tab width for your code
126
+ // https://eslint.org/docs/rules/indent
127
+ indent: ['error', 'tab', {
128
+ SwitchCase: 1,
129
+ VariableDeclarator: 1,
130
+ outerIIFEBody: 1,
131
+ // MemberExpression: null,
132
+ FunctionDeclaration: {
133
+ parameters: 1,
134
+ body: 1,
135
+ },
136
+ FunctionExpression: {
137
+ parameters: 1,
138
+ body: 1,
139
+ },
140
+ CallExpression: {
141
+ arguments: 1,
142
+ },
143
+ ArrayExpression: 1,
144
+ ObjectExpression: 1,
145
+ ImportDeclaration: 1,
146
+ flatTernaryExpressions: false,
147
+ // list derived from https://github.com/benjamn/ast-types/blob/HEAD/def/jsx.js
148
+ ignoredNodes: ['JSXElement', 'JSXElement > *', 'JSXAttribute', 'JSXIdentifier', 'JSXNamespacedName', 'JSXMemberExpression', 'JSXSpreadAttribute', 'JSXExpressionContainer', 'JSXOpeningElement', 'JSXClosingElement', 'JSXText', 'JSXEmptyExpression', 'JSXSpreadChild'],
149
+ ignoreComments: false,
150
+ }],
151
+
152
+ // specify whether double or single quotes should be used in JSX attributes
153
+ // https://eslint.org/docs/rules/jsx-quotes
154
+ 'jsx-quotes': ['off', 'prefer-double'],
155
+
156
+ // enforces spacing between keys and values in object literal properties
157
+ 'key-spacing': ['error', { beforeColon: false, afterColon: true }],
158
+
159
+ // require a space before & after certain keywords
160
+ 'keyword-spacing': ['error', {
161
+ before: true,
162
+ after: true,
163
+ overrides: {
164
+ return: { after: true },
165
+ throw: { after: true },
166
+ case: { after: true },
167
+ },
168
+ }],
169
+
170
+ // enforce position of line comments
171
+ // https://eslint.org/docs/rules/line-comment-position
172
+ // TODO: enable?
173
+ 'line-comment-position': ['off', {
174
+ position: 'above',
175
+ ignorePattern: '',
176
+ applyDefaultPatterns: true,
177
+ }],
178
+
179
+ // disallow mixed 'LF' and 'CRLF' as linebreaks
180
+ // https://eslint.org/docs/rules/linebreak-style
181
+ 'linebreak-style': ['error', 'unix'],
182
+
183
+ // require or disallow an empty line between class members
184
+ // https://eslint.org/docs/rules/lines-between-class-members
185
+ 'lines-between-class-members': ['error', 'always', { exceptAfterSingleLine: false }],
186
+
187
+ // enforces empty lines around comments
188
+ 'lines-around-comment': 'off',
189
+
190
+ // require or disallow newlines around directives
191
+ // https://eslint.org/docs/rules/lines-around-directive
192
+ 'lines-around-directive': ['error', {
193
+ before: 'always',
194
+ after: 'always',
195
+ }],
196
+
197
+ // specify the maximum depth that blocks can be nested
198
+ 'max-depth': ['off', 4],
199
+
200
+ // specify the maximum length of a line in your program
201
+ // https://eslint.org/docs/rules/max-len
202
+ 'max-len': ['off'],
203
+
204
+ // specify the max number of lines in a file
205
+ // https://eslint.org/docs/rules/max-lines
206
+ 'max-lines': ['off', {
207
+ max: 300,
208
+ skipBlankLines: true,
209
+ skipComments: true,
210
+ }],
211
+
212
+ // enforce a maximum function length
213
+ // https://eslint.org/docs/rules/max-lines-per-function
214
+ 'max-lines-per-function': ['off', {
215
+ max: 50,
216
+ skipBlankLines: true,
217
+ skipComments: true,
218
+ IIFEs: true,
219
+ }],
220
+
221
+ // specify the maximum depth callbacks can be nested
222
+ 'max-nested-callbacks': 'off',
223
+
224
+ // limits the number of parameters that can be used in the function declaration.
225
+ 'max-params': ['off', 3],
226
+
227
+ // specify the maximum number of statement allowed in a function
228
+ 'max-statements': ['off', 10],
229
+
230
+ // restrict the number of statements per line
231
+ // https://eslint.org/docs/rules/max-statements-per-line
232
+ 'max-statements-per-line': ['off', { max: 1 }],
233
+
234
+ // enforce a particular style for multiline comments
235
+ // https://eslint.org/docs/rules/multiline-comment-style
236
+ 'multiline-comment-style': ['off', 'starred-block'],
237
+
238
+ // require multiline ternary
239
+ // https://eslint.org/docs/rules/multiline-ternary
240
+ // TODO: enable?
241
+ 'multiline-ternary': ['off', 'never'],
242
+
243
+ // require a capital letter for constructors
244
+ 'new-cap': ['error', {
245
+ newIsCap: true,
246
+ newIsCapExceptions: [],
247
+ capIsNew: false,
248
+ capIsNewExceptions: ['Immutable.Map', 'Immutable.Set', 'Immutable.List'],
249
+ }],
250
+
251
+ // disallow the omission of parentheses when invoking a constructor with no arguments
252
+ // https://eslint.org/docs/rules/new-parens
253
+ 'new-parens': 'error',
254
+
255
+ // allow/disallow an empty newline after var statement
256
+ 'newline-after-var': 'off',
257
+
258
+ // https://eslint.org/docs/rules/newline-before-return
259
+ 'newline-before-return': 'off',
260
+
261
+ // enforces new line after each method call in the chain to make it
262
+ // more readable and easy to maintain
263
+ // https://eslint.org/docs/rules/newline-per-chained-call
264
+ 'newline-per-chained-call': ['error', { ignoreChainWithDepth: 4 }],
265
+
266
+ // disallow use of the Array constructor
267
+ 'no-array-constructor': 'error',
268
+
269
+ // disallow use of bitwise operators
270
+ // https://eslint.org/docs/rules/no-bitwise
271
+ 'no-bitwise': 'error',
272
+
273
+ // disallow use of the continue statement
274
+ // https://eslint.org/docs/rules/no-continue
275
+ 'no-continue': 'error',
276
+
277
+ // disallow comments inline after code
278
+ 'no-inline-comments': 'off',
279
+
280
+ // disallow if as the only statement in an else block
281
+ // https://eslint.org/docs/rules/no-lonely-if
282
+ 'no-lonely-if': 'error',
283
+
284
+ // disallow un-paren'd mixes of different operators
285
+ // https://eslint.org/docs/rules/no-mixed-operators
286
+ 'no-mixed-operators': ['error', {
287
+ // the list of arthmetic groups disallows mixing `%` and `**`
288
+ // with other arithmetic operators.
289
+ groups: [
290
+ ['%', '**'],
291
+ ['%', '+'],
292
+ ['%', '-'],
293
+ ['%', '*'],
294
+ ['%', '/'],
295
+ ['/', '*'],
296
+ ['&', '|', '<<', '>>', '>>>'],
297
+ ['==', '!=', '===', '!=='],
298
+ ['&&', '||'],
299
+ ],
300
+ allowSamePrecedence: false,
301
+ }],
302
+
303
+ // disallow mixed spaces and tabs for indentation
304
+ 'no-mixed-spaces-and-tabs': 'error',
305
+
306
+ // disallow use of chained assignment expressions
307
+ // https://eslint.org/docs/rules/no-multi-assign
308
+ 'no-multi-assign': ['error'],
309
+
310
+ // disallow multiple empty lines, only one newline at the end, and no new lines at the beginning
311
+ // https://eslint.org/docs/rules/no-multiple-empty-lines
312
+ 'no-multiple-empty-lines': ['error', { max: 2, maxBOF: 1, maxEOF: 0 }],
313
+
314
+ // disallow negated conditions
315
+ // https://eslint.org/docs/rules/no-negated-condition
316
+ 'no-negated-condition': 'off',
317
+
318
+ // disallow nested ternary expressions
319
+ 'no-nested-ternary': 'error',
320
+
321
+ // disallow use of the Object constructor
322
+ 'no-new-object': 'error',
323
+
324
+ // disallow use of unary operators, ++ and --
325
+ // https://eslint.org/docs/rules/no-plusplus
326
+ 'no-plusplus': 'error',
327
+
328
+ // disallow certain syntax forms
329
+ // https://eslint.org/docs/rules/no-restricted-syntax
330
+ 'no-restricted-syntax': [
331
+ 'error',
332
+ {
333
+ selector: 'ForInStatement',
334
+ message: 'for..in loops iterate over the entire prototype chain, which is virtually never what you want. Use Object.{keys,values,entries}, and iterate over the resulting array.',
335
+ },
336
+ {
337
+ selector: 'ForOfStatement',
338
+ message: 'iterators/generators require regenerator-runtime, which is too heavyweight for this guide to allow them. Separately, loops should be avoided in favor of array iterations.',
339
+ },
340
+ {
341
+ selector: 'LabeledStatement',
342
+ message: 'Labels are a form of GOTO; using them makes code confusing and hard to maintain and understand.',
343
+ },
344
+ {
345
+ selector: 'WithStatement',
346
+ message: '`with` is disallowed in strict mode because it makes code impossible to predict and optimize.',
347
+ },
348
+ ],
349
+
350
+ // disallow space between function identifier and application
351
+ 'no-spaced-func': 'error',
352
+
353
+ // disallow tab characters entirely
354
+ 'no-tabs': 'off',
355
+
356
+ // disallow the use of ternary operators
357
+ 'no-ternary': 'off',
358
+
359
+ // disallow trailing whitespace at the end of lines
360
+ 'no-trailing-spaces': ['error', {
361
+ skipBlankLines: false,
362
+ ignoreComments: false,
363
+ }],
364
+
365
+ // disallow dangling underscores in identifiers
366
+ // https://eslint.org/docs/rules/no-underscore-dangle
367
+ 'no-underscore-dangle': 'off',
368
+
369
+ // disallow the use of Boolean literals in conditional expressions
370
+ // also, prefer `a || b` over `a ? a : b`
371
+ // https://eslint.org/docs/rules/no-unneeded-ternary
372
+ 'no-unneeded-ternary': ['error', { defaultAssignment: false }],
373
+
374
+ // disallow whitespace before properties
375
+ // https://eslint.org/docs/rules/no-whitespace-before-property
376
+ 'no-whitespace-before-property': 'error',
377
+
378
+ // enforce the location of single-line statements
379
+ // https://eslint.org/docs/rules/nonblock-statement-body-position
380
+ 'nonblock-statement-body-position': ['error', 'beside', { overrides: {} }],
381
+
382
+ // require padding inside curly braces
383
+ 'object-curly-spacing': ['error', 'always'],
384
+
385
+ // enforce line breaks between braces
386
+ // https://eslint.org/docs/rules/object-curly-newline
387
+ 'object-curly-newline': ['error', {
388
+ ObjectExpression: { multiline: true, consistent: true },
389
+ ObjectPattern: { multiline: true, consistent: true },
390
+ ImportDeclaration: { multiline: true, consistent: true },
391
+ ExportDeclaration: { multiline: true, consistent: true },
392
+ }],
393
+
394
+ // enforce "same line" or "multiple line" on object properties.
395
+ // https://eslint.org/docs/rules/object-property-newline
396
+ 'object-property-newline': ['error', {
397
+ allowAllPropertiesOnSameLine: true,
398
+ }],
399
+
400
+ // allow just one var statement per function
401
+ 'one-var': ['error', 'never'],
402
+
403
+ // require a newline around variable declaration
404
+ // https://eslint.org/docs/rules/one-var-declaration-per-line
405
+ 'one-var-declaration-per-line': ['error', 'always'],
406
+
407
+ // require assignment operator shorthand where possible or prohibit it entirely
408
+ // https://eslint.org/docs/rules/operator-assignment
409
+ 'operator-assignment': ['error', 'always'],
410
+
411
+ // Requires operator at the beginning of the line in multiline statements
412
+ // https://eslint.org/docs/rules/operator-linebreak
413
+ 'operator-linebreak': ['error', 'before', { overrides: { '=': 'none' } }],
414
+
415
+ // disallow padding within blocks
416
+ 'padded-blocks': ['error',
417
+ {
418
+ blocks: 'never',
419
+ classes: 'never',
420
+ switches: 'never',
421
+ },
422
+ {
423
+ allowSingleLineBlocks: true,
424
+ },
425
+ ],
426
+
427
+ // Require or disallow padding lines between statements
428
+ // https://eslint.org/docs/rules/padding-line-between-statements
429
+ 'padding-line-between-statements': 'off',
430
+
431
+ // Disallow the use of Math.pow in favor of the ** operator
432
+ // https://eslint.org/docs/rules/prefer-exponentiation-operator
433
+ // TODO: enable, semver-major when eslint 5 is dropped
434
+ 'prefer-exponentiation-operator': 'off',
435
+
436
+ // Prefer use of an object spread over Object.assign
437
+ // https://eslint.org/docs/rules/prefer-object-spread
438
+ 'prefer-object-spread': 'error',
439
+
440
+ // require quotes around object literal property names
441
+ // https://eslint.org/docs/rules/quote-props.html
442
+ 'quote-props': ['error', 'as-needed', { keywords: false, unnecessary: true, numbers: false }],
443
+
444
+ // specify whether double or single quotes should be used
445
+ quotes: ['error', 'single', { avoidEscape: true }],
446
+
447
+ // do not require jsdoc
448
+ // https://eslint.org/docs/rules/require-jsdoc
449
+ 'require-jsdoc': 'off',
450
+
451
+ // require or disallow use of semicolons instead of ASI
452
+ semi: ['error', 'always'],
453
+
454
+ // enforce spacing before and after semicolons
455
+ 'semi-spacing': ['error', { before: false, after: true }],
456
+
457
+ // Enforce location of semicolons
458
+ // https://eslint.org/docs/rules/semi-style
459
+ 'semi-style': ['error', 'last'],
460
+
461
+ // requires object keys to be sorted
462
+ 'sort-keys': ['off', 'asc', { caseSensitive: false, natural: true }],
463
+
464
+ // sort variables within the same declaration block
465
+ 'sort-vars': 'off',
466
+
467
+ // require or disallow space before blocks
468
+ 'space-before-blocks': 'error',
469
+
470
+ // require or disallow space before function opening parenthesis
471
+ // https://eslint.org/docs/rules/space-before-function-paren
472
+ 'space-before-function-paren': ['error', {
473
+ anonymous: 'always',
474
+ named: 'never',
475
+ asyncArrow: 'always',
476
+ }],
477
+
478
+ // require or disallow spaces inside parentheses
479
+ 'space-in-parens': ['error', 'never'],
480
+
481
+ // require spaces around operators
482
+ 'space-infix-ops': 'error',
483
+
484
+ // Require or disallow spaces before/after unary operators
485
+ // https://eslint.org/docs/rules/space-unary-ops
486
+ 'space-unary-ops': ['error', {
487
+ words: true,
488
+ nonwords: false,
489
+ overrides: {
490
+ },
491
+ }],
492
+
493
+ // require or disallow a space immediately following the // or /* in a comment
494
+ // https://eslint.org/docs/rules/spaced-comment
495
+ 'spaced-comment': ['error', 'always', {
496
+ line: {
497
+ exceptions: ['-', '+'],
498
+ markers: ['=', '!'], // space here to support sprockets directives
499
+ },
500
+ block: {
501
+ exceptions: ['-', '+'],
502
+ markers: ['=', '!', ':', '::'], // space here to support sprockets directives and flow comment types
503
+ balanced: true,
504
+ },
505
+ }],
506
+
507
+ // Enforce spacing around colons of switch statements
508
+ // https://eslint.org/docs/rules/switch-colon-spacing
509
+ 'switch-colon-spacing': ['error', { after: true, before: false }],
510
+
511
+ // Require or disallow spacing between template tags and their literals
512
+ // https://eslint.org/docs/rules/template-tag-spacing
513
+ 'template-tag-spacing': ['error', 'never'],
514
+
515
+ // require or disallow the Unicode Byte Order Mark
516
+ // https://eslint.org/docs/rules/unicode-bom
517
+ 'unicode-bom': ['error', 'never'],
518
+
519
+ // require regex literals to be wrapped in parentheses
520
+ 'wrap-regex': 'off',
521
+ },
522
522
  };
523
523
 
524
524
  export default styleRules;