eslint-config-webpack 4.9.2 → 4.9.4

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.
@@ -2,24 +2,22 @@ import {
2
2
  javascriptExtensions,
3
3
  typescriptExtensions,
4
4
  } from "./utils/extensions.js";
5
+ import getJsonFile from "./utils/get-json-file.js";
6
+ import isTypescriptInstalled from "./utils/is-typescript-installed.js";
7
+
8
+ const isTypescriptInstalledResult = isTypescriptInstalled();
5
9
 
6
10
  /**
7
- * @returns {Promise<Record<string, string>>} config
11
+ * @returns {Promise<import("eslint").Linter.Config>} config
8
12
  */
9
13
  async function getTypescriptJSDocRecommendedConfig() {
10
- let jsdocPlugin;
11
-
12
- try {
13
- jsdocPlugin = (await import("eslint-plugin-jsdoc")).default;
14
- // eslint-disable-next-line unicorn/prefer-optional-catch-binding
15
- } catch (_err) {
16
- // Nothing
14
+ if (!isTypescriptInstalledResult) {
15
+ return { name: "typescript/please-install-typescript-to-enable-it" };
17
16
  }
18
17
 
18
+ const jsdocPlugin = (await import("eslint-plugin-jsdoc")).default;
19
19
  const jsdocConfig =
20
- (jsdocPlugin &&
21
- jsdocPlugin.configs["flat/recommended-typescript-flavor-error"]) ||
22
- {};
20
+ jsdocPlugin.configs["flat/recommended-typescript-flavor-error"];
23
21
 
24
22
  return {
25
23
  ...jsdocConfig,
@@ -37,7 +35,7 @@ async function getTypescriptJSDocRecommendedConfig() {
37
35
  message: `@${tag} currently not supported in TypeScript`,
38
36
  };
39
37
  return acc;
40
- }, {}),
38
+ }, /** @type {Record<string, { message: string }>} */ ({})),
41
39
  extends: "extends",
42
40
  return: "returns",
43
41
  constructor: "constructor",
@@ -307,482 +305,518 @@ async function getTypescriptJSDocRecommendedConfig() {
307
305
  }
308
306
 
309
307
  /**
310
- * @returns {Promise<Record<string, string>>} config
308
+ * @returns {Promise<import("eslint").Linter.Config | import("eslint").Linter.Config[]>} config
311
309
  */
