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