@croct/eslint-plugin 0.8.0 → 0.8.2

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,894 +1,867 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.javascript = void 0;
4
- exports.javascript = {
5
- extends: [
6
- 'plugin:jest/recommended',
7
- 'plugin:eslint-comments/recommended',
8
- ],
9
- plugins: [
10
- 'jest',
11
- 'import',
12
- 'no-smart-quotes',
13
- 'import-newlines',
14
- 'newline-destructuring',
15
- '@croct',
6
+ exports.baseRules = void 0;
7
+ exports.createJavaScriptConfig = createJavaScriptConfig;
8
+ const globals_1 = __importDefault(require("globals"));
9
+ const eslint_plugin_jest_1 = __importDefault(require("eslint-plugin-jest"));
10
+ const eslint_plugin_import_x_1 = require("eslint-plugin-import-x");
11
+ // @ts-expect-error - no types available
12
+ const eslint_plugin_eslint_comments_1 = __importDefault(require("@eslint-community/eslint-plugin-eslint-comments"));
13
+ // @ts-expect-error - no types available
14
+ const eslint_plugin_import_newlines_1 = __importDefault(require("eslint-plugin-import-newlines"));
15
+ // @ts-expect-error - no types available
16
+ const eslint_plugin_newline_destructuring_1 = __importDefault(require("eslint-plugin-newline-destructuring"));
17
+ // @ts-expect-error - no types available
18
+ const eslint_plugin_1 = __importDefault(require("@stylistic/eslint-plugin"));
19
+ const baseRules = {
20
+ // Custom rules
21
+ '@croct/argument-spacing': 'error',
22
+ '@croct/complex-expression-spacing': 'error',
23
+ '@croct/newline-per-chained-call': 'error',
24
+ '@croct/min-chained-call-depth': 'error',
25
+ '@croct/parameter-destructuring': 'error',
26
+ // ESLint comments rules
27
+ '@eslint-community/eslint-comments/disable-enable-pair': [
28
+ 'error',
29
+ {
30
+ allowWholeFile: true,
31
+ },
16
32
  ],
17
- parserOptions: {
18
- ecmaVersion: 2018,
19
- sourceType: 'module',
20
- },
21
- env: {
22
- es6: true,
23
- node: true,
24
- },
25
- rules: {
26
- // Custom rules
27
- '@croct/argument-spacing': 'error',
28
- '@croct/complex-expression-spacing': 'error',
29
- '@croct/newline-per-chained-call': 'error',
30
- '@croct/min-chained-call-depth': 'error',
31
- '@croct/parameter-destructuring': 'error',
32
- // ESLint comments rules
33
- 'eslint-comments/disable-enable-pair': [
34
- 'error',
35
- {
36
- allowWholeFile: true,
37
- },
38
- ],
39
- 'eslint-comments/require-description': 'error',
40
- 'eslint-comments/no-unused-disable': 'error',
41
- // Best practices (from airbnb-base)
42
- 'accessor-pairs': 'off',
43
- 'array-callback-return': ['error', { allowImplicit: true }],
44
- 'block-scoped-var': 'error',
45
- complexity: ['off', 20],
46
- 'class-methods-use-this': 'off',
47
- 'consistent-return': 'off',
48
- curly: ['error', 'multi-line'],
49
- 'default-case': 'off',
50
- 'default-case-last': 'error',
51
- 'default-param-last': 'error',
52
- 'dot-notation': ['error', { allowKeywords: true }],
53
- 'dot-location': ['error', 'property'],
54
- eqeqeq: ['error', 'always', { null: 'ignore' }],
55
- 'grouped-accessor-pairs': 'error',
56
- 'guard-for-in': 'error',
57
- 'max-classes-per-file': 'off',
58
- 'no-alert': 'warn',
59
- 'no-caller': 'error',
60
- 'no-case-declarations': 'error',
61
- 'no-constructor-return': 'error',
62
- 'no-div-regex': 'off',
63
- 'no-else-return': ['error', { allowElseIf: false }],
64
- 'no-empty-function': ['error', {
65
- allow: [
66
- 'arrowFunctions',
67
- 'functions',
68
- 'methods',
69
- ],
70
- }],
71
- 'no-empty-pattern': 'error',
72
- 'no-eq-null': 'off',
73
- 'no-eval': 'error',
74
- 'no-extend-native': 'error',
75
- 'no-extra-bind': 'error',
76
- 'no-extra-label': 'error',
77
- 'no-fallthrough': 'error',
78
- 'no-floating-decimal': 'error',
79
- 'no-global-assign': ['error', { exceptions: [] }],
80
- 'no-native-reassign': 'off',
81
- 'no-implicit-coercion': ['off', {
82
- boolean: false,
83
- number: true,
84
- string: true,
85
- allow: [],
86
- }],
87
- 'no-implicit-globals': 'off',
88
- 'no-implied-eval': 'error',
89
- 'no-invalid-this': 'off',
90
- 'no-iterator': 'error',
91
- 'no-labels': ['error', { allowLoop: false, allowSwitch: false }],
92
- 'no-lone-blocks': 'error',
93
- 'no-loop-func': 'error',
94
- 'no-magic-numbers': ['off', {
95
- ignore: [],
96
- ignoreArrayIndexes: true,
97
- enforceConst: true,
98
- detectObjects: false,
99
- }],
100
- 'no-multi-spaces': ['error', {
101
- ignoreEOLComments: false,
102
- }],
103
- 'no-multi-str': 'error',
104
- 'no-new': 'error',
105
- 'no-new-func': 'error',
106
- 'no-new-wrappers': 'error',
107
- 'no-nonoctal-decimal-escape': 'error',
108
- 'no-octal': 'error',
109
- 'no-octal-escape': 'error',
110
- 'no-param-reassign': ['error', {
111
- props: true,
112
- ignorePropertyModificationsFor: [
113
- 'acc',
114
- 'accumulator',
115
- 'e',
116
- 'ctx',
117
- 'context',
118
- 'req',
119
- 'request',
120
- 'res',
121
- 'response',
122
- '$scope',
123
- 'staticContext',
124
- ],
125
- }],
126
- 'no-proto': 'error',
127
- 'no-redeclare': 'error',
128
- 'no-restricted-properties': ['error', {
129
- object: 'arguments',
130
- property: 'callee',
131
- message: 'arguments.callee is deprecated',
132
- }, {
133
- object: 'global',
134
- property: 'isFinite',
135
- message: 'Please use Number.isFinite instead',
136
- }, {
137
- object: 'self',
138
- property: 'isFinite',
139
- message: 'Please use Number.isFinite instead',
140
- }, {
141
- object: 'window',
142
- property: 'isFinite',
143
- message: 'Please use Number.isFinite instead',
144
- }, {
145
- object: 'global',
146
- property: 'isNaN',
147
- message: 'Please use Number.isNaN instead',
148
- }, {
149
- object: 'self',
150
- property: 'isNaN',
151
- message: 'Please use Number.isNaN instead',
152
- }, {
153
- object: 'window',
154
- property: 'isNaN',
155
- message: 'Please use Number.isNaN instead',
156
- }, {
157
- property: '__defineGetter__',
158
- message: 'Please use Object.defineProperty instead.',
159
- }, {
160
- property: '__defineSetter__',
161
- message: 'Please use Object.defineProperty instead.',
162
- }, {
163
- object: 'Math',
164
- property: 'pow',
165
- message: 'Use the exponentiation operator (**) instead.',
166
- }],
167
- 'no-return-assign': ['error', 'always'],
168
- 'no-return-await': 'error',
169
- 'no-script-url': 'error',
170
- 'no-self-assign': ['error', {
171
- props: true,
172
- }],
173
- 'no-self-compare': 'error',
174
- 'no-sequences': 'error',
175
- 'no-throw-literal': 'error',
176
- 'no-unmodified-loop-condition': 'off',
177
- 'no-unused-expressions': 'error',
178
- 'no-unused-labels': 'error',
179
- 'no-useless-call': 'off',
180
- 'no-useless-catch': 'error',
181
- 'no-useless-concat': 'error',
182
- 'no-useless-escape': 'error',
183
- 'no-useless-return': 'error',
184
- 'no-void': 'error',
185
- 'no-warning-comments': ['off', { terms: ['todo', 'fixme', 'xxx'], location: 'start' }],
186
- 'no-with': 'error',
187
- 'prefer-promise-reject-errors': ['error', { allowEmptyReject: true }],
188
- 'prefer-named-capture-group': 'off',
189
- 'prefer-regex-literals': ['error', {
190
- disallowRedundantWrapping: true,
191
- }],
192
- radix: 'error',
193
- 'require-await': 'error',
194
- 'require-unicode-regexp': 'off',
195
- 'vars-on-top': 'error',
196
- 'wrap-iife': ['error', 'outside', { functionPrototypeMethods: false }],
197
- yoda: 'error',
198
- // Errors (from airbnb-base)
199
- 'for-direction': 'error',
200
- 'getter-return': ['error', { allowImplicit: true }],
201
- 'no-async-promise-executor': 'error',
202
- 'no-await-in-loop': 'off',
203
- 'no-compare-neg-zero': 'error',
204
- 'no-cond-assign': ['error', 'always'],
205
- 'no-console': 'warn',
206
- 'no-constant-condition': 'warn',
207
- 'no-control-regex': 'error',
208
- 'no-debugger': 'error',
209
- 'no-dupe-args': 'error',
210
- 'no-dupe-else-if': 'error',
211
- 'no-dupe-keys': 'error',
212
- 'no-duplicate-case': 'error',
213
- 'no-empty': 'error',
214
- 'no-empty-character-class': 'error',
215
- 'no-ex-assign': 'error',
216
- 'no-extra-boolean-cast': 'error',
217
- 'no-extra-parens': ['off', 'all', {
218
- conditionalAssign: true,
219
- nestedBinaryExpressions: false,
220
- returnAssign: false,
221
- ignoreJSX: 'all',
222
- enforceForArrowConditionals: false,
223
- }],
224
- 'no-extra-semi': 'error',
225
- 'no-func-assign': 'error',
226
- 'no-import-assign': 'error',
227
- 'no-inner-declarations': 'error',
228
- 'no-invalid-regexp': 'error',
229
- 'no-irregular-whitespace': 'error',
230
- 'no-loss-of-precision': 'error',
231
- 'no-misleading-character-class': 'error',
232
- 'no-obj-calls': 'error',
233
- 'no-promise-executor-return': 'error',
234
- 'no-prototype-builtins': 'error',
235
- 'no-regex-spaces': 'error',
236
- 'no-setter-return': 'error',
237
- 'no-sparse-arrays': 'error',
238
- 'no-template-curly-in-string': 'error',
239
- 'no-unexpected-multiline': 'error',
240
- 'no-unreachable': 'error',
241
- 'no-unreachable-loop': ['error', {
242
- ignore: [],
243
- }],
244
- 'no-unsafe-finally': 'error',
245
- 'no-unsafe-negation': 'error',
246
- 'no-unsafe-optional-chaining': ['error', { disallowArithmeticOperators: true }],
247
- 'no-unused-private-class-members': 'off',
248
- 'no-useless-backreference': 'error',
249
- 'no-negated-in-lhs': 'off',
250
- 'require-atomic-updates': 'off',
251
- 'use-isnan': 'error',
252
- 'valid-jsdoc': 'off',
253
- 'valid-typeof': ['error', { requireStringLiterals: true }],
254
- // Style (from airbnb-base, with customizations)
255
- 'array-bracket-newline': ['error', 'consistent'],
256
- 'array-element-newline': ['error', 'consistent'],
257
- 'array-bracket-spacing': ['error', 'never'],
258
- 'block-spacing': ['error', 'always'],
259
- 'brace-style': ['error', '1tbs', { allowSingleLine: true }],
260
- camelcase: ['error', { properties: 'never', ignoreDestructuring: false }],
261
- 'capitalized-comments': ['off', 'never', {
262
- line: {
263
- ignorePattern: '.*',
264
- ignoreInlineComments: true,
265
- ignoreConsecutiveComments: true,
266
- },
267
- block: {
268
- ignorePattern: '.*',
269
- ignoreInlineComments: true,
270
- ignoreConsecutiveComments: true,
271
- },
272
- }],
273
- 'comma-dangle': ['error', {
274
- arrays: 'always-multiline',
275
- objects: 'always-multiline',
276
- imports: 'always-multiline',
277
- exports: 'always-multiline',
278
- functions: 'always-multiline',
279
- }],
280
- 'comma-spacing': ['error', { before: false, after: true }],
281
- 'comma-style': ['error', 'last', {
282
- exceptions: {
283
- ArrayExpression: false,
284
- ArrayPattern: false,
285
- ArrowFunctionExpression: false,
286
- CallExpression: false,
287
- FunctionDeclaration: false,
288
- FunctionExpression: false,
289
- ImportDeclaration: false,
290
- ObjectExpression: false,
291
- ObjectPattern: false,
292
- VariableDeclaration: false,
293
- NewExpression: false,
294
- },
295
- }],
296
- 'computed-property-spacing': ['error', 'never'],
297
- 'consistent-this': 'off',
298
- 'eol-last': ['error', 'always'],
299
- 'function-call-argument-newline': ['error', 'consistent'],
300
- 'func-call-spacing': ['error', 'never'],
301
- 'func-name-matching': ['off', 'always', {
302
- includeCommonJSModuleExports: false,
303
- considerPropertyDescriptor: true,
304
- }],
305
- 'func-names': 'warn',
306
- 'func-style': ['off', 'expression'],
307
- 'function-paren-newline': ['error', 'multiline-arguments'],
308
- 'id-denylist': 'off',
309
- 'id-length': 'off',
310
- 'id-match': 'off',
311
- 'implicit-arrow-linebreak': ['error', 'beside'],
312
- indent: [
313
- 'error',
314
- 4,
315
- {
316
- SwitchCase: 1,
317
- VariableDeclarator: 1,
318
- outerIIFEBody: 1,
319
- FunctionDeclaration: {
320
- parameters: 1,
321
- body: 1,
322
- },
323
- FunctionExpression: {
324
- parameters: 1,
325
- body: 1,
326
- },
327
- CallExpression: {
328
- arguments: 1,
329
- },
330
- ArrayExpression: 1,
331
- ObjectExpression: 1,
332
- ImportDeclaration: 1,
333
- flatTernaryExpressions: false,
334
- ignoredNodes: [
335
- 'JSXElement',
336
- 'JSXElement > *',
337
- 'JSXAttribute',
338
- 'JSXIdentifier',
339
- 'JSXNamespacedName',
340
- 'JSXMemberExpression',
341
- 'JSXSpreadAttribute',
342
- 'JSXExpressionContainer',
343
- 'JSXOpeningElement',
344
- 'JSXClosingElement',
345
- 'JSXFragment',
346
- 'JSXOpeningFragment',
347
- 'JSXClosingFragment',
348
- 'JSXText',
349
- 'JSXEmptyExpression',
350
- 'JSXSpreadChild',
351
- ],
352
- ignoreComments: false,
353
- },
354
- ],
355
- 'jsx-quotes': ['error', 'prefer-double'],
356
- 'key-spacing': ['error', { beforeColon: false, afterColon: true }],
357
- 'keyword-spacing': ['error', {
358
- before: true,
359
- after: true,
360
- overrides: {
361
- return: { after: true },
362
- throw: { after: true },
363
- case: { after: true },
364
- },
365
- }],
366
- 'line-comment-position': ['off', {
367
- position: 'above',
368
- ignorePattern: '',
369
- applyDefaultPatterns: true,
370
- }],
371
- 'linebreak-style': ['error', 'unix'],
372
- 'lines-between-class-members': ['error', 'always', { exceptAfterSingleLine: false }],
373
- 'lines-around-comment': 'off',
374
- 'lines-around-directive': ['error', {
375
- before: 'always',
376
- after: 'always',
377
- }],
378
- 'max-depth': ['off', 4],
379
- 'max-len': [
380
- 'error',
381
- {
382
- code: 120,
383
- ignoreStrings: false,
384
- ignoreComments: false,
385
- ignoreTemplateLiterals: false,
386
- ignoreTrailingComments: false,
387
- ignoreUrls: false,
388
- },
389
- ],
390
- 'max-lines': ['off', {
391
- max: 300,
392
- skipBlankLines: true,
393
- skipComments: true,
394
- }],
395
- 'max-lines-per-function': ['off', {
396
- max: 50,
397
- skipBlankLines: true,
398
- skipComments: true,
399
- IIFEs: true,
400
- }],
401
- 'max-nested-callbacks': 'off',
402
- 'max-params': ['off', 3],
403
- 'max-statements': ['off', 10],
404
- 'max-statements-per-line': ['off', { max: 1 }],
405
- 'multiline-comment-style': ['off', 'starred-block'],
406
- 'multiline-ternary': ['error', 'always-multiline'],
407
- 'new-cap': ['error', {
408
- newIsCap: true,
409
- newIsCapExceptions: [],
410
- capIsNew: false,
411
- capIsNewExceptions: ['Immutable.Map', 'Immutable.Set', 'Immutable.List'],
412
- }],
413
- 'new-parens': 'error',
414
- 'newline-after-var': 'off',
415
- 'newline-before-return': 'off',
416
- 'newline-per-chained-call': 'off',
417
- 'no-array-constructor': 'error',
418
- 'no-bitwise': 'off',
419
- 'no-continue': 'off',
420
- 'no-inline-comments': 'off',
421
- 'no-lonely-if': 'error',
422
- 'no-mixed-operators': ['error', {
423
- groups: [
424
- ['%', '**'],
425
- ['%', '+'],
426
- ['%', '-'],
427
- ['%', '*'],
428
- ['%', '/'],
429
- ['/', '*'],
430
- ['&', '|', '<<', '>>', '>>>'],
431
- ['==', '!=', '===', '!=='],
432
- ['&&', '||'],
433
- ],
434
- allowSamePrecedence: false,
435
- }],
436
- 'no-mixed-spaces-and-tabs': 'error',
437
- 'no-multi-assign': ['error'],
438
- 'no-multiple-empty-lines': [
439
- 'error',
440
- {
441
- max: 1,
442
- maxEOF: 0,
443
- maxBOF: 0,
444
- },
445
- ],
446
- 'no-negated-condition': 'off',
447
- 'no-nested-ternary': 'error',
448
- 'no-new-object': 'error',
449
- 'no-plusplus': 'off',
450
- 'no-restricted-syntax': [
451
- 'error',
452
- 'ForInStatement',
453
- 'LabeledStatement',
454
- 'WithStatement',
455
- ],
456
- 'no-spaced-func': 'error',
457
- 'no-tabs': 'error',
458
- 'no-ternary': 'off',
459
- 'no-trailing-spaces': ['error', {
460
- skipBlankLines: false,
461
- ignoreComments: false,
462
- }],
463
- 'no-underscore-dangle': 'off',
464
- 'no-unneeded-ternary': ['error', { defaultAssignment: false }],
465
- 'no-whitespace-before-property': 'error',
466
- 'nonblock-statement-body-position': ['error', 'beside', { overrides: {} }],
467
- 'object-curly-spacing': ['error', 'never'],
468
- 'object-curly-newline': [
469
- 'error',
470
- {
471
- multiline: true,
472
- consistent: true,
473
- },
474
- ],
475
- 'object-property-newline': ['error', {
476
- allowAllPropertiesOnSameLine: true,
477
- }],
478
- 'one-var': ['error', 'never'],
479
- 'one-var-declaration-per-line': ['error', 'always'],
480
- 'operator-assignment': ['error', 'always'],
481
- 'operator-linebreak': ['error', 'before', { overrides: { '=': 'none' } }],
482
- 'padded-blocks': ['error', {
483
- blocks: 'never',
484
- classes: 'never',
485
- switches: 'never',
486
- }, {
487
- allowSingleLineBlocks: true,
488
- }],
489
- 'padding-line-between-statements': [
490
- 'error',
491
- {
492
- blankLine: 'always',
493
- prev: '*',
494
- next: [
495
- 'try',
496
- ],
497
- },
498
- {
499
- blankLine: 'always',
500
- prev: [
501
- 'break',
502
- 'return',
503
- ],
504
- next: [
505
- 'case',
506
- 'default',
507
- ],
508
- },
509
- {
510
- blankLine: 'always',
511
- prev: [
512
- 'const',
513
- 'let',
514
- 'var',
515
- ],
516
- next: '*',
33
+ '@eslint-community/eslint-comments/require-description': 'error',
34
+ '@eslint-community/eslint-comments/no-unused-disable': 'error',
35
+ // Best practices (from airbnb-base)
36
+ 'accessor-pairs': 'off',
37
+ 'array-callback-return': ['error', { allowImplicit: true }],
38
+ 'block-scoped-var': 'error',
39
+ complexity: ['off', 20],
40
+ 'class-methods-use-this': 'off',
41
+ 'consistent-return': 'off',
42
+ curly: ['error', 'multi-line'],
43
+ 'default-case': 'off',
44
+ 'default-case-last': 'error',
45
+ 'default-param-last': 'error',
46
+ 'dot-notation': ['error', { allowKeywords: true }],
47
+ '@stylistic/dot-location': ['error', 'property'],
48
+ eqeqeq: ['error', 'always', { null: 'ignore' }],
49
+ 'grouped-accessor-pairs': 'error',
50
+ 'guard-for-in': 'error',
51
+ 'max-classes-per-file': 'off',
52
+ 'no-alert': 'warn',
53
+ 'no-caller': 'error',
54
+ 'no-case-declarations': 'error',
55
+ 'no-constructor-return': 'error',
56
+ 'no-div-regex': 'off',
57
+ 'no-else-return': ['error', { allowElseIf: false }],
58
+ 'no-empty-function': ['error', {
59
+ allow: [
60
+ 'arrowFunctions',
61
+ 'functions',
62
+ 'methods',
63
+ ],
64
+ }],
65
+ 'no-empty-pattern': 'error',
66
+ 'no-eq-null': 'off',
67
+ 'no-eval': 'error',
68
+ 'no-extend-native': 'error',
69
+ 'no-extra-bind': 'error',
70
+ 'no-extra-label': 'error',
71
+ 'no-fallthrough': 'error',
72
+ '@stylistic/no-floating-decimal': 'error',
73
+ 'no-global-assign': ['error', { exceptions: [] }],
74
+ 'no-implicit-coercion': ['off', {
75
+ boolean: false,
76
+ number: true,
77
+ string: true,
78
+ allow: [],
79
+ }],
80
+ 'no-implicit-globals': 'off',
81
+ 'no-implied-eval': 'error',
82
+ 'no-invalid-this': 'off',
83
+ 'no-iterator': 'error',
84
+ 'no-labels': ['error', { allowLoop: false, allowSwitch: false }],
85
+ 'no-lone-blocks': 'error',
86
+ 'no-loop-func': 'error',
87
+ 'no-magic-numbers': ['off', {
88
+ ignore: [],
89
+ ignoreArrayIndexes: true,
90
+ enforceConst: true,
91
+ detectObjects: false,
92
+ }],
93
+ '@stylistic/no-multi-spaces': ['error', {
94
+ ignoreEOLComments: false,
95
+ }],
96
+ 'no-multi-str': 'error',
97
+ 'no-new': 'error',
98
+ 'no-new-func': 'error',
99
+ 'no-new-wrappers': 'error',
100
+ 'no-nonoctal-decimal-escape': 'error',
101
+ 'no-octal': 'error',
102
+ 'no-octal-escape': 'error',
103
+ 'no-param-reassign': ['error', {
104
+ props: true,
105
+ ignorePropertyModificationsFor: [
106
+ 'acc',
107
+ 'accumulator',
108
+ 'e',
109
+ 'ctx',
110
+ 'context',
111
+ 'req',
112
+ 'request',
113
+ 'res',
114
+ 'response',
115
+ '$scope',
116
+ 'staticContext',
117
+ ],
118
+ }],
119
+ 'no-proto': 'error',
120
+ 'no-redeclare': 'error',
121
+ 'no-restricted-properties': ['error', {
122
+ object: 'arguments',
123
+ property: 'callee',
124
+ message: 'arguments.callee is deprecated',
125
+ }, {
126
+ object: 'global',
127
+ property: 'isFinite',
128
+ message: 'Please use Number.isFinite instead',
129
+ }, {
130
+ object: 'self',
131
+ property: 'isFinite',
132
+ message: 'Please use Number.isFinite instead',
133
+ }, {
134
+ object: 'window',
135
+ property: 'isFinite',
136
+ message: 'Please use Number.isFinite instead',
137
+ }, {
138
+ object: 'global',
139
+ property: 'isNaN',
140
+ message: 'Please use Number.isNaN instead',
141
+ }, {
142
+ object: 'self',
143
+ property: 'isNaN',
144
+ message: 'Please use Number.isNaN instead',
145
+ }, {
146
+ object: 'window',
147
+ property: 'isNaN',
148
+ message: 'Please use Number.isNaN instead',
149
+ }, {
150
+ property: '__defineGetter__',
151
+ message: 'Please use Object.defineProperty instead.',
152
+ }, {
153
+ property: '__defineSetter__',
154
+ message: 'Please use Object.defineProperty instead.',
155
+ }, {
156
+ object: 'Math',
157
+ property: 'pow',
158
+ message: 'Use the exponentiation operator (**) instead.',
159
+ }],
160
+ 'no-return-assign': ['error', 'always'],
161
+ 'no-script-url': 'error',
162
+ 'no-self-assign': ['error', {
163
+ props: true,
164
+ }],
165
+ 'no-self-compare': 'error',
166
+ 'no-sequences': 'error',
167
+ 'no-throw-literal': 'error',
168
+ 'no-unmodified-loop-condition': 'off',
169
+ 'no-unused-expressions': 'error',
170
+ 'no-unused-labels': 'error',
171
+ 'no-useless-call': 'off',
172
+ 'no-useless-catch': 'error',
173
+ 'no-useless-concat': 'error',
174
+ 'no-useless-escape': 'error',
175
+ 'no-useless-return': 'error',
176
+ 'no-void': 'error',
177
+ 'no-warning-comments': ['off', { terms: ['todo', 'fixme', 'xxx'], location: 'start' }],
178
+ 'no-with': 'error',
179
+ 'prefer-promise-reject-errors': ['error', { allowEmptyReject: true }],
180
+ 'prefer-named-capture-group': 'off',
181
+ 'prefer-regex-literals': ['error', {
182
+ disallowRedundantWrapping: true,
183
+ }],
184
+ radix: 'error',
185
+ 'require-await': 'error',
186
+ 'require-unicode-regexp': 'off',
187
+ 'vars-on-top': 'error',
188
+ '@stylistic/wrap-iife': ['error', 'outside', { functionPrototypeMethods: false }],
189
+ yoda: 'error',
190
+ // Errors (from airbnb-base)
191
+ 'for-direction': 'error',
192
+ 'getter-return': ['error', { allowImplicit: true }],
193
+ 'no-async-promise-executor': 'error',
194
+ 'no-await-in-loop': 'off',
195
+ 'no-compare-neg-zero': 'error',
196
+ 'no-cond-assign': ['error', 'always'],
197
+ 'no-console': 'warn',
198
+ 'no-constant-condition': 'warn',
199
+ 'no-control-regex': 'error',
200
+ 'no-debugger': 'error',
201
+ 'no-dupe-args': 'error',
202
+ 'no-dupe-else-if': 'error',
203
+ 'no-dupe-keys': 'error',
204
+ 'no-duplicate-case': 'error',
205
+ 'no-empty': 'error',
206
+ 'no-empty-character-class': 'error',
207
+ 'no-ex-assign': 'error',
208
+ 'no-extra-boolean-cast': 'error',
209
+ '@stylistic/no-extra-parens': ['off', 'all', {
210
+ conditionalAssign: true,
211
+ nestedBinaryExpressions: false,
212
+ returnAssign: false,
213
+ ignoreJSX: 'all',
214
+ enforceForArrowConditionals: false,
215
+ }],
216
+ '@stylistic/no-extra-semi': 'error',
217
+ 'no-func-assign': 'error',
218
+ 'no-import-assign': 'error',
219
+ 'no-inner-declarations': 'error',
220
+ 'no-invalid-regexp': 'error',
221
+ 'no-irregular-whitespace': 'error',
222
+ 'no-loss-of-precision': 'error',
223
+ 'no-misleading-character-class': 'error',
224
+ 'no-obj-calls': 'error',
225
+ 'no-promise-executor-return': 'error',
226
+ 'no-prototype-builtins': 'error',
227
+ 'no-regex-spaces': 'error',
228
+ 'no-setter-return': 'error',
229
+ 'no-sparse-arrays': 'error',
230
+ 'no-template-curly-in-string': 'error',
231
+ 'no-unexpected-multiline': 'error',
232
+ 'no-unreachable': 'error',
233
+ 'no-unreachable-loop': ['error', {
234
+ ignore: [],
235
+ }],
236
+ 'no-unsafe-finally': 'error',
237
+ 'no-unsafe-negation': 'error',
238
+ 'no-unsafe-optional-chaining': ['error', { disallowArithmeticOperators: true }],
239
+ 'no-unused-private-class-members': 'off',
240
+ 'no-useless-backreference': 'error',
241
+ 'require-atomic-updates': 'off',
242
+ 'use-isnan': 'error',
243
+ 'valid-typeof': ['error', { requireStringLiterals: true }],
244
+ // Style (from airbnb-base, with customizations)
245
+ '@stylistic/array-bracket-newline': ['error', 'consistent'],
246
+ '@stylistic/array-element-newline': ['error', 'consistent'],
247
+ '@stylistic/array-bracket-spacing': ['error', 'never'],
248
+ '@stylistic/block-spacing': ['error', 'always'],
249
+ '@stylistic/brace-style': ['error', '1tbs', { allowSingleLine: true }],
250
+ camelcase: ['error', { properties: 'never', ignoreDestructuring: false }],
251
+ 'capitalized-comments': ['off', 'never', {
252
+ line: {
253
+ ignorePattern: '.*',
254
+ ignoreInlineComments: true,
255
+ ignoreConsecutiveComments: true,
517
256
  },
518
- {
519
- blankLine: 'any',
520
- prev: [
521
- 'const',
522
- 'let',
523
- 'var',
524
- ],
525
- next: [
526
- 'const',
527
- 'let',
528
- 'var',
529
- ],
257
+ block: {
258
+ ignorePattern: '.*',
259
+ ignoreInlineComments: true,
260
+ ignoreConsecutiveComments: true,
530
261
  },
531
- {
532
- blankLine: 'always',
533
- prev: '*',
534
- next: [
535
- 'break',
536
- 'continue',
537
- 'return',
538
- 'if',
539
- 'function',
540
- 'block',
541
- 'block-like',
542
- ],
262
+ }],
263
+ '@stylistic/comma-dangle': ['error', 'always-multiline'],
264
+ '@stylistic/comma-spacing': ['error', { before: false, after: true }],
265
+ '@stylistic/comma-style': ['error', 'last', {
266
+ exceptions: {
267
+ ArrayExpression: false,
268
+ ArrayPattern: false,
269
+ ArrowFunctionExpression: false,
270
+ CallExpression: false,
271
+ FunctionDeclaration: false,
272
+ FunctionExpression: false,
273
+ ImportDeclaration: false,
274
+ ObjectExpression: false,
275
+ ObjectPattern: false,
276
+ VariableDeclaration: false,
277
+ NewExpression: false,
543
278
  },
544
- {
545
- blankLine: 'any',
546
- prev: [
547
- 'case',
548
- ],
549
- next: [
550
- 'case',
551
- ],
279
+ }],
280
+ '@stylistic/computed-property-spacing': ['error', 'never'],
281
+ 'consistent-this': 'off',
282
+ '@stylistic/eol-last': ['error', 'always'],
283
+ '@stylistic/function-call-argument-newline': ['error', 'consistent'],
284
+ '@stylistic/function-call-spacing': ['error', 'never'],
285
+ 'func-name-matching': ['off', 'always', {
286
+ includeCommonJSModuleExports: false,
287
+ considerPropertyDescriptor: true,
288
+ }],
289
+ 'func-names': 'warn',
290
+ 'func-style': ['off', 'expression'],
291
+ '@stylistic/function-paren-newline': ['error', 'multiline-arguments'],
292
+ 'id-denylist': 'off',
293
+ 'id-length': 'off',
294
+ 'id-match': 'off',
295
+ '@stylistic/implicit-arrow-linebreak': ['error', 'beside'],
296
+ '@stylistic/indent': [
297
+ 'error',
298
+ 4,
299
+ {
300
+ SwitchCase: 1,
301
+ VariableDeclarator: 1,
302
+ outerIIFEBody: 1,
303
+ FunctionDeclaration: {
304
+ parameters: 1,
305
+ body: 1,
552
306
  },
553
- ],
554
- 'prefer-exponentiation-operator': 'error',
555
- 'prefer-object-spread': 'error',
556
- 'quote-props': ['error', 'as-needed', { keywords: false, unnecessary: true, numbers: false }],
557
- quotes: ['error', 'single', { avoidEscape: true }],
558
- 'require-jsdoc': 'off',
559
- semi: ['error', 'always'],
560
- 'semi-spacing': ['error', { before: false, after: true }],
561
- 'semi-style': ['error', 'last'],
562
- 'sort-keys': ['off', 'asc', { caseSensitive: false, natural: true }],
563
- 'sort-vars': 'off',
564
- 'space-before-blocks': 'error',
565
- 'space-before-function-paren': ['error', {
566
- anonymous: 'always',
567
- named: 'never',
568
- asyncArrow: 'always',
569
- }],
570
- 'space-in-parens': ['error', 'never'],
571
- 'space-infix-ops': 'error',
572
- 'space-unary-ops': ['error', {
573
- words: true,
574
- nonwords: false,
575
- overrides: {},
576
- }],
577
- 'spaced-comment': ['error', 'always', {
578
- line: {
579
- exceptions: ['-', '+'],
580
- markers: ['=', '!', '/'],
581
- },
582
- block: {
583
- exceptions: ['-', '+'],
584
- markers: ['=', '!', ':', '::'],
585
- balanced: true,
586
- },
587
- }],
588
- 'switch-colon-spacing': ['error', { after: true, before: false }],
589
- 'template-tag-spacing': ['error', 'never'],
590
- 'unicode-bom': ['error', 'never'],
591
- 'wrap-regex': 'off',
592
- // ES6 (from airbnb-base)
593
- 'arrow-body-style': ['error', 'as-needed', {
594
- requireReturnForObjectLiteral: false,
595
- }],
596
- 'arrow-parens': ['error', 'as-needed'],
597
- 'arrow-spacing': ['error', { before: true, after: true }],
598
- 'constructor-super': 'error',
599
- 'generator-star-spacing': ['error', { before: false, after: true }],
600
- 'no-class-assign': 'error',
601
- 'no-confusing-arrow': ['error', {
602
- allowParens: true,
603
- }],
604
- 'no-const-assign': 'error',
605
- 'no-dupe-class-members': 'error',
606
- 'no-duplicate-imports': 'off',
607
- 'no-new-symbol': 'error',
608
- 'no-restricted-exports': ['error', {
609
- restrictedNamedExports: [
610
- 'default',
611
- 'then',
612
- ],
613
- }],
614
- 'no-restricted-imports': ['off', {
615
- paths: [],
616
- patterns: [],
617
- }],
618
- 'no-this-before-super': 'error',
619
- 'no-useless-computed-key': 'error',
620
- 'no-useless-constructor': 'error',
621
- 'no-useless-rename': ['error', {
622
- ignoreDestructuring: false,
623
- ignoreImport: false,
624
- ignoreExport: false,
625
- }],
626
- 'no-var': 'error',
627
- 'object-shorthand': ['error', 'never'],
628
- 'prefer-arrow-callback': ['error', {
629
- allowNamedFunctions: false,
630
- allowUnboundThis: true,
631
- }],
632
- 'prefer-const': ['error', {
633
- destructuring: 'any',
634
- ignoreReadBeforeAssign: true,
635
- }],
636
- 'prefer-destructuring': ['error', {
637
- VariableDeclarator: {
638
- array: false,
639
- object: true,
640
- },
641
- AssignmentExpression: {
642
- array: true,
643
- object: false,
644
- },
645
- }, {
646
- enforceForRenamedProperties: false,
647
- }],
648
- 'prefer-numeric-literals': 'error',
649
- 'prefer-reflect': 'off',
650
- 'prefer-rest-params': 'error',
651
- 'prefer-spread': 'error',
652
- 'prefer-template': 'error',
653
- 'require-yield': 'error',
654
- 'rest-spread-spacing': ['error', 'never'],
655
- 'sort-imports': ['off', {
656
- ignoreCase: false,
657
- ignoreDeclarationSort: false,
658
- ignoreMemberSort: false,
659
- memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
660
- }],
661
- 'symbol-description': 'error',
662
- 'template-curly-spacing': 'error',
663
- 'yield-star-spacing': ['error', 'after'],
664
- // Variables (from airbnb-base)
665
- 'init-declarations': 'off',
666
- 'no-catch-shadow': 'off',
667
- 'no-delete-var': 'error',
668
- 'no-label-var': 'error',
669
- 'no-restricted-globals': [
670
- 'error',
671
- {
672
- name: 'isFinite',
673
- message: 'Use Number.isFinite instead https://github.com/airbnb/javascript#standard-library--isfinite',
307
+ FunctionExpression: {
308
+ parameters: 1,
309
+ body: 1,
674
310
  },
675
- {
676
- name: 'isNaN',
677
- message: 'Use Number.isNaN instead https://github.com/airbnb/javascript#standard-library--isnan',
311
+ CallExpression: {
312
+ arguments: 1,
678
313
  },
679
- 'addEventListener',
680
- 'blur',
681
- 'close',
682
- 'closed',
683
- 'confirm',
684
- 'defaultStatus',
685
- 'defaultstatus',
686
- 'event',
687
- 'external',
688
- 'find',
689
- 'focus',
690
- 'frameElement',
691
- 'frames',
692
- 'history',
693
- 'innerHeight',
694
- 'innerWidth',
695
- 'length',
696
- 'location',
697
- 'locationbar',
698
- 'menubar',
699
- 'moveBy',
700
- 'moveTo',
701
- 'name',
702
- 'onblur',
703
- 'onerror',
704
- 'onfocus',
705
- 'onload',
706
- 'onresize',
707
- 'onunload',
708
- 'open',
709
- 'opener',
710
- 'opera',
711
- 'outerHeight',
712
- 'outerWidth',
713
- 'pageXOffset',
714
- 'pageYOffset',
715
- 'parent',
716
- 'print',
717
- 'removeEventListener',
718
- 'resizeBy',
719
- 'resizeTo',
720
- 'screen',
721
- 'screenLeft',
722
- 'screenTop',
723
- 'screenX',
724
- 'screenY',
725
- 'scroll',
726
- 'scrollbars',
727
- 'scrollBy',
728
- 'scrollTo',
729
- 'scrollX',
730
- 'scrollY',
731
- 'self',
732
- 'status',
733
- 'statusbar',
734
- 'stop',
735
- 'toolbar',
736
- 'top',
737
- ],
738
- 'no-shadow': 'error',
739
- 'no-shadow-restricted-names': 'error',
740
- 'no-undef': 'error',
741
- 'no-undef-init': 'error',
742
- 'no-undefined': 'off',
743
- 'no-unused-vars': [
744
- 'error',
745
- {
746
- args: 'after-used',
747
- ignoreRestSiblings: true,
314
+ ArrayExpression: 1,
315
+ ObjectExpression: 1,
316
+ ImportDeclaration: 1,
317
+ flatTernaryExpressions: false,
318
+ ignoredNodes: [
319
+ 'JSXElement',
320
+ 'JSXElement > *',
321
+ 'JSXAttribute',
322
+ 'JSXIdentifier',
323
+ 'JSXNamespacedName',
324
+ 'JSXMemberExpression',
325
+ 'JSXSpreadAttribute',
326
+ 'JSXExpressionContainer',
327
+ 'JSXOpeningElement',
328
+ 'JSXClosingElement',
329
+ 'JSXFragment',
330
+ 'JSXOpeningFragment',
331
+ 'JSXClosingFragment',
332
+ 'JSXText',
333
+ 'JSXEmptyExpression',
334
+ 'JSXSpreadChild',
335
+ ],
336
+ ignoreComments: false,
337
+ },
338
+ ],
339
+ '@stylistic/jsx-quotes': ['error', 'prefer-double'],
340
+ '@stylistic/key-spacing': ['error', { beforeColon: false, afterColon: true }],
341
+ '@stylistic/keyword-spacing': ['error', {
342
+ before: true,
343
+ after: true,
344
+ overrides: {
345
+ return: { after: true },
346
+ throw: { after: true },
347
+ case: { after: true },
748
348
  },
749
- ],
750
- 'no-use-before-define': [
751
- 'error',
752
- {
753
- functions: false,
349
+ }],
350
+ 'line-comment-position': ['off', {
351
+ position: 'above',
352
+ ignorePattern: '',
353
+ applyDefaultPatterns: true,
354
+ }],
355
+ '@stylistic/linebreak-style': ['error', 'unix'],
356
+ '@stylistic/lines-between-class-members': ['error', 'always', { exceptAfterSingleLine: false }],
357
+ '@stylistic/lines-around-comment': 'off',
358
+ 'max-depth': ['off', 4],
359
+ '@stylistic/max-len': [
360
+ 'error',
361
+ {
362
+ code: 120,
363
+ ignoreStrings: false,
364
+ ignoreComments: false,
365
+ ignoreTemplateLiterals: false,
366
+ ignoreTrailingComments: false,
367
+ ignoreUrls: false,
368
+ },
369
+ ],
370
+ 'max-lines': ['off', {
371
+ max: 300,
372
+ skipBlankLines: true,
373
+ skipComments: true,
374
+ }],
375
+ 'max-lines-per-function': ['off', {
376
+ max: 50,
377
+ skipBlankLines: true,
378
+ skipComments: true,
379
+ IIFEs: true,
380
+ }],
381
+ 'max-nested-callbacks': 'off',
382
+ 'max-params': ['off', 3],
383
+ 'max-statements': ['off', 10],
384
+ '@stylistic/max-statements-per-line': ['off', { max: 1 }],
385
+ '@stylistic/multiline-comment-style': ['off', 'starred-block'],
386
+ '@stylistic/multiline-ternary': ['error', 'always-multiline'],
387
+ 'new-cap': ['error', {
388
+ newIsCap: true,
389
+ newIsCapExceptions: [],
390
+ capIsNew: false,
391
+ capIsNewExceptions: ['Immutable.Map', 'Immutable.Set', 'Immutable.List'],
392
+ }],
393
+ '@stylistic/new-parens': 'error',
394
+ '@stylistic/newline-per-chained-call': 'off',
395
+ 'no-array-constructor': 'error',
396
+ 'no-bitwise': 'off',
397
+ 'no-continue': 'off',
398
+ 'no-inline-comments': 'off',
399
+ 'no-lonely-if': 'error',
400
+ '@stylistic/no-mixed-operators': ['error', {
401
+ groups: [
402
+ ['%', '**'],
403
+ ['%', '+'],
404
+ ['%', '-'],
405
+ ['%', '*'],
406
+ ['%', '/'],
407
+ ['/', '*'],
408
+ ['&', '|', '<<', '>>', '>>>'],
409
+ ['==', '!=', '===', '!=='],
410
+ ['&&', '||'],
411
+ ],
412
+ allowSamePrecedence: false,
413
+ }],
414
+ '@stylistic/no-mixed-spaces-and-tabs': 'error',
415
+ 'no-multi-assign': ['error'],
416
+ '@stylistic/no-multiple-empty-lines': [
417
+ 'error',
418
+ {
419
+ max: 1,
420
+ maxEOF: 0,
421
+ maxBOF: 0,
422
+ },
423
+ ],
424
+ 'no-negated-condition': 'off',
425
+ 'no-nested-ternary': 'error',
426
+ 'no-plusplus': 'off',
427
+ 'no-restricted-syntax': [
428
+ 'error',
429
+ 'ForInStatement',
430
+ 'LabeledStatement',
431
+ 'WithStatement',
432
+ ],
433
+ '@stylistic/no-tabs': 'error',
434
+ 'no-ternary': 'off',
435
+ '@stylistic/no-trailing-spaces': ['error', {
436
+ skipBlankLines: false,
437
+ ignoreComments: false,
438
+ }],
439
+ 'no-underscore-dangle': 'off',
440
+ 'no-unneeded-ternary': ['error', { defaultAssignment: false }],
441
+ '@stylistic/no-whitespace-before-property': 'error',
442
+ '@stylistic/nonblock-statement-body-position': ['error', 'beside', { overrides: {} }],
443
+ '@stylistic/object-curly-spacing': ['error', 'never'],
444
+ '@stylistic/object-curly-newline': [
445
+ 'error',
446
+ {
447
+ multiline: true,
448
+ consistent: true,
449
+ },
450
+ ],
451
+ '@stylistic/object-property-newline': ['error', {
452
+ allowAllPropertiesOnSameLine: true,
453
+ }],
454
+ 'one-var': ['error', 'never'],
455
+ '@stylistic/one-var-declaration-per-line': ['error', 'always'],
456
+ 'operator-assignment': ['error', 'always'],
457
+ '@stylistic/operator-linebreak': ['error', 'before', { overrides: { '=': 'ignore' } }],
458
+ '@stylistic/padded-blocks': ['error', {
459
+ blocks: 'never',
460
+ classes: 'never',
461
+ switches: 'never',
462
+ }, {
463
+ allowSingleLineBlocks: true,
464
+ }],
465
+ '@stylistic/padding-line-between-statements': [
466
+ 'error',
467
+ {
468
+ blankLine: 'always',
469
+ prev: '*',
470
+ next: [
471
+ 'try',
472
+ ],
473
+ },
474
+ {
475
+ blankLine: 'always',
476
+ prev: [
477
+ 'break',
478
+ 'return',
479
+ ],
480
+ next: [
481
+ 'case',
482
+ 'default',
483
+ ],
484
+ },
485
+ {
486
+ blankLine: 'always',
487
+ prev: [
488
+ 'const',
489
+ 'let',
490
+ 'var',
491
+ ],
492
+ next: '*',
493
+ },
494
+ {
495
+ blankLine: 'any',
496
+ prev: [
497
+ 'const',
498
+ 'let',
499
+ 'var',
500
+ ],
501
+ next: [
502
+ 'const',
503
+ 'let',
504
+ 'var',
505
+ ],
506
+ },
507
+ {
508
+ blankLine: 'always',
509
+ prev: '*',
510
+ next: [
511
+ 'break',
512
+ 'continue',
513
+ 'return',
514
+ 'if',
515
+ 'function',
516
+ 'block',
517
+ 'block-like',
518
+ ],
519
+ },
520
+ {
521
+ blankLine: 'any',
522
+ prev: [
523
+ 'case',
524
+ ],
525
+ next: [
526
+ 'case',
527
+ ],
528
+ },
529
+ ],
530
+ 'prefer-exponentiation-operator': 'error',
531
+ 'prefer-object-spread': 'error',
532
+ '@stylistic/quote-props': ['error', 'as-needed', { keywords: false, unnecessary: true, numbers: true }],
533
+ '@stylistic/quotes': ['error', 'single', { avoidEscape: true }],
534
+ '@stylistic/semi': ['error', 'always'],
535
+ '@stylistic/semi-spacing': ['error', { before: false, after: true }],
536
+ '@stylistic/semi-style': ['error', 'last'],
537
+ 'sort-keys': ['off', 'asc', { caseSensitive: false, natural: true }],
538
+ 'sort-vars': 'off',
539
+ '@stylistic/space-before-blocks': 'error',
540
+ '@stylistic/space-before-function-paren': ['error', {
541
+ anonymous: 'always',
542
+ named: 'never',
543
+ asyncArrow: 'always',
544
+ }],
545
+ '@stylistic/space-in-parens': ['error', 'never'],
546
+ '@stylistic/space-infix-ops': 'error',
547
+ '@stylistic/space-unary-ops': ['error', {
548
+ words: true,
549
+ nonwords: false,
550
+ overrides: {},
551
+ }],
552
+ '@stylistic/spaced-comment': ['error', 'always', {
553
+ line: {
554
+ exceptions: ['-', '+'],
555
+ markers: ['=', '!', '/'],
754
556
  },
755
- ],
756
- // Strict (from airbnb-base)
757
- strict: ['error', 'never'],
758
- // Node (from airbnb-base)
759
- 'callback-return': 'off',
760
- 'global-require': 'error',
761
- 'handle-callback-err': 'off',
762
- 'no-buffer-constructor': 'error',
763
- 'no-mixed-requires': ['off', false],
764
- 'no-new-require': 'error',
765
- 'no-path-concat': 'error',
766
- 'no-process-env': 'off',
767
- 'no-process-exit': 'off',
768
- 'no-restricted-modules': 'off',
769
- 'no-sync': 'off',
770
- // Import rules (from airbnb-base)
771
- 'import/no-unresolved': 'off',
772
- 'import/named': 'error',
773
- 'import/default': 'off',
774
- 'import/namespace': 'off',
775
- 'import/export': 'error',
776
- 'import/no-named-as-default': 'error',
777
- 'import/no-named-as-default-member': 'error',
778
- 'import/no-deprecated': 'off',
779
- 'import/no-extraneous-dependencies': 'off',
780
- 'import/no-mutable-exports': 'error',
781
- 'import/no-commonjs': 'off',
782
- 'import/no-amd': 'error',
783
- 'import/no-nodejs-modules': 'off',
784
- 'import/first': 'error',
785
- 'import/imports-first': 'off',
786
- 'import/no-duplicates': 'error',
787
- 'import/no-namespace': 'off',
788
- 'import/extensions': [
789
- 'error',
790
- 'never',
791
- {
792
- d: 'always',
793
- json: 'always',
557
+ block: {
558
+ exceptions: ['-', '+'],
559
+ markers: ['=', '!', ':', '::'],
560
+ balanced: true,
794
561
  },
795
- ],
796
- 'import/order': ['error', { groups: [['builtin', 'external', 'internal']] }],
797
- 'import/newline-after-import': 'error',
798
- 'import/prefer-default-export': 'off',
799
- 'import/no-restricted-paths': 'off',
800
- 'import/max-dependencies': ['off', { max: 10 }],
801
- 'import/no-absolute-path': 'error',
802
- 'import/no-dynamic-require': 'error',
803
- 'import/no-internal-modules': ['off', {
804
- allow: [],
805
- }],
806
- 'import/unambiguous': 'off',
807
- 'import/no-webpack-loader-syntax': 'error',
808
- 'import/no-unassigned-import': 'off',
809
- 'import/no-named-default': 'error',
810
- 'import/no-anonymous-default-export': ['off', {
811
- allowArray: false,
812
- allowArrowFunction: false,
813
- allowAnonymousClass: false,
814
- allowAnonymousFunction: false,
815
- allowLiteral: false,
816
- allowObject: false,
817
- }],
818
- 'import/exports-last': 'off',
819
- 'import/group-exports': 'off',
820
- 'import/no-default-export': 'error',
821
- 'import/no-named-export': 'off',
822
- 'import/no-self-import': 'error',
823
- 'import/no-cycle': ['error', { maxDepth: Infinity }],
824
- 'import/no-useless-path-segments': ['error', { commonjs: true }],
825
- 'import/dynamic-import-chunkname': ['off', {
826
- importFunctions: [],
827
- webpackChunknameFormat: '[0-9a-zA-Z-_/.]+',
828
- }],
829
- 'import/no-relative-parent-imports': 'off',
830
- 'import/no-unused-modules': ['off', {
831
- ignoreExports: [],
832
- missingExports: true,
833
- unusedExports: true,
834
- }],
835
- 'import/no-import-module-exports': ['error', {
836
- exceptions: [],
837
- }],
838
- 'import/no-relative-packages': 'error',
839
- // Custom plugin rules
840
- 'import-newlines/enforce': [
841
- 'error',
842
- {
843
- items: 6,
844
- 'max-len': 120,
562
+ }],
563
+ '@stylistic/switch-colon-spacing': ['error', { after: true, before: false }],
564
+ '@stylistic/template-tag-spacing': ['error', 'never'],
565
+ 'unicode-bom': ['error', 'never'],
566
+ '@stylistic/wrap-regex': 'off',
567
+ // ES6 (from airbnb-base)
568
+ 'arrow-body-style': ['error', 'as-needed', {
569
+ requireReturnForObjectLiteral: false,
570
+ }],
571
+ '@stylistic/arrow-parens': ['error', 'as-needed'],
572
+ '@stylistic/arrow-spacing': ['error', { before: true, after: true }],
573
+ 'constructor-super': 'error',
574
+ '@stylistic/generator-star-spacing': ['error', { before: false, after: true }],
575
+ 'no-class-assign': 'error',
576
+ '@stylistic/no-confusing-arrow': ['error', {
577
+ allowParens: true,
578
+ }],
579
+ 'no-const-assign': 'error',
580
+ 'no-dupe-class-members': 'error',
581
+ 'no-duplicate-imports': 'off',
582
+ 'no-new-symbol': 'error',
583
+ 'no-restricted-exports': ['error', {
584
+ restrictedNamedExports: [
585
+ 'default',
586
+ 'then',
587
+ ],
588
+ }],
589
+ 'no-restricted-imports': ['off', {
590
+ paths: [],
591
+ patterns: [],
592
+ }],
593
+ 'no-this-before-super': 'error',
594
+ 'no-useless-computed-key': 'error',
595
+ 'no-useless-constructor': 'error',
596
+ 'no-useless-rename': ['error', {
597
+ ignoreDestructuring: false,
598
+ ignoreImport: false,
599
+ ignoreExport: false,
600
+ }],
601
+ 'no-var': 'error',
602
+ 'object-shorthand': ['error', 'never'],
603
+ 'prefer-arrow-callback': ['error', {
604
+ allowNamedFunctions: false,
605
+ allowUnboundThis: true,
606
+ }],
607
+ 'prefer-const': ['error', {
608
+ destructuring: 'any',
609
+ ignoreReadBeforeAssign: true,
610
+ }],
611
+ 'prefer-destructuring': ['error', {
612
+ VariableDeclarator: {
613
+ array: false,
614
+ object: true,
845
615
  },
846
- ],
847
- 'no-smart-quotes/no-smart-quotes': 'error',
848
- 'newline-destructuring/newline': [
849
- 'error',
850
- {
851
- maxLength: 100,
852
- itemsWithRest: Infinity,
853
- items: Infinity,
616
+ AssignmentExpression: {
617
+ array: true,
618
+ object: false,
854
619
  },
855
- ],
856
- // Jest rules
857
- 'jest/consistent-test-it': [
858
- 'error',
859
- {
860
- fn: 'it',
620
+ }, {
621
+ enforceForRenamedProperties: false,
622
+ }],
623
+ 'prefer-numeric-literals': 'error',
624
+ 'prefer-rest-params': 'error',
625
+ 'prefer-spread': 'error',
626
+ 'prefer-template': 'error',
627
+ 'require-yield': 'error',
628
+ '@stylistic/rest-spread-spacing': ['error', 'never'],
629
+ 'sort-imports': ['off', {
630
+ ignoreCase: false,
631
+ ignoreDeclarationSort: false,
632
+ ignoreMemberSort: false,
633
+ memberSyntaxSortOrder: ['none', 'all', 'multiple', 'single'],
634
+ }],
635
+ 'symbol-description': 'error',
636
+ '@stylistic/template-curly-spacing': 'error',
637
+ '@stylistic/yield-star-spacing': ['error', 'after'],
638
+ // Variables (from airbnb-base)
639
+ 'init-declarations': 'off',
640
+ 'no-delete-var': 'error',
641
+ 'no-label-var': 'error',
642
+ 'no-restricted-globals': [
643
+ 'error',
644
+ {
645
+ name: 'isFinite',
646
+ message: 'Use Number.isFinite instead https://github.com/airbnb/javascript#standard-library--isfinite',
647
+ },
648
+ {
649
+ name: 'isNaN',
650
+ message: 'Use Number.isNaN instead https://github.com/airbnb/javascript#standard-library--isnan',
651
+ },
652
+ 'addEventListener',
653
+ 'blur',
654
+ 'close',
655
+ 'closed',
656
+ 'confirm',
657
+ 'defaultStatus',
658
+ 'defaultstatus',
659
+ 'event',
660
+ 'external',
661
+ 'find',
662
+ 'focus',
663
+ 'frameElement',
664
+ 'frames',
665
+ 'history',
666
+ 'innerHeight',
667
+ 'innerWidth',
668
+ 'length',
669
+ 'location',
670
+ 'locationbar',
671
+ 'menubar',
672
+ 'moveBy',
673
+ 'moveTo',
674
+ 'name',
675
+ 'onblur',
676
+ 'onerror',
677
+ 'onfocus',
678
+ 'onload',
679
+ 'onresize',
680
+ 'onunload',
681
+ 'open',
682
+ 'opener',
683
+ 'opera',
684
+ 'outerHeight',
685
+ 'outerWidth',
686
+ 'pageXOffset',
687
+ 'pageYOffset',
688
+ 'parent',
689
+ 'print',
690
+ 'removeEventListener',
691
+ 'resizeBy',
692
+ 'resizeTo',
693
+ 'screen',
694
+ 'screenLeft',
695
+ 'screenTop',
696
+ 'screenX',
697
+ 'screenY',
698
+ 'scroll',
699
+ 'scrollbars',
700
+ 'scrollBy',
701
+ 'scrollTo',
702
+ 'scrollX',
703
+ 'scrollY',
704
+ 'self',
705
+ 'status',
706
+ 'statusbar',
707
+ 'stop',
708
+ 'toolbar',
709
+ 'top',
710
+ ],
711
+ 'no-shadow': 'error',
712
+ 'no-shadow-restricted-names': 'error',
713
+ 'no-undef': 'error',
714
+ 'no-undef-init': 'error',
715
+ 'no-undefined': 'off',
716
+ 'no-unused-vars': [
717
+ 'error',
718
+ {
719
+ args: 'after-used',
720
+ ignoreRestSiblings: true,
721
+ },
722
+ ],
723
+ 'no-use-before-define': [
724
+ 'error',
725
+ {
726
+ functions: false,
727
+ },
728
+ ],
729
+ // Strict (from airbnb-base)
730
+ strict: ['error', 'never'],
731
+ // Import rules (from airbnb-base)
732
+ 'import-x/no-unresolved': 'off',
733
+ 'import-x/default': 'off',
734
+ 'import-x/namespace': 'off',
735
+ 'import-x/export': 'error',
736
+ 'import-x/no-named-as-default': 'error',
737
+ 'import-x/no-named-as-default-member': 'error',
738
+ 'import-x/no-deprecated': 'off',
739
+ 'import-x/no-extraneous-dependencies': 'off',
740
+ 'import-x/no-mutable-exports': 'error',
741
+ 'import-x/no-commonjs': 'off',
742
+ 'import-x/no-amd': 'error',
743
+ 'import-x/no-nodejs-modules': 'off',
744
+ 'import-x/first': 'error',
745
+ 'import-x/no-duplicates': 'error',
746
+ 'import-x/no-namespace': 'off',
747
+ 'import-x/extensions': [
748
+ 'error',
749
+ 'never',
750
+ {
751
+ d: 'always',
752
+ json: 'always',
753
+ },
754
+ ],
755
+ 'import-x/order': ['error', { groups: [['builtin', 'external', 'internal']] }],
756
+ 'import-x/newline-after-import': 'error',
757
+ 'import-x/prefer-default-export': 'off',
758
+ 'import-x/no-restricted-paths': 'off',
759
+ 'import-x/max-dependencies': ['off', { max: 10 }],
760
+ 'import-x/no-absolute-path': 'error',
761
+ 'import-x/no-dynamic-require': 'error',
762
+ 'import-x/no-internal-modules': ['off', {
763
+ allow: [],
764
+ }],
765
+ 'import-x/unambiguous': 'off',
766
+ 'import-x/no-webpack-loader-syntax': 'error',
767
+ 'import-x/no-unassigned-import': 'off',
768
+ 'import-x/no-named-default': 'error',
769
+ 'import-x/no-anonymous-default-export': ['off', {
770
+ allowArray: false,
771
+ allowArrowFunction: false,
772
+ allowAnonymousClass: false,
773
+ allowAnonymousFunction: false,
774
+ allowLiteral: false,
775
+ allowObject: false,
776
+ }],
777
+ 'import-x/exports-last': 'off',
778
+ 'import-x/group-exports': 'off',
779
+ 'import-x/no-default-export': 'error',
780
+ 'import-x/no-named-export': 'off',
781
+ 'import-x/no-self-import': 'error',
782
+ 'import-x/no-cycle': ['error', { maxDepth: Infinity }],
783
+ 'import-x/no-useless-path-segments': ['error', { commonjs: true }],
784
+ 'import-x/dynamic-import-chunkname': ['off', {
785
+ importFunctions: [],
786
+ webpackChunknameFormat: '[0-9a-zA-Z-_/.]+',
787
+ }],
788
+ 'import-x/no-relative-parent-imports': 'off',
789
+ 'import-x/no-unused-modules': ['off', {
790
+ ignoreExports: [],
791
+ missingExports: true,
792
+ unusedExports: true,
793
+ }],
794
+ 'import-x/no-import-module-exports': ['error', {
795
+ exceptions: [],
796
+ }],
797
+ 'import-x/no-relative-packages': 'error',
798
+ // Custom plugin rules
799
+ 'import-newlines/enforce': [
800
+ 'error',
801
+ {
802
+ items: 6,
803
+ 'max-len': 120,
804
+ },
805
+ ],
806
+ 'newline-destructuring/newline': [
807
+ 'error',
808
+ {
809
+ maxLength: 100,
810
+ itemsWithRest: Infinity,
811
+ items: Infinity,
812
+ },
813
+ ],
814
+ // Jest rules
815
+ 'jest/consistent-test-it': [
816
+ 'error',
817
+ {
818
+ fn: 'it',
819
+ },
820
+ ],
821
+ 'jest/no-large-snapshots': 'off',
822
+ 'jest/prefer-expect-resolves': 'error',
823
+ 'jest/prefer-lowercase-title': [
824
+ 'error',
825
+ {
826
+ ignore: ['describe'],
827
+ },
828
+ ],
829
+ 'jest/prefer-spy-on': 'error',
830
+ 'jest/require-top-level-describe': 'error',
831
+ 'jest/prefer-to-contain': 'error',
832
+ 'jest/prefer-hooks-on-top': 'error',
833
+ 'jest/prefer-equality-matcher': 'error',
834
+ 'jest/no-test-return-statement': 'error',
835
+ };
836
+ exports.baseRules = baseRules;
837
+ // Factory function to create JavaScript config with the plugin reference
838
+ function createJavaScriptConfig(plugin) {
839
+ return [
840
+ eslint_plugin_jest_1.default.configs['flat/recommended'],
841
+ {
842
+ name: '@croct/javascript',
843
+ plugins: {
844
+ '@stylistic': eslint_plugin_1.default,
845
+ '@eslint-community/eslint-comments': eslint_plugin_eslint_comments_1.default,
846
+ 'import-newlines': eslint_plugin_import_newlines_1.default,
847
+ // import-x exports types using ESLint v8 for compatibility reasons,
848
+ // but it is compatible with ESLint v9 as well.
849
+ 'import-x': eslint_plugin_import_x_1.importX,
850
+ 'newline-destructuring': eslint_plugin_newline_destructuring_1.default,
851
+ '@croct': plugin,
861
852
  },
862
- ],
863
- 'jest/no-large-snapshots': 'off',
864
- 'jest/prefer-expect-resolves': 'error',
865
- 'jest/prefer-lowercase-title': [
866
- 'error',
867
- {
868
- ignore: ['describe'],
853
+ languageOptions: {
854
+ ecmaVersion: 2018,
855
+ sourceType: 'module',
856
+ globals: {
857
+ ...globals_1.default.es2017,
858
+ ...globals_1.default.node,
859
+ },
869
860
  },
870
- ],
871
- 'jest/prefer-spy-on': 'error',
872
- 'jest/require-top-level-describe': 'error',
873
- 'jest/prefer-to-contain': 'error',
874
- 'jest/prefer-hooks-on-top': 'error',
875
- 'jest/prefer-equality-matcher': 'error',
876
- 'jest/no-test-return-statement': 'error',
877
- },
878
- overrides: [
879
- {
880
- files: [
881
- 'src/**/*.test.js',
882
- 'test/**/*.js',
883
- ],
884
- extends: ['plugin:jest/recommended'],
885
- plugins: ['jest'],
886
861
  rules: {
887
- 'no-new-object': 'off',
888
- },
889
- env: {
890
- jest: true,
862
+ ...eslint_plugin_eslint_comments_1.default.configs.recommended.rules,
863
+ ...baseRules,
891
864
  },
892
865
  },
893
- ],
894
- };
866
+ ];
867
+ }