312
310
  async function getTypescriptRecommendedConfig() {
313
- let typescriptPlugin;
311
+ if (!isTypescriptInstalledResult) {
312
+ return { name: "typescript/please-install-typescript-to-enable-it" };
313
+ }
314
+
315
+ const tsconfigJson = getJsonFile("tsconfig.json");
316
+
317
+ const isNoEmitEnabled =
318
+ (tsconfigJson &&
319
+ tsconfigJson.compilerOptions &&
320
+ tsconfigJson.compilerOptions.noEmit) ||
321
+ false;
314
322
 
315
- try {
316
- typescriptPlugin = (await import("typescript-eslint")).default;
317
- // eslint-disable-next-line unicorn/prefer-optional-catch-binding
318
- } catch (_err) {
319
- // Nothing
323
+ if (isNoEmitEnabled) {
324
+ return { name: "typescript/no-emit-enabled" };
320
325
  }
321
326
 
322
- const { configs } = typescriptPlugin || {
323
- configs: {
324
- base: { languageOptions: {} },
325
- eslintRecommended: {},
326
- recommended: [{ name: "typescript-eslint/recommended", rules: {} }],
327
- stylistic: [{ name: "typescript-eslint/stylistic", rules: {} }],
328
- },
329
- };
327
+ const isStrict =
328
+ (tsconfigJson &&
329
+ tsconfigJson.compilerOptions &&
330
+ tsconfigJson.compilerOptions.strict) ||
331
+ true;
332
+
333
+ const typescriptPlugin = (await import("typescript-eslint")).default;
334
+ const { configs } = typescriptPlugin;
335
+ /** @type {import("eslint").Linter.Config} */
330
336
  const baseConfig = configs.base;
337
+ /** @type {import("eslint").Linter.Config} */
331
338
  const eslintRecommendedConfig = configs.eslintRecommended;
332
- const recommendedConfig = configs.recommended.find(
333
- (item) => item.name === "typescript-eslint/recommended",
334
- );
335
- const stylisticConfig = configs.stylistic.find(
336
- (item) => item.name === "typescript-eslint/stylistic",
337
- );
339
+
340
+ const recommendedConfig =
341
+ /** @type {import("eslint").Linter.Config} */
342
+ (
343
+ configs.recommended.find(
344
+ (item) => item.name === "typescript-eslint/recommended",
345
+ )
346
+ );
347
+
348
+ const stylisticConfig =
349
+ /** @type {import("eslint").Linter.Config} */
350
+ (
351
+ configs.stylistic.find(
352
+ (item) => item.name === "typescript-eslint/stylistic",
353
+ )
354
+ );
338
355
 
339
356
  const allExtensions = [...typescriptExtensions, ...javascriptExtensions];
340
357
 
341
- return {
342
- ...baseConfig,
343
- name: "typescript/recommended",
344
- files: [
345
- `**/*.{${typescriptExtensions.map((item) => item.slice(1)).join(",")}}`,
346
- ],
347
- ignores: ["**/*.d.ts"],
348
- languageOptions: {
349
- parser: baseConfig.languageOptions.parser,
350
- },
351
- plugins: {
352
- ...baseConfig.plugins,
353
- },
354
- settings: {
355
- "import/extensions": allExtensions,
356
- "import/external-module-folders": ["node_modules", "node_modules/@types"],
357
- "import/parsers": {
358
- "@typescript-eslint/parser": typescriptExtensions,
358
+ return [
359
+ {
360
+ ...baseConfig,
361
+ name: "typescript/recommended",
362
+ files: [
363
+ `**/*.{${typescriptExtensions.map((item) => item.slice(1)).join(",")}}`,
364
+ ],
365
+ ignores: ["**/*.d.ts"],
366
+ languageOptions: {
367
+ parser: (baseConfig.languageOptions || {}).parser,
368
+ },
369
+ plugins: {
370
+ ...baseConfig.plugins,
359
371
  },
360
- "import/resolver": {
361
- node: {
362
- extensions: allExtensions,
372
+ settings: {
373
+ "import/extensions": allExtensions,
374
+ "import/external-module-folders": [
375
+ "node_modules",
376
+ "node_modules/@types",
377
+ ],
378
+ "import/parsers": {
379
+ "@typescript-eslint/parser": typescriptExtensions,
380
+ },
381
+ "import/resolver": {
382
+ node: {
383
+ extensions: allExtensions,
384
+ },
363
385
  },
364
386
  },
365
- },
366
- rules: {
367
- ...eslintRecommendedConfig.rules,
368
- ...recommendedConfig.rules,
369
- ...stylisticConfig.rules,
387
+ rules: {
388
+ ...eslintRecommendedConfig.rules,
389
+ ...recommendedConfig.rules,
390
+ ...stylisticConfig.rules,
370
391
 
371
- // From recommended
372
- // "@typescript-eslint/adjacent-overload-signatures": "error",
392
+ // From recommended
393
+ // "@typescript-eslint/adjacent-overload-signatures": "error",
373
394
 
374
- // From recommended
375
- // "@typescript-eslint/array-type": "error",
395
+ // From recommended
396
+ // "@typescript-eslint/array-type": "error",
376
397
 
377
- // No need
378
- // "@typescript-eslint/await-thenable": "error",
398
+ // No need
399
+ // "@typescript-eslint/await-thenable": "error",
379
400
 
380
- // From recommended
381
- // "@typescript-eslint/ban-ts-comment": "error",
401
+ // From recommended
402
+ // "@typescript-eslint/ban-ts-comment": "error",
382
403
 
383
- // From recommended
384
- // "@typescript-eslint/ban-tslint-comment": "error",
404
+ // From recommended
405
+ // "@typescript-eslint/ban-tslint-comment": "error",
385
406
 
386
- // From recommended
387
- // "@typescript-eslint/class-literal-property-style": "error",
407
+ // From recommended
408
+ // "@typescript-eslint/class-literal-property-style": "error",
388
409
 
389
- // No need
390
- // "@typescript-eslint/class-methods-use-this": "error",
410
+ // No need
411
+ // "@typescript-eslint/class-methods-use-this": "error",
391
412
 
392
- // From recommended
393
- // "@typescript-eslint/consistent-generic-constructors": "error",
413
+ // From recommended
414
+ // "@typescript-eslint/consistent-generic-constructors": "error",
394
415
 
395
- // From recommended
396
- // "@typescript-eslint/consistent-indexed-object-style": "error",
416
+ // From recommended
417
+ // "@typescript-eslint/consistent-indexed-object-style": "error",
397
418
 
398
- // No need
399
- // "@typescript-eslint/consistent-return": "error",
419
+ // No need
420
+ // "@typescript-eslint/consistent-return": "error",
400
421
 
401
- // From recommended
402
- // "@typescript-eslint/consistent-type-assertions": "error",
422
+ // From recommended
423
+ // "@typescript-eslint/consistent-type-assertions": "error",
403
424
 
404
- // From recommended
405
- // "@typescript-eslint/consistent-type-definitions": "error",
425
+ // From recommended
426
+ // "@typescript-eslint/consistent-type-definitions": "error",
406
427
 
407
- // No need
408
- // "@typescript-eslint/consistent-type-exports": "error",
428
+ // No need
429
+ // "@typescript-eslint/consistent-type-exports": "error",
409
430
 
410
- // No need
411
- // "@typescript-eslint/consistent-type-imports": "error",
431
+ // No need
432
+ // "@typescript-eslint/consistent-type-imports": "error",
412
433
 
413
- // The same as `default-param-last`
414
- "default-param-last": "off",
415
- "@typescript-eslint/default-param-last": "error",
434
+ // The same as `default-param-last`
435
+ "default-param-last": "off",
436
+ "@typescript-eslint/default-param-last": "error",
416
437
 
417
- // No need
418
- // we have `dot-notation`
419
- // "@typescript-eslint/dot-notation": "error",
438
+ // No need
439
+ // we have `dot-notation`
440
+ // "@typescript-eslint/dot-notation": "error",
420
441
 
421
- // No need
422
- // "@typescript-eslint/explicit-function-return-type": "error",
442
+ // No need
443
+ // "@typescript-eslint/explicit-function-return-type": "error",
423
444
 
424
- "@typescript-eslint/explicit-member-accessibility": [
425
- "error",
426
- { accessibility: "no-public" },
427
- ],
445
+ "@typescript-eslint/explicit-member-accessibility": [
446
+ "error",
447
+ { accessibility: "no-public" },
448
+ ],
428
449
 
429
- // No need
430
- // "@typescript-eslint/explicit-module-boundary-types": "error",
450
+ // No need
451
+ // "@typescript-eslint/explicit-module-boundary-types": "error",
431
452
 
432
- // No need
433
- // "@typescript-eslint/init-declarations": "error",
453
+ // No need
454
+ // "@typescript-eslint/init-declarations": "error",
434
455
 
435
- // No need
436
- // "@typescript-eslint/max-params": "error",
456
+ // No need
457
+ // "@typescript-eslint/max-params": "error",
437
458
 
438
- // No need
439
- // "@typescript-eslint/member-ordering": "error",
459
+ // No need
460
+ // "@typescript-eslint/member-ordering": "error",
440
461
 
441
- // No need
442
- // "@typescript-eslint/method-signature-style": "error",
462
+ // No need
463
+ // "@typescript-eslint/method-signature-style": "error",
443
464
 
444
- // No need
445
- // "@typescript-eslint/naming-convention": "error",
465
+ // No need
466
+ // "@typescript-eslint/naming-convention": "error",
446
467
 
447
- // From recommended
448
- // "@typescript-eslint/no-array-constructor": "error",
468
+ // From recommended
469
+ // "@typescript-eslint/no-array-constructor": "error",
449
470
 
450
- // No need
451
- // "@typescript-eslint/no-array-delete": "error",
471
+ // No need
472
+ // "@typescript-eslint/no-array-delete": "error",
452
473
 
453
- // No need
454
- // "@typescript-eslint/no-base-to-string": "error",
474
+ // No need
475
+ // "@typescript-eslint/no-base-to-string": "error",
455
476
 
456
- // From recommended
457
- // "@typescript-eslint/no-confusing-non-null-assertion": "error",
477
+ // From recommended
478
+ // "@typescript-eslint/no-confusing-non-null-assertion": "error",
458
479
 
459
- // No need
460
- // "@typescript-eslint/no-confusing-void-expression": "error",
480
+ // No need
481
+ // "@typescript-eslint/no-confusing-void-expression": "error",
461
482
 
462
- // No need
463
- // Good rule, but some packages can change their API often, and it will create noise in CI
464
- // "@typescript-eslint/no-deprecated": "error",
483
+ // No need
484
+ // Good rule, but some packages can change their API often, and it will create noise in CI
485
+ // "@typescript-eslint/no-deprecated": "error",
465
486
 
466
- // No need
467
- // "@typescript-eslint/no-dupe-class-members": "error",
487
+ // No need
488
+ // "@typescript-eslint/no-dupe-class-members": "error",
468
489
 
469
- // From recommended
470
- // "@typescript-eslint/no-duplicate-enum-values": "error",
490
+ // From recommended
491
+ // "@typescript-eslint/no-duplicate-enum-values": "error",
471
492
 
472
- // No need
473
- // "@typescript-eslint/no-dynamic-delete": "error",
493
+ // No need
494
+ // "@typescript-eslint/no-dynamic-delete": "error",
474
495
 
475
- // From recommended
476
- // "@typescript-eslint/no-empty-function": "error",
496
+ // From recommended
497
+ // "@typescript-eslint/no-empty-function": "error",
477
498
 
478
- // From recommended
479
- // "@typescript-eslint/no-empty-object-type": "error",
499
+ // From recommended
500
+ // "@typescript-eslint/no-empty-object-type": "error",
480
501
 
481
- // From recommended
482
- // "@typescript-eslint/no-explicit-any": "error",
502
+ // From recommended
503
+ // "@typescript-eslint/no-explicit-any": "error",
483
504
 
484
- // From recommended
485
- // "@typescript-eslint/no-extra-non-null-assertion": "error",
505
+ // From recommended
506
+ // "@typescript-eslint/no-extra-non-null-assertion": "error",
486
507
 
487
- // No need
488
- // "@typescript-eslint/no-extraneous-class": "error",
508
+ // No need
509
+ // "@typescript-eslint/no-extraneous-class": "error",
489
510
 
490
- // No need
491
- // "@typescript-eslint/no-floating-promises": "error",
511
+ // No need
512
+ // "@typescript-eslint/no-floating-promises": "error",
492
513
 
493
- // No need
494
- // "@typescript-eslint/no-for-in-array": "error",
514
+ // No need
515
+ // "@typescript-eslint/no-for-in-array": "error",
495
516
 
496
- // No need
497
- // "@typescript-eslint/no-implied-eval": "error",
517
+ // No need
518
+ // "@typescript-eslint/no-implied-eval": "error",
498
519
 
499
- // No need
500
- // "@typescript-eslint/no-import-type-side-effects": "error",
520
+ // No need
521
+ // "@typescript-eslint/no-import-type-side-effects": "error",
501
522
 
502
- // From recommended
503
- // "@typescript-eslint/no-inferrable-types": "error",
523
+ // From recommended
524
+ // "@typescript-eslint/no-inferrable-types": "error",
504
525
 
505
- // No need
506
- // "@typescript-eslint/no-invalid-this": "error",
526
+ // No need
527
+ // "@typescript-eslint/no-invalid-this": "error",
507
528
 
508
- // No need
509
- // "@typescript-eslint/no-invalid-void-type": "error",
529
+ // No need
530
+ // "@typescript-eslint/no-invalid-void-type": "error",
510
531
 
511
- // The same as `no-loop-func`
512
- "no-loop-func": "off",
513
- "@typescript-eslint/no-loop-func": "error",
532
+ // The same as `no-loop-func`
533
+ "no-loop-func": "off",
534
+ "@typescript-eslint/no-loop-func": "error",
514
535
 
515
- // No need
516
- // "@typescript-eslint/no-magic-numbers": "error",
536
+ // No need
537
+ // "@typescript-eslint/no-magic-numbers": "error",
517
538
 
518
- // No need
519
- // "@typescript-eslint/no-meaningless-void-operator": "error",
539
+ // No need
540
+ // "@typescript-eslint/no-meaningless-void-operator": "error",
520
541
 
521
- // From recommended
522
- // "@typescript-eslint/no-misused-new": "error",
542
+ // From recommended
543
+ // "@typescript-eslint/no-misused-new": "error",
523
544
 
524
- // No need
525
- // "@typescript-eslint/no-misused-promises": "error",
545
+ // No need
546
+ // "@typescript-eslint/no-misused-promises": "error",
526
547
 
527
- // No need
528
- // "@typescript-eslint/no-misused-spread": "error",
548
+ // No need
549
+ // "@typescript-eslint/no-misused-spread": "error",
529
550
 
530
- // No need
531
- // "@typescript-eslint/no-mixed-enums": "error",
551
+ // No need
552
+ // "@typescript-eslint/no-mixed-enums": "error",
532
553
 
533
- // No need
534
- // "@typescript-eslint/no-namespace": "error",
554
+ // No need
555
+ // "@typescript-eslint/no-namespace": "error",
535
556
 
536
- // No need
537
- // "@typescript-eslint/no-non-null-asserted-nullish-coalescing": "error",
557
+ // No need
558
+ // "@typescript-eslint/no-non-null-asserted-nullish-coalescing": "error",
538
559
 
539
- // From recommended
540
- // "@typescript-eslint/no-non-null-asserted-optional-chain": "error",
560
+ // From recommended
561
+ // "@typescript-eslint/no-non-null-asserted-optional-chain": "error",
541
562
 
542
- // No need
543
- // "@typescript-eslint/no-non-null-assertion": "error",
563
+ // No need
564
+ // "@typescript-eslint/no-non-null-assertion": "error",
544
565
 
545
- // No need
546
- // "@typescript-eslint/no-redeclare": "error",
566
+ // No need
567
+ // "@typescript-eslint/no-redeclare": "error",
547
568
 
548
- // No need
549
- // "@typescript-eslint/no-redundant-type-constituents": "error",
569
+ // No need
570
+ // "@typescript-eslint/no-redundant-type-constituents": "error",
550
571
 
551
- // Module system provided in `node/module`/`node/commonjs`/etc configurations
552
- "@typescript-eslint/no-require-imports": "off",
572
+ // Module system provided in `node/module`/`node/commonjs`/etc configurations
573
+ "@typescript-eslint/no-require-imports": "off",
553
574
 
554
- // No need
555
- // "@typescript-eslint/no-restricted-imports": "error",
575
+ // No need
576
+ // "@typescript-eslint/no-restricted-imports": "error",
556
577
 
557
- // No need
558
- // "@typescript-eslint/no-restricted-types": "error",
578
+ // No need
579
+ // "@typescript-eslint/no-restricted-types": "error",
559
580
 
560
- // No need
561
- // "@typescript-eslint/no-shadow": "error",
581
+ // No need
582
+ // "@typescript-eslint/no-shadow": "error",
562
583
 
563
- // From recommended
564
- // "@typescript-eslint/no-this-alias": "error",
584
+ // From recommended
585
+ "@typescript-eslint/no-this-alias": [
586
+ "error",
587
+ { allowedNames: ["self"] },
588
+ ],
565
589
 
566
- // No need
567
- // "@typescript-eslint/no-unnecessary-boolean-literal-compare": "error",
590
+ // No need
591
+ // "@typescript-eslint/no-unnecessary-boolean-literal-compare": "error",
568
592
 
569
- // "@typescript-eslint/no-unnecessary-condition": "error",
593
+ // "@typescript-eslint/no-unnecessary-condition": "error",
570
594
 
571
- "@typescript-eslint/no-unnecessary-parameter-property-assignment":
572
- "error",
595
+ "@typescript-eslint/no-unnecessary-parameter-property-assignment":
596
+ "error",
573
597
 
574
- // No need
575
- // "@typescript-eslint/no-unnecessary-qualifier": "error",
598
+ // No need
599
+ // "@typescript-eslint/no-unnecessary-qualifier": "error",
576
600
 
577
- // No need
578
- // "@typescript-eslint/no-unnecessary-template-expression": "error",
601
+ // No need
602
+ // "@typescript-eslint/no-unnecessary-template-expression": "error",
579
603
 
580
- // No need
581
- // "@typescript-eslint/no-unnecessary-type-arguments": "error",
604
+ // No need
605
+ // "@typescript-eslint/no-unnecessary-type-arguments": "error",
582
606
 
583
- // No need
584
- // "@typescript-eslint/no-unnecessary-type-assertion": "error",
607
+ // No need
608
+ // "@typescript-eslint/no-unnecessary-type-assertion": "error",
585
609
 
586
- // From recommended
587
- // "@typescript-eslint/no-unnecessary-type-constraint": "error",
610
+ // From recommended
611
+ // "@typescript-eslint/no-unnecessary-type-constraint": "error",
588
612
 
589
- // No need
590
- // "@typescript-eslint/no-unnecessary-type-conversion": "error",
613
+ // No need
614
+ // "@typescript-eslint/no-unnecessary-type-conversion": "error",
591
615
 
592
- // No need
593
- // "@typescript-eslint/no-unnecessary-type-parameters": "error",
616
+ // No need
617
+ // "@typescript-eslint/no-unnecessary-type-parameters": "error",
594
618
 
595
- // No need
596
- // "@typescript-eslint/no-unsafe-argument": "error",
619
+ // No need
620
+ // "@typescript-eslint/no-unsafe-argument": "error",
597
621
 
598
- // No need
599
- // "@typescript-eslint/no-unsafe-assignment": "error",
622
+ // No need
623
+ // "@typescript-eslint/no-unsafe-assignment": "error",
600
624
 
601
- // No need
602
- // "@typescript-eslint/no-unsafe-call": "error",
625
+ // No need
626
+ // "@typescript-eslint/no-unsafe-call": "error",
603
627
 
604
- // From recommended
605
- // "@typescript-eslint/no-unsafe-declaration-merging": "error",
628
+ // From recommended
629
+ // "@typescript-eslint/no-unsafe-declaration-merging": "error",
606
630
 
607
- // No need
608
- // "@typescript-eslint/no-unsafe-enum-comparison": "error",
631
+ // No need
632
+ // "@typescript-eslint/no-unsafe-enum-comparison": "error",
609
633
 
610
- // From recommended
611
- // "@typescript-eslint/no-unsafe-function-type": "error",
634
+ // From recommended
635
+ // "@typescript-eslint/no-unsafe-function-type": "error",
612
636
 
613
- // No need
614
- // "@typescript-eslint/no-unsafe-member-access": "error",
637
+ // No need
638
+ // "@typescript-eslint/no-unsafe-member-access": "error",
615
639
 
616
- // No need
617
- // "@typescript-eslint/no-unsafe-return": "error",
640
+ // No need
641
+ // "@typescript-eslint/no-unsafe-return": "error",
618
642
 
619
- // No need
620
- // "@typescript-eslint/no-unsafe-type-assertion": "error",
643
+ // No need
644
+ // "@typescript-eslint/no-unsafe-type-assertion": "error",
621
645
 
622
- // No need
623
- // "@typescript-eslint/no-unsafe-unary-minus": "error",
646
+ // No need
647
+ // "@typescript-eslint/no-unsafe-unary-minus": "error",
624
648
 
625
- // From recommended
626
- // "@typescript-eslint/no-unused-expressions": "error",
649
+ // From recommended
650
+ // "@typescript-eslint/no-unused-expressions": "error",
627
651
 
628
- "no-unused-private-class-members": "off",
629
- "@typescript-eslint/no-unused-private-class-members": "error",
652
+ "no-unused-private-class-members": "off",
653
+ "@typescript-eslint/no-unused-private-class-members": "error",
630
654
 
631
- // Provide better options
632
- "no-unused-vars": "off",
633
- "@typescript-eslint/no-unused-vars": [
634
- "error",
635
- {
636
- args: "after-used",
637
- argsIgnorePattern: "^_",
638
- caughtErrors: "all",
639
- caughtErrorsIgnorePattern: "^_",
640
- destructuredArrayIgnorePattern: "^_",
641
- ignoreRestSiblings: true,
642
- ignoreClassWithStaticInitBlock: false,
643
- reportUsedIgnorePattern: false,
644
- },
645
- ],
655
+ // Provide better options
656
+ "no-unused-vars": "off",
657
+ "@typescript-eslint/no-unused-vars": [
658
+ "error",
659
+ {
660
+ args: "after-used",
661
+ argsIgnorePattern: "^_",
662
+ caughtErrors: "all",
663
+ caughtErrorsIgnorePattern: "^_",
664
+ destructuredArrayIgnorePattern: "^_",
665
+ ignoreRestSiblings: true,
666
+ ignoreClassWithStaticInitBlock: false,
667
+ reportUsedIgnorePattern: false,
668
+ },
669
+ ],
646
670
 
647
- // From recommended
648
- // "@typescript-eslint/no-unused-vars": "error",
671
+ // From recommended
672
+ // "@typescript-eslint/no-unused-vars": "error",
649
673
 
650
- // The same as `no-use-before-define`
651
- "no-use-before-define": "off",
652
- "@typescript-eslint/no-use-before-define": [
653
- "error",
654
- {
655
- functions: true,
656
- classes: true,
657
- variables: true,
658
- enums: true,
659
- typedefs: true,
660
- },
661
- ],
674
+ // The same as `no-use-before-define`
675
+ "no-use-before-define": "off",
676
+ "@typescript-eslint/no-use-before-define": [
677
+ "error",
678
+ {
679
+ functions: true,
680
+ classes: true,
681
+ variables: true,
682
+ enums: true,
683
+ typedefs: true,
684
+ },
685
+ ],
662
686
 
663
- // No need
664
- // "@typescript-eslint/no-useless-constructor": "error",
687
+ // No need
688
+ // "@typescript-eslint/no-useless-constructor": "error",
665
689
 
666
- // No need
667
- // "@typescript-eslint/no-useless-default-assignment": "error",
690
+ // No need
691
+ // "@typescript-eslint/no-useless-default-assignment": "error",
668
692
 
669
- "@typescript-eslint/no-useless-empty-export": "error",
693
+ "@typescript-eslint/no-useless-empty-export": "error",
670
694
 
671
- // From recommended
672
- "@typescript-eslint/no-wrapper-object-types": "error",
695
+ // From recommended
696
+ "@typescript-eslint/no-wrapper-object-types": "error",
673
697
 
674
- // No need
675
- // "@typescript-eslint/non-nullable-type-assertion-style": "error",
698
+ // No need
699
+ // "@typescript-eslint/non-nullable-type-assertion-style": "error",
676
700
 
677
- // No need
678
- // "@typescript-eslint/only-throw-error": "error",
701
+ // No need
702
+ // "@typescript-eslint/only-throw-error": "error",
679
703
 
680
- // No need
681
- // "@typescript-eslint/parameter-properties": "error",
704
+ // No need
705
+ // "@typescript-eslint/parameter-properties": "error",
682
706
 
683
- // From recommended
684
- // "@typescript-eslint/prefer-as-const": "error",
707
+ // From recommended
708
+ // "@typescript-eslint/prefer-as-const": "error",
685
709
 
686
- // No need
687
- // "@typescript-eslint/prefer-destructuring": "error",
710
+ // No need
711
+ // "@typescript-eslint/prefer-destructuring": "error",
688
712
 
689
- // No need
690
- // "@typescript-eslint/prefer-enum-initializers": "error",
713
+ // No need
714
+ // "@typescript-eslint/prefer-enum-initializers": "error",
691
715
 
692
- // No need
693
- // "@typescript-eslint/prefer-find": "error",
716
+ // No need
717
+ // "@typescript-eslint/prefer-find": "error",
694
718
 
695
- // From recommended
696
- // "@typescript-eslint/prefer-for-of": "error",
719
+ // From recommended
720
+ // "@typescript-eslint/prefer-for-of": "error",
697
721
 
698
- // From recommended
699
- // "@typescript-eslint/prefer-function-type": "error",
722
+ // From recommended
723
+ // "@typescript-eslint/prefer-function-type": "error",
700
724
 
701
- // No need
702
- // "@typescript-eslint/prefer-includes": "error",
725
+ // No need
726
+ // "@typescript-eslint/prefer-includes": "error",
703
727
 
704
- // No need
705
- // "@typescript-eslint/prefer-literal-enum-member": "error",
728
+ // No need
729
+ // "@typescript-eslint/prefer-literal-enum-member": "error",
706
730
 
707
- // From recommended
708
- // "@typescript-eslint/prefer-namespace-keyword": "error",
731
+ // From recommended
732
+ // "@typescript-eslint/prefer-namespace-keyword": "error",
709
733
 
710
- // No need
711
- // "@typescript-eslint/prefer-nullish-coalescing": "error",
734
+ // No need
735
+ // "@typescript-eslint/prefer-nullish-coalescing": "error",
712
736
 
713
- // No need
714
- // "@typescript-eslint/prefer-optional-chain": "error",
737
+ // No need
738
+ // "@typescript-eslint/prefer-optional-chain": "error",
715
739
 
716
- // No need
717
- // "@typescript-eslint/prefer-promise-reject-errors": "error",
740
+ // No need
741
+ // "@typescript-eslint/prefer-promise-reject-errors": "error",
718
742
 
719
- // No need
720
- // "@typescript-eslint/prefer-readonly": "error",
743
+ // No need
744
+ // "@typescript-eslint/prefer-readonly": "error",
721
745
 
722
- // No need
723
- // "@typescript-eslint/prefer-readonly-parameter-types": "error",
746
+ // No need
747
+ // "@typescript-eslint/prefer-readonly-parameter-types": "error",
724
748
 
725
- // No need
726
- // "@typescript-eslint/prefer-reduce-type-parameter": "error",
749
+ // No need
750
+ // "@typescript-eslint/prefer-reduce-type-parameter": "error",
727
751
 
728
- // No need
729
- // "@typescript-eslint/prefer-regexp-exec": "error",
752
+ // No need
753
+ // "@typescript-eslint/prefer-regexp-exec": "error",
730
754
 
731
- // No need
732
- // "@typescript-eslint/prefer-return-this-type": "error",
755
+ // No need
756
+ // "@typescript-eslint/prefer-return-this-type": "error",
733
757
 
734
- // No need
735
- // "@typescript-eslint/prefer-string-starts-ends-with": "error",
758
+ // No need
759
+ // "@typescript-eslint/prefer-string-starts-ends-with": "error",
736
760
 
737
- // No need
738
- // "@typescript-eslint/promise-function-async": "error",
761
+ // No need
762
+ // "@typescript-eslint/promise-function-async": "error",
739
763
 
740
- // No need
741
- // "@typescript-eslint/related-getter-setter-pairs": "error",
764
+ // No need
765
+ // "@typescript-eslint/related-getter-setter-pairs": "error",
742
766
 
743
- // No need
744
- // "@typescript-eslint/require-array-sort-compare": "error",
767
+ // No need
768
+ // "@typescript-eslint/require-array-sort-compare": "error",
745
769
 
746
- // No need
747
- // "@typescript-eslint/require-await": "error",
770
+ // No need
771
+ // "@typescript-eslint/require-await": "error",
748
772
 
749
- // No need
750
- // "@typescript-eslint/restrict-plus-operands": "error",
773
+ // No need
774
+ // "@typescript-eslint/restrict-plus-operands": "error",
751
775
 
752
- // No need
753
- // "@typescript-eslint/restrict-template-expressions": "error",
776
+ // No need
777
+ // "@typescript-eslint/restrict-template-expressions": "error",
754
778
 
755
- // No need
756
- // "@typescript-eslint/return-await": "error",
779
+ // No need
780
+ // "@typescript-eslint/return-await": "error",
757
781
 
758
- // No need
759
- // "@typescript-eslint/strict-boolean-expressions": "error",
782
+ // No need
783
+ // "@typescript-eslint/strict-boolean-expressions": "error",
760
784
 
761
- // No need
762
- // "@typescript-eslint/switch-exhaustiveness-check": "error",
785
+ // No need
786
+ // "@typescript-eslint/switch-exhaustiveness-check": "error",
763
787
 
764
- // From recommended
765
- // "@typescript-eslint/triple-slash-reference": "error",
788
+ // From recommended
789
+ // "@typescript-eslint/triple-slash-reference": "error",
766
790
 
767
- // No need
768
- // "@typescript-eslint/unbound-method": "error",
791
+ // No need
792
+ // "@typescript-eslint/unbound-method": "error",
769
793
 
770
- // No need
771
- // "@typescript-eslint/unified-signatures": "error",
794
+ // No need
795
+ // "@typescript-eslint/unified-signatures": "error",
772
796
 
773
- // No need
774
- // "use-unknown-in-catch-callback-variable": "error",
797
+ // No need
798
+ // "use-unknown-in-catch-callback-variable": "error",
775
799
 
776
- // TypeScript compilation already ensures that named imports exist in the referenced module
777
- "import/named": "off",
800
+ // TypeScript compilation already ensures that named imports exist in the referenced module
801
+ "import/named": "off",
778
802
 
779
- // TypeScript handles this for us
780
- "import/no-unresolved": "off",
803
+ // TypeScript handles this for us
804
+ "import/no-unresolved": "off",
805
+ },
781
806
  },
782
- };
807
+ isStrict
808
+ ? {
809
+ files: [
810
+ `**/*.{${typescriptExtensions.map((item) => item.slice(1)).join(",")}}`,
811
+ ],
812
+ ignores: ["**/*.d.ts"],
813
+ rules: { strict: "off" },
814
+ }
815
+ : {},
816
+ ];
783
817
  }
784
818
 
785
819
  export default {
786
- "typescript/recommended": await getTypescriptRecommendedConfig(),
787
820
  "typescript/jsdoc": await getTypescriptJSDocRecommendedConfig(),
821
+ "typescript/recommended": await getTypescriptRecommendedConfig(),
788
822
  };