@croct/eslint-plugin 0.8.3 → 0.9.1

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,867 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
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
- },
32
- ],
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,
256
- },
257
- block: {
258
- ignorePattern: '.*',
259
- ignoreInlineComments: true,
260
- ignoreConsecutiveComments: true,
261
- },
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,
278
- },
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,
306
- },
307
- FunctionExpression: {
308
- parameters: 1,
309
- body: 1,
310
- },
311
- CallExpression: {
312
- arguments: 1,
313
- },
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 },
348
- },
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: ['=', '!', '/'],
556
- },
557
- block: {
558
- exceptions: ['-', '+'],
559
- markers: ['=', '!', ':', '::'],
560
- balanced: true,
561
- },
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,
615
- },
616
- AssignmentExpression: {
617
- array: true,
618
- object: false,
619
- },
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,
852
- },
853
- languageOptions: {
854
- ecmaVersion: 2018,
855
- sourceType: 'module',
856
- globals: {
857
- ...globals_1.default.es2017,
858
- ...globals_1.default.node,
859
- },
860
- },
861
- rules: {
862
- ...eslint_plugin_eslint_comments_1.default.configs.recommended.rules,
863
- ...baseRules,
864
- },
865
- },
866
- ];
867
- }