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.
- package/configs/browser.js +4 -0
- package/configs/index.js +38 -12
- package/configs/javascript.js +57 -37
- package/configs/jest.js +31 -9
- package/configs/markdown.js +2 -9
- package/configs/node.js +19 -40
- package/configs/package-json.js +2 -3
- package/configs/react.js +26 -20
- package/configs/stylistic.js +1 -0
- package/configs/typescript.js +378 -344
- package/configs/utils/get-json-file.js +10 -4
- package/configs/utils/is-typescript-installed.js +4 -3
- package/configs/webpack-special.js +2 -3
- package/configs.js +54 -133
- package/package.json +20 -15
- package/plugins/package-json/index.js +4 -1
- package/plugins/package-json/rules/order-properties.js +27 -26
- package/plugins/webpack/index.js +3 -1
- package/plugins/webpack/rules/require-license-comment.js +17 -10
package/configs/typescript.js
CHANGED
|
@@ -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<
|
|
11
|
+
* @returns {Promise<import("eslint").Linter.Config>} config
|
|
8
12
|
*/
|
|
9
13
|
async function getTypescriptJSDocRecommendedConfig() {
|
|
10
|
-
|
|
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
|
-
|
|
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<
|
|
308
|
+
* @returns {Promise<import("eslint").Linter.Config | import("eslint").Linter.Config[]>} config
|
|
311
309
|
*/
|
|
312
310
|
async function getTypescriptRecommendedConfig() {
|
|
313
|
-
|
|
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
|
-
|
|
316
|
-
|
|
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
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
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
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
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
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
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
|
-
|
|
361
|
-
|
|
362
|
-
|
|
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
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
...stylisticConfig.rules,
|
|
387
|
+
rules: {
|
|
388
|
+
...eslintRecommendedConfig.rules,
|
|
389
|
+
...recommendedConfig.rules,
|
|
390
|
+
...stylisticConfig.rules,
|
|
370
391
|
|
|
371
|
-
|
|
372
|
-
|
|
392
|
+
// From recommended
|
|
393
|
+
// "@typescript-eslint/adjacent-overload-signatures": "error",
|
|
373
394
|
|
|
374
|
-
|
|
375
|
-
|
|
395
|
+
// From recommended
|
|
396
|
+
// "@typescript-eslint/array-type": "error",
|
|
376
397
|
|
|
377
|
-
|
|
378
|
-
|
|
398
|
+
// No need
|
|
399
|
+
// "@typescript-eslint/await-thenable": "error",
|
|
379
400
|
|
|
380
|
-
|
|
381
|
-
|
|
401
|
+
// From recommended
|
|
402
|
+
// "@typescript-eslint/ban-ts-comment": "error",
|
|
382
403
|
|
|
383
|
-
|
|
384
|
-
|
|
404
|
+
// From recommended
|
|
405
|
+
// "@typescript-eslint/ban-tslint-comment": "error",
|
|
385
406
|
|
|
386
|
-
|
|
387
|
-
|
|
407
|
+
// From recommended
|
|
408
|
+
// "@typescript-eslint/class-literal-property-style": "error",
|
|
388
409
|
|
|
389
|
-
|
|
390
|
-
|
|
410
|
+
// No need
|
|
411
|
+
// "@typescript-eslint/class-methods-use-this": "error",
|
|
391
412
|
|
|
392
|
-
|
|
393
|
-
|
|
413
|
+
// From recommended
|
|
414
|
+
// "@typescript-eslint/consistent-generic-constructors": "error",
|
|
394
415
|
|
|
395
|
-
|
|
396
|
-
|
|
416
|
+
// From recommended
|
|
417
|
+
// "@typescript-eslint/consistent-indexed-object-style": "error",
|
|
397
418
|
|
|
398
|
-
|
|
399
|
-
|
|
419
|
+
// No need
|
|
420
|
+
// "@typescript-eslint/consistent-return": "error",
|
|
400
421
|
|
|
401
|
-
|
|
402
|
-
|
|
422
|
+
// From recommended
|
|
423
|
+
// "@typescript-eslint/consistent-type-assertions": "error",
|
|
403
424
|
|
|
404
|
-
|
|
405
|
-
|
|
425
|
+
// From recommended
|
|
426
|
+
// "@typescript-eslint/consistent-type-definitions": "error",
|
|
406
427
|
|
|
407
|
-
|
|
408
|
-
|
|
428
|
+
// No need
|
|
429
|
+
// "@typescript-eslint/consistent-type-exports": "error",
|
|
409
430
|
|
|
410
|
-
|
|
411
|
-
|
|
431
|
+
// No need
|
|
432
|
+
// "@typescript-eslint/consistent-type-imports": "error",
|
|
412
433
|
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
434
|
+
// The same as `default-param-last`
|
|
435
|
+
"default-param-last": "off",
|
|
436
|
+
"@typescript-eslint/default-param-last": "error",
|
|
416
437
|
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
438
|
+
// No need
|
|
439
|
+
// we have `dot-notation`
|
|
440
|
+
// "@typescript-eslint/dot-notation": "error",
|
|
420
441
|
|
|
421
|
-
|
|
422
|
-
|
|
442
|
+
// No need
|
|
443
|
+
// "@typescript-eslint/explicit-function-return-type": "error",
|
|
423
444
|
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
445
|
+
"@typescript-eslint/explicit-member-accessibility": [
|
|
446
|
+
"error",
|
|
447
|
+
{ accessibility: "no-public" },
|
|
448
|
+
],
|
|
428
449
|
|
|
429
|
-
|
|
430
|
-
|
|
450
|
+
// No need
|
|
451
|
+
// "@typescript-eslint/explicit-module-boundary-types": "error",
|
|
431
452
|
|
|
432
|
-
|
|
433
|
-
|
|
453
|
+
// No need
|
|
454
|
+
// "@typescript-eslint/init-declarations": "error",
|
|
434
455
|
|
|
435
|
-
|
|
436
|
-
|
|
456
|
+
// No need
|
|
457
|
+
// "@typescript-eslint/max-params": "error",
|
|
437
458
|
|
|
438
|
-
|
|
439
|
-
|
|
459
|
+
// No need
|
|
460
|
+
// "@typescript-eslint/member-ordering": "error",
|
|
440
461
|
|
|
441
|
-
|
|
442
|
-
|
|
462
|
+
// No need
|
|
463
|
+
// "@typescript-eslint/method-signature-style": "error",
|
|
443
464
|
|
|
444
|
-
|
|
445
|
-
|
|
465
|
+
// No need
|
|
466
|
+
// "@typescript-eslint/naming-convention": "error",
|
|
446
467
|
|
|
447
|
-
|
|
448
|
-
|
|
468
|
+
// From recommended
|
|
469
|
+
// "@typescript-eslint/no-array-constructor": "error",
|
|
449
470
|
|
|
450
|
-
|
|
451
|
-
|
|
471
|
+
// No need
|
|
472
|
+
// "@typescript-eslint/no-array-delete": "error",
|
|
452
473
|
|
|
453
|
-
|
|
454
|
-
|
|
474
|
+
// No need
|
|
475
|
+
// "@typescript-eslint/no-base-to-string": "error",
|
|
455
476
|
|
|
456
|
-
|
|
457
|
-
|
|
477
|
+
// From recommended
|
|
478
|
+
// "@typescript-eslint/no-confusing-non-null-assertion": "error",
|
|
458
479
|
|
|
459
|
-
|
|
460
|
-
|
|
480
|
+
// No need
|
|
481
|
+
// "@typescript-eslint/no-confusing-void-expression": "error",
|
|
461
482
|
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
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
|
-
|
|
467
|
-
|
|
487
|
+
// No need
|
|
488
|
+
// "@typescript-eslint/no-dupe-class-members": "error",
|
|
468
489
|
|
|
469
|
-
|
|
470
|
-
|
|
490
|
+
// From recommended
|
|
491
|
+
// "@typescript-eslint/no-duplicate-enum-values": "error",
|
|
471
492
|
|
|
472
|
-
|
|
473
|
-
|
|
493
|
+
// No need
|
|
494
|
+
// "@typescript-eslint/no-dynamic-delete": "error",
|
|
474
495
|
|
|
475
|
-
|
|
476
|
-
|
|
496
|
+
// From recommended
|
|
497
|
+
// "@typescript-eslint/no-empty-function": "error",
|
|
477
498
|
|
|
478
|
-
|
|
479
|
-
|
|
499
|
+
// From recommended
|
|
500
|
+
// "@typescript-eslint/no-empty-object-type": "error",
|
|
480
501
|
|
|
481
|
-
|
|
482
|
-
|
|
502
|
+
// From recommended
|
|
503
|
+
// "@typescript-eslint/no-explicit-any": "error",
|
|
483
504
|
|
|
484
|
-
|
|
485
|
-
|
|
505
|
+
// From recommended
|
|
506
|
+
// "@typescript-eslint/no-extra-non-null-assertion": "error",
|
|
486
507
|
|
|
487
|
-
|
|
488
|
-
|
|
508
|
+
// No need
|
|
509
|
+
// "@typescript-eslint/no-extraneous-class": "error",
|
|
489
510
|
|
|
490
|
-
|
|
491
|
-
|
|
511
|
+
// No need
|
|
512
|
+
// "@typescript-eslint/no-floating-promises": "error",
|
|
492
513
|
|
|
493
|
-
|
|
494
|
-
|
|
514
|
+
// No need
|
|
515
|
+
// "@typescript-eslint/no-for-in-array": "error",
|
|
495
516
|
|
|
496
|
-
|
|
497
|
-
|
|
517
|
+
// No need
|
|
518
|
+
// "@typescript-eslint/no-implied-eval": "error",
|
|
498
519
|
|
|
499
|
-
|
|
500
|
-
|
|
520
|
+
// No need
|
|
521
|
+
// "@typescript-eslint/no-import-type-side-effects": "error",
|
|
501
522
|
|
|
502
|
-
|
|
503
|
-
|
|
523
|
+
// From recommended
|
|
524
|
+
// "@typescript-eslint/no-inferrable-types": "error",
|
|
504
525
|
|
|
505
|
-
|
|
506
|
-
|
|
526
|
+
// No need
|
|
527
|
+
// "@typescript-eslint/no-invalid-this": "error",
|
|
507
528
|
|
|
508
|
-
|
|
509
|
-
|
|
529
|
+
// No need
|
|
530
|
+
// "@typescript-eslint/no-invalid-void-type": "error",
|
|
510
531
|
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
532
|
+
// The same as `no-loop-func`
|
|
533
|
+
"no-loop-func": "off",
|
|
534
|
+
"@typescript-eslint/no-loop-func": "error",
|
|
514
535
|
|
|
515
|
-
|
|
516
|
-
|
|
536
|
+
// No need
|
|
537
|
+
// "@typescript-eslint/no-magic-numbers": "error",
|
|
517
538
|
|
|
518
|
-
|
|
519
|
-
|
|
539
|
+
// No need
|
|
540
|
+
// "@typescript-eslint/no-meaningless-void-operator": "error",
|
|
520
541
|
|
|
521
|
-
|
|
522
|
-
|
|
542
|
+
// From recommended
|
|
543
|
+
// "@typescript-eslint/no-misused-new": "error",
|
|
523
544
|
|
|
524
|
-
|
|
525
|
-
|
|
545
|
+
// No need
|
|
546
|
+
// "@typescript-eslint/no-misused-promises": "error",
|
|
526
547
|
|
|
527
|
-
|
|
528
|
-
|
|
548
|
+
// No need
|
|
549
|
+
// "@typescript-eslint/no-misused-spread": "error",
|
|
529
550
|
|
|
530
|
-
|
|
531
|
-
|
|
551
|
+
// No need
|
|
552
|
+
// "@typescript-eslint/no-mixed-enums": "error",
|
|
532
553
|
|
|
533
|
-
|
|
534
|
-
|
|
554
|
+
// No need
|
|
555
|
+
// "@typescript-eslint/no-namespace": "error",
|
|
535
556
|
|
|
536
|
-
|
|
537
|
-
|
|
557
|
+
// No need
|
|
558
|
+
// "@typescript-eslint/no-non-null-asserted-nullish-coalescing": "error",
|
|
538
559
|
|
|
539
|
-
|
|
540
|
-
|
|
560
|
+
// From recommended
|
|
561
|
+
// "@typescript-eslint/no-non-null-asserted-optional-chain": "error",
|
|
541
562
|
|
|
542
|
-
|
|
543
|
-
|
|
563
|
+
// No need
|
|
564
|
+
// "@typescript-eslint/no-non-null-assertion": "error",
|
|
544
565
|
|
|
545
|
-
|
|
546
|
-
|
|
566
|
+
// No need
|
|
567
|
+
// "@typescript-eslint/no-redeclare": "error",
|
|
547
568
|
|
|
548
|
-
|
|
549
|
-
|
|
569
|
+
// No need
|
|
570
|
+
// "@typescript-eslint/no-redundant-type-constituents": "error",
|
|
550
571
|
|
|
551
|
-
|
|
552
|
-
|
|
572
|
+
// Module system provided in `node/module`/`node/commonjs`/etc configurations
|
|
573
|
+
"@typescript-eslint/no-require-imports": "off",
|
|
553
574
|
|
|
554
|
-
|
|
555
|
-
|
|
575
|
+
// No need
|
|
576
|
+
// "@typescript-eslint/no-restricted-imports": "error",
|
|
556
577
|
|
|
557
|
-
|
|
558
|
-
|
|
578
|
+
// No need
|
|
579
|
+
// "@typescript-eslint/no-restricted-types": "error",
|
|
559
580
|
|
|
560
|
-
|
|
561
|
-
|
|
581
|
+
// No need
|
|
582
|
+
// "@typescript-eslint/no-shadow": "error",
|
|
562
583
|
|
|
563
|
-
|
|
564
|
-
|
|
584
|
+
// From recommended
|
|
585
|
+
"@typescript-eslint/no-this-alias": [
|
|
586
|
+
"error",
|
|
587
|
+
{ allowedNames: ["self"] },
|
|
588
|
+
],
|
|
565
589
|
|
|
566
|
-
|
|
567
|
-
|
|
590
|
+
// No need
|
|
591
|
+
// "@typescript-eslint/no-unnecessary-boolean-literal-compare": "error",
|
|
568
592
|
|
|
569
|
-
|
|
593
|
+
// "@typescript-eslint/no-unnecessary-condition": "error",
|
|
570
594
|
|
|
571
|
-
|
|
572
|
-
|
|
595
|
+
"@typescript-eslint/no-unnecessary-parameter-property-assignment":
|
|
596
|
+
"error",
|
|
573
597
|
|
|
574
|
-
|
|
575
|
-
|
|
598
|
+
// No need
|
|
599
|
+
// "@typescript-eslint/no-unnecessary-qualifier": "error",
|
|
576
600
|
|
|
577
|
-
|
|
578
|
-
|
|
601
|
+
// No need
|
|
602
|
+
// "@typescript-eslint/no-unnecessary-template-expression": "error",
|
|
579
603
|
|
|
580
|
-
|
|
581
|
-
|
|
604
|
+
// No need
|
|
605
|
+
// "@typescript-eslint/no-unnecessary-type-arguments": "error",
|
|
582
606
|
|
|
583
|
-
|
|
584
|
-
|
|
607
|
+
// No need
|
|
608
|
+
// "@typescript-eslint/no-unnecessary-type-assertion": "error",
|
|
585
609
|
|
|
586
|
-
|
|
587
|
-
|
|
610
|
+
// From recommended
|
|
611
|
+
// "@typescript-eslint/no-unnecessary-type-constraint": "error",
|
|
588
612
|
|
|
589
|
-
|
|
590
|
-
|
|
613
|
+
// No need
|
|
614
|
+
// "@typescript-eslint/no-unnecessary-type-conversion": "error",
|
|
591
615
|
|
|
592
|
-
|
|
593
|
-
|
|
616
|
+
// No need
|
|
617
|
+
// "@typescript-eslint/no-unnecessary-type-parameters": "error",
|
|
594
618
|
|
|
595
|
-
|
|
596
|
-
|
|
619
|
+
// No need
|
|
620
|
+
// "@typescript-eslint/no-unsafe-argument": "error",
|
|
597
621
|
|
|
598
|
-
|
|
599
|
-
|
|
622
|
+
// No need
|
|
623
|
+
// "@typescript-eslint/no-unsafe-assignment": "error",
|
|
600
624
|
|
|
601
|
-
|
|
602
|
-
|
|
625
|
+
// No need
|
|
626
|
+
// "@typescript-eslint/no-unsafe-call": "error",
|
|
603
627
|
|
|
604
|
-
|
|
605
|
-
|
|
628
|
+
// From recommended
|
|
629
|
+
// "@typescript-eslint/no-unsafe-declaration-merging": "error",
|
|
606
630
|
|
|
607
|
-
|
|
608
|
-
|
|
631
|
+
// No need
|
|
632
|
+
// "@typescript-eslint/no-unsafe-enum-comparison": "error",
|
|
609
633
|
|
|
610
|
-
|
|
611
|
-
|
|
634
|
+
// From recommended
|
|
635
|
+
// "@typescript-eslint/no-unsafe-function-type": "error",
|
|
612
636
|
|
|
613
|
-
|
|
614
|
-
|
|
637
|
+
// No need
|
|
638
|
+
// "@typescript-eslint/no-unsafe-member-access": "error",
|
|
615
639
|
|
|
616
|
-
|
|
617
|
-
|
|
640
|
+
// No need
|
|
641
|
+
// "@typescript-eslint/no-unsafe-return": "error",
|
|
618
642
|
|
|
619
|
-
|
|
620
|
-
|
|
643
|
+
// No need
|
|
644
|
+
// "@typescript-eslint/no-unsafe-type-assertion": "error",
|
|
621
645
|
|
|
622
|
-
|
|
623
|
-
|
|
646
|
+
// No need
|
|
647
|
+
// "@typescript-eslint/no-unsafe-unary-minus": "error",
|
|
624
648
|
|
|
625
|
-
|
|
626
|
-
|
|
649
|
+
// From recommended
|
|
650
|
+
// "@typescript-eslint/no-unused-expressions": "error",
|
|
627
651
|
|
|
628
|
-
|
|
629
|
-
|
|
652
|
+
"no-unused-private-class-members": "off",
|
|
653
|
+
"@typescript-eslint/no-unused-private-class-members": "error",
|
|
630
654
|
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
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
|
-
|
|
648
|
-
|
|
671
|
+
// From recommended
|
|
672
|
+
// "@typescript-eslint/no-unused-vars": "error",
|
|
649
673
|
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
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
|
-
|
|
664
|
-
|
|
687
|
+
// No need
|
|
688
|
+
// "@typescript-eslint/no-useless-constructor": "error",
|
|
665
689
|
|
|
666
|
-
|
|
667
|
-
|
|
690
|
+
// No need
|
|
691
|
+
// "@typescript-eslint/no-useless-default-assignment": "error",
|
|
668
692
|
|
|
669
|
-
|
|
693
|
+
"@typescript-eslint/no-useless-empty-export": "error",
|
|
670
694
|
|
|
671
|
-
|
|
672
|
-
|
|
695
|
+
// From recommended
|
|
696
|
+
"@typescript-eslint/no-wrapper-object-types": "error",
|
|
673
697
|
|
|
674
|
-
|
|
675
|
-
|
|
698
|
+
// No need
|
|
699
|
+
// "@typescript-eslint/non-nullable-type-assertion-style": "error",
|
|
676
700
|
|
|
677
|
-
|
|
678
|
-
|
|
701
|
+
// No need
|
|
702
|
+
// "@typescript-eslint/only-throw-error": "error",
|
|
679
703
|
|
|
680
|
-
|
|
681
|
-
|
|
704
|
+
// No need
|
|
705
|
+
// "@typescript-eslint/parameter-properties": "error",
|
|
682
706
|
|
|
683
|
-
|
|
684
|
-
|
|
707
|
+
// From recommended
|
|
708
|
+
// "@typescript-eslint/prefer-as-const": "error",
|
|
685
709
|
|
|
686
|
-
|
|
687
|
-
|
|
710
|
+
// No need
|
|
711
|
+
// "@typescript-eslint/prefer-destructuring": "error",
|
|
688
712
|
|
|
689
|
-
|
|
690
|
-
|
|
713
|
+
// No need
|
|
714
|
+
// "@typescript-eslint/prefer-enum-initializers": "error",
|
|
691
715
|
|
|
692
|
-
|
|
693
|
-
|
|
716
|
+
// No need
|
|
717
|
+
// "@typescript-eslint/prefer-find": "error",
|
|
694
718
|
|
|
695
|
-
|
|
696
|
-
|
|
719
|
+
// From recommended
|
|
720
|
+
// "@typescript-eslint/prefer-for-of": "error",
|
|
697
721
|
|
|
698
|
-
|
|
699
|
-
|
|
722
|
+
// From recommended
|
|
723
|
+
// "@typescript-eslint/prefer-function-type": "error",
|
|
700
724
|
|
|
701
|
-
|
|
702
|
-
|
|
725
|
+
// No need
|
|
726
|
+
// "@typescript-eslint/prefer-includes": "error",
|
|
703
727
|
|
|
704
|
-
|
|
705
|
-
|
|
728
|
+
// No need
|
|
729
|
+
// "@typescript-eslint/prefer-literal-enum-member": "error",
|
|
706
730
|
|
|
707
|
-
|
|
708
|
-
|
|
731
|
+
// From recommended
|
|
732
|
+
// "@typescript-eslint/prefer-namespace-keyword": "error",
|
|
709
733
|
|
|
710
|
-
|
|
711
|
-
|
|
734
|
+
// No need
|
|
735
|
+
// "@typescript-eslint/prefer-nullish-coalescing": "error",
|
|
712
736
|
|
|
713
|
-
|
|
714
|
-
|
|
737
|
+
// No need
|
|
738
|
+
// "@typescript-eslint/prefer-optional-chain": "error",
|
|
715
739
|
|
|
716
|
-
|
|
717
|
-
|
|
740
|
+
// No need
|
|
741
|
+
// "@typescript-eslint/prefer-promise-reject-errors": "error",
|
|
718
742
|
|
|
719
|
-
|
|
720
|
-
|
|
743
|
+
// No need
|
|
744
|
+
// "@typescript-eslint/prefer-readonly": "error",
|
|
721
745
|
|
|
722
|
-
|
|
723
|
-
|
|
746
|
+
// No need
|
|
747
|
+
// "@typescript-eslint/prefer-readonly-parameter-types": "error",
|
|
724
748
|
|
|
725
|
-
|
|
726
|
-
|
|
749
|
+
// No need
|
|
750
|
+
// "@typescript-eslint/prefer-reduce-type-parameter": "error",
|
|
727
751
|
|
|
728
|
-
|
|
729
|
-
|
|
752
|
+
// No need
|
|
753
|
+
// "@typescript-eslint/prefer-regexp-exec": "error",
|
|
730
754
|
|
|
731
|
-
|
|
732
|
-
|
|
755
|
+
// No need
|
|
756
|
+
// "@typescript-eslint/prefer-return-this-type": "error",
|
|
733
757
|
|
|
734
|
-
|
|
735
|
-
|
|
758
|
+
// No need
|
|
759
|
+
// "@typescript-eslint/prefer-string-starts-ends-with": "error",
|
|
736
760
|
|
|
737
|
-
|
|
738
|
-
|
|
761
|
+
// No need
|
|
762
|
+
// "@typescript-eslint/promise-function-async": "error",
|
|
739
763
|
|
|
740
|
-
|
|
741
|
-
|
|
764
|
+
// No need
|
|
765
|
+
// "@typescript-eslint/related-getter-setter-pairs": "error",
|
|
742
766
|
|
|
743
|
-
|
|
744
|
-
|
|
767
|
+
// No need
|
|
768
|
+
// "@typescript-eslint/require-array-sort-compare": "error",
|
|
745
769
|
|
|
746
|
-
|
|
747
|
-
|
|
770
|
+
// No need
|
|
771
|
+
// "@typescript-eslint/require-await": "error",
|
|
748
772
|
|
|
749
|
-
|
|
750
|
-
|
|
773
|
+
// No need
|
|
774
|
+
// "@typescript-eslint/restrict-plus-operands": "error",
|
|
751
775
|
|
|
752
|
-
|
|
753
|
-
|
|
776
|
+
// No need
|
|
777
|
+
// "@typescript-eslint/restrict-template-expressions": "error",
|
|
754
778
|
|
|
755
|
-
|
|
756
|
-
|
|
779
|
+
// No need
|
|
780
|
+
// "@typescript-eslint/return-await": "error",
|
|
757
781
|
|
|
758
|
-
|
|
759
|
-
|
|
782
|
+
// No need
|
|
783
|
+
// "@typescript-eslint/strict-boolean-expressions": "error",
|
|
760
784
|
|
|
761
|
-
|
|
762
|
-
|
|
785
|
+
// No need
|
|
786
|
+
// "@typescript-eslint/switch-exhaustiveness-check": "error",
|
|
763
787
|
|
|
764
|
-
|
|
765
|
-
|
|
788
|
+
// From recommended
|
|
789
|
+
// "@typescript-eslint/triple-slash-reference": "error",
|
|
766
790
|
|
|
767
|
-
|
|
768
|
-
|
|
791
|
+
// No need
|
|
792
|
+
// "@typescript-eslint/unbound-method": "error",
|
|
769
793
|
|
|
770
|
-
|
|
771
|
-
|
|
794
|
+
// No need
|
|
795
|
+
// "@typescript-eslint/unified-signatures": "error",
|
|
772
796
|
|
|
773
|
-
|
|
774
|
-
|
|
797
|
+
// No need
|
|
798
|
+
// "use-unknown-in-catch-callback-variable": "error",
|
|
775
799
|
|
|
776
|
-
|
|
777
|
-
|
|
800
|
+
// TypeScript compilation already ensures that named imports exist in the referenced module
|
|
801
|
+
"import/named": "off",
|
|
778
802
|
|
|
779
|
-
|
|
780
|
-
|
|
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
|
};
|