eslint-config-decent 2.0.4 → 2.1.0
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/dist/index.cjs +146 -55
- package/dist/index.d.cts +22 -2
- package/dist/index.d.mts +22 -2
- package/dist/index.d.ts +22 -2
- package/dist/index.mjs +134 -49
- package/package.json +22 -20
- package/src/index.ts +52 -10
- package/src/jest.ts +58 -0
- package/src/react.ts +0 -4
- package/src/testingLibrary.ts +25 -0
- package/src/types/eslint-plugin-jest-dom.d.ts +10 -0
- package/src/types/eslint-plugin-jest.d.ts +11 -0
- package/src/types/eslint-plugin-testing-library.d.ts +4 -1
package/dist/index.cjs
CHANGED
|
@@ -8,6 +8,8 @@ const fs = require('fs');
|
|
|
8
8
|
const path = require('path');
|
|
9
9
|
const utils = require('@typescript-eslint/utils');
|
|
10
10
|
const importPlugin = require('eslint-plugin-import-x');
|
|
11
|
+
const jest = require('eslint-plugin-jest');
|
|
12
|
+
const jestDom = require('eslint-plugin-jest-dom');
|
|
11
13
|
const jsdoc = require('eslint-plugin-jsdoc');
|
|
12
14
|
const mocha = require('eslint-plugin-mocha');
|
|
13
15
|
const promise = require('eslint-plugin-promise');
|
|
@@ -15,8 +17,8 @@ const compat = require('@eslint/compat');
|
|
|
15
17
|
const a11y = require('eslint-plugin-jsx-a11y');
|
|
16
18
|
const react = require('eslint-plugin-react');
|
|
17
19
|
const reactHooks = require('eslint-plugin-react-hooks');
|
|
18
|
-
const testingLibrary = require('eslint-plugin-testing-library');
|
|
19
20
|
const security = require('eslint-plugin-security');
|
|
21
|
+
const testingLibrary = require('eslint-plugin-testing-library');
|
|
20
22
|
const unicorn = require('eslint-plugin-unicorn');
|
|
21
23
|
|
|
22
24
|
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; }
|
|
@@ -26,17 +28,19 @@ const prettier__default = /*#__PURE__*/_interopDefaultCompat(prettier);
|
|
|
26
28
|
const globals__default = /*#__PURE__*/_interopDefaultCompat(globals);
|
|
27
29
|
const tsEslint__default = /*#__PURE__*/_interopDefaultCompat(tsEslint);
|
|
28
30
|
const importPlugin__default = /*#__PURE__*/_interopDefaultCompat(importPlugin);
|
|
31
|
+
const jest__default = /*#__PURE__*/_interopDefaultCompat(jest);
|
|
32
|
+
const jestDom__default = /*#__PURE__*/_interopDefaultCompat(jestDom);
|
|
29
33
|
const jsdoc__default = /*#__PURE__*/_interopDefaultCompat(jsdoc);
|
|
30
34
|
const mocha__default = /*#__PURE__*/_interopDefaultCompat(mocha);
|
|
31
35
|
const promise__default = /*#__PURE__*/_interopDefaultCompat(promise);
|
|
32
36
|
const a11y__default = /*#__PURE__*/_interopDefaultCompat(a11y);
|
|
33
37
|
const react__default = /*#__PURE__*/_interopDefaultCompat(react);
|
|
34
38
|
const reactHooks__default = /*#__PURE__*/_interopDefaultCompat(reactHooks);
|
|
35
|
-
const testingLibrary__default = /*#__PURE__*/_interopDefaultCompat(testingLibrary);
|
|
36
39
|
const security__default = /*#__PURE__*/_interopDefaultCompat(security);
|
|
40
|
+
const testingLibrary__default = /*#__PURE__*/_interopDefaultCompat(testingLibrary);
|
|
37
41
|
const unicorn__default = /*#__PURE__*/_interopDefaultCompat(unicorn);
|
|
38
42
|
|
|
39
|
-
const base$
|
|
43
|
+
const base$b = {
|
|
40
44
|
rules: {
|
|
41
45
|
"array-callback-return": ["error", { allowImplicit: true }],
|
|
42
46
|
"block-scoped-var": "error",
|
|
@@ -286,8 +290,8 @@ const cjs = {
|
|
|
286
290
|
strict: ["error", "global"]
|
|
287
291
|
}
|
|
288
292
|
};
|
|
289
|
-
const configs$
|
|
290
|
-
base: base$
|
|
293
|
+
const configs$b = {
|
|
294
|
+
base: base$b,
|
|
291
295
|
cjsAndEsm,
|
|
292
296
|
cjs
|
|
293
297
|
};
|
|
@@ -386,7 +390,7 @@ const requireIndexRule = utils.ESLintUtils.RuleCreator(() => "https://github.com
|
|
|
386
390
|
}
|
|
387
391
|
});
|
|
388
392
|
|
|
389
|
-
const base$
|
|
393
|
+
const base$a = {
|
|
390
394
|
plugins: {
|
|
391
395
|
"decent-extension": {
|
|
392
396
|
meta: {
|
|
@@ -404,11 +408,11 @@ const base$8 = {
|
|
|
404
408
|
"decent-extension/require-index": "error"
|
|
405
409
|
}
|
|
406
410
|
};
|
|
407
|
-
const configs$
|
|
408
|
-
base: base$
|
|
411
|
+
const configs$a = {
|
|
412
|
+
base: base$a
|
|
409
413
|
};
|
|
410
414
|
|
|
411
|
-
const base$
|
|
415
|
+
const base$9 = {
|
|
412
416
|
plugins: {
|
|
413
417
|
import: importPlugin__default
|
|
414
418
|
},
|
|
@@ -423,11 +427,58 @@ const base$7 = {
|
|
|
423
427
|
]
|
|
424
428
|
}
|
|
425
429
|
};
|
|
426
|
-
const configs$
|
|
427
|
-
base: base$
|
|
430
|
+
const configs$9 = {
|
|
431
|
+
base: base$9
|
|
428
432
|
};
|
|
429
433
|
|
|
430
|
-
const base$
|
|
434
|
+
const base$8 = {
|
|
435
|
+
plugins: {
|
|
436
|
+
jest: jest__default,
|
|
437
|
+
"jest-dom": jestDom__default
|
|
438
|
+
},
|
|
439
|
+
languageOptions: {
|
|
440
|
+
...jest__default.configs["flat/recommended"].languageOptions
|
|
441
|
+
},
|
|
442
|
+
rules: {
|
|
443
|
+
...jest__default.configs["flat/recommended"].rules,
|
|
444
|
+
"jest/max-nested-describe": "error",
|
|
445
|
+
"jest/no-conditional-in-test": "error",
|
|
446
|
+
"jest/no-confusing-set-timeout": "error",
|
|
447
|
+
"jest/no-test-prefixes": "error",
|
|
448
|
+
"jest/prefer-called-with": "error",
|
|
449
|
+
"jest/prefer-comparison-matcher": "error",
|
|
450
|
+
"jest/prefer-equality-matcher": "error",
|
|
451
|
+
"jest/prefer-hooks-in-order": "error",
|
|
452
|
+
"jest/prefer-hooks-on-top": "error",
|
|
453
|
+
"jest/prefer-mock-promise-shorthand": "error",
|
|
454
|
+
"jest/prefer-snapshot-hint": "error",
|
|
455
|
+
...jestDom__default.configs["flat/recommended"].rules,
|
|
456
|
+
"jest-dom/prefer-checked": "error",
|
|
457
|
+
"jest-dom/prefer-empty": "error",
|
|
458
|
+
"jest-dom/prefer-enabled-disabled": "error",
|
|
459
|
+
"jest-dom/prefer-focus": "error",
|
|
460
|
+
"jest-dom/prefer-in-document": "error",
|
|
461
|
+
"jest-dom/prefer-required": "error",
|
|
462
|
+
"jest-dom/prefer-to-have-attribute": "error",
|
|
463
|
+
"jest-dom/prefer-to-have-class": "error",
|
|
464
|
+
"jest-dom/prefer-to-have-style": "error",
|
|
465
|
+
"jest-dom/prefer-to-have-text-content": "error",
|
|
466
|
+
"jest-dom/prefer-to-have-value": "error",
|
|
467
|
+
"max-classes-per-file": "off",
|
|
468
|
+
"@typescript-eslint/no-confusing-void-expression": "off",
|
|
469
|
+
"@typescript-eslint/no-empty-function": "off",
|
|
470
|
+
"@typescript-eslint/no-unsafe-member-access": "off",
|
|
471
|
+
"@typescript-eslint/no-unsafe-argument": "off",
|
|
472
|
+
"@typescript-eslint/no-unsafe-call": "off",
|
|
473
|
+
"@typescript-eslint/no-unused-vars": "off",
|
|
474
|
+
"@typescript-eslint/unbound-method": "off"
|
|
475
|
+
}
|
|
476
|
+
};
|
|
477
|
+
const configs$8 = {
|
|
478
|
+
base: base$8
|
|
479
|
+
};
|
|
480
|
+
|
|
481
|
+
const base$7 = {
|
|
431
482
|
settings: {
|
|
432
483
|
jsdoc: {
|
|
433
484
|
preferredTypes: {
|
|
@@ -453,11 +504,11 @@ const base$6 = {
|
|
|
453
504
|
"unicorn/prefer-set-has": "error"
|
|
454
505
|
}
|
|
455
506
|
};
|
|
456
|
-
const configs$
|
|
457
|
-
base: base$
|
|
507
|
+
const configs$7 = {
|
|
508
|
+
base: base$7
|
|
458
509
|
};
|
|
459
510
|
|
|
460
|
-
const base$
|
|
511
|
+
const base$6 = {
|
|
461
512
|
plugins: {
|
|
462
513
|
mocha: mocha__default
|
|
463
514
|
},
|
|
@@ -476,11 +527,11 @@ const base$5 = {
|
|
|
476
527
|
"mocha/no-mocha-arrows": "off"
|
|
477
528
|
}
|
|
478
529
|
};
|
|
479
|
-
const configs$
|
|
480
|
-
base: base$
|
|
530
|
+
const configs$6 = {
|
|
531
|
+
base: base$6
|
|
481
532
|
};
|
|
482
533
|
|
|
483
|
-
const base$
|
|
534
|
+
const base$5 = {
|
|
484
535
|
plugins: {
|
|
485
536
|
promise: promise__default
|
|
486
537
|
},
|
|
@@ -497,11 +548,11 @@ const base$4 = {
|
|
|
497
548
|
"promise/param-names": "error"
|
|
498
549
|
}
|
|
499
550
|
};
|
|
500
|
-
const configs$
|
|
501
|
-
base: base$
|
|
551
|
+
const configs$5 = {
|
|
552
|
+
base: base$5
|
|
502
553
|
};
|
|
503
554
|
|
|
504
|
-
const base$
|
|
555
|
+
const base$4 = {
|
|
505
556
|
settings: {
|
|
506
557
|
react: {
|
|
507
558
|
version: "detect"
|
|
@@ -513,8 +564,7 @@ const base$3 = {
|
|
|
513
564
|
plugins: {
|
|
514
565
|
"jsx-a11y": a11y__default,
|
|
515
566
|
react: react__default,
|
|
516
|
-
"react-hooks": compat.fixupPluginRules(reactHooks__default)
|
|
517
|
-
"testing-library": compat.fixupPluginRules(testingLibrary__default)
|
|
567
|
+
"react-hooks": compat.fixupPluginRules(reactHooks__default)
|
|
518
568
|
},
|
|
519
569
|
rules: {
|
|
520
570
|
...a11y__default.configs.recommended.rules,
|
|
@@ -566,15 +616,14 @@ const base$3 = {
|
|
|
566
616
|
"react/self-closing-comp": "error",
|
|
567
617
|
"react/style-prop-object": "error",
|
|
568
618
|
"react-hooks/rules-of-hooks": "error",
|
|
569
|
-
"react-hooks/exhaustive-deps": "error"
|
|
570
|
-
...testingLibrary__default.configs.react.rules
|
|
619
|
+
"react-hooks/exhaustive-deps": "error"
|
|
571
620
|
}
|
|
572
621
|
};
|
|
573
|
-
const configs$
|
|
574
|
-
base: base$
|
|
622
|
+
const configs$4 = {
|
|
623
|
+
base: base$4
|
|
575
624
|
};
|
|
576
625
|
|
|
577
|
-
const base$
|
|
626
|
+
const base$3 = {
|
|
578
627
|
plugins: {
|
|
579
628
|
security: security__default
|
|
580
629
|
},
|
|
@@ -594,6 +643,22 @@ const base$2 = {
|
|
|
594
643
|
"security/detect-unsafe-regex": "error"
|
|
595
644
|
}
|
|
596
645
|
};
|
|
646
|
+
const configs$3 = {
|
|
647
|
+
base: base$3
|
|
648
|
+
};
|
|
649
|
+
|
|
650
|
+
const base$2 = {
|
|
651
|
+
plugins: {
|
|
652
|
+
"testing-library": compat.fixupPluginRules(testingLibrary__default)
|
|
653
|
+
},
|
|
654
|
+
rules: {
|
|
655
|
+
...testingLibrary__default.configs["flat/react"].rules,
|
|
656
|
+
"testing-library/no-debugging-utils": "error",
|
|
657
|
+
"testing-library/prefer-explicit-assert": "warn",
|
|
658
|
+
"testing-library/prefer-implicit-assert": "error",
|
|
659
|
+
"testing-library/prefer-query-matchers": "off"
|
|
660
|
+
}
|
|
661
|
+
};
|
|
597
662
|
const configs$2 = {
|
|
598
663
|
base: base$2
|
|
599
664
|
};
|
|
@@ -684,6 +749,10 @@ const configs = {
|
|
|
684
749
|
const defaultConfig = tsEslintConfig;
|
|
685
750
|
function tsEslintConfig(options) {
|
|
686
751
|
const enableRequireExtensionRule = options?.enableRequireExtensionRule ?? true;
|
|
752
|
+
const enableJest = options?.enableJest ?? true;
|
|
753
|
+
const enableMocha = options?.enableMocha ?? true;
|
|
754
|
+
const enableReact = options?.enableReact ?? true;
|
|
755
|
+
const enableTestingLibrary = options?.enableTestingLibrary ?? true;
|
|
687
756
|
const languageOptions = {
|
|
688
757
|
globals: {
|
|
689
758
|
...globals__default.node
|
|
@@ -713,27 +782,27 @@ function tsEslintConfig(options) {
|
|
|
713
782
|
{
|
|
714
783
|
languageOptions,
|
|
715
784
|
settings: {
|
|
716
|
-
...configs$
|
|
785
|
+
...configs$7.base.settings
|
|
717
786
|
}
|
|
718
787
|
},
|
|
719
788
|
{
|
|
720
789
|
name: "eslint-config-decent/base",
|
|
721
790
|
files: ["**/*.ts", "**/*.js", "**/*.cjs", "**/*.mjs", "**/*.tsx"],
|
|
722
791
|
plugins: {
|
|
723
|
-
...configs$
|
|
792
|
+
...configs$a.base.plugins,
|
|
793
|
+
...configs$9.base.plugins,
|
|
724
794
|
...configs$7.base.plugins,
|
|
725
|
-
...configs$
|
|
726
|
-
...configs$
|
|
727
|
-
...configs$2.base.plugins,
|
|
795
|
+
...configs$5.base.plugins,
|
|
796
|
+
...configs$3.base.plugins,
|
|
728
797
|
...configs.base.plugins
|
|
729
798
|
},
|
|
730
799
|
rules: {
|
|
800
|
+
...configs$b.base.rules,
|
|
801
|
+
...enableRequireExtensionRule ? configs$a.base.rules : {},
|
|
731
802
|
...configs$9.base.rules,
|
|
732
|
-
...enableRequireExtensionRule ? configs$8.base.rules : {},
|
|
733
803
|
...configs$7.base.rules,
|
|
734
|
-
...configs$
|
|
735
|
-
...configs$
|
|
736
|
-
...configs$2.base.rules,
|
|
804
|
+
...configs$5.base.rules,
|
|
805
|
+
...configs$3.base.rules,
|
|
737
806
|
...configs.base.rules
|
|
738
807
|
}
|
|
739
808
|
},
|
|
@@ -742,18 +811,20 @@ function tsEslintConfig(options) {
|
|
|
742
811
|
files: ["**/*.ts", "**/*.tsx"],
|
|
743
812
|
...configs$1.base
|
|
744
813
|
},
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
814
|
+
...enableReact ? [
|
|
815
|
+
{
|
|
816
|
+
name: "eslint-config-decent/tsx",
|
|
817
|
+
files: ["**/*.tsx"],
|
|
818
|
+
...configs$4.base
|
|
819
|
+
}
|
|
820
|
+
] : [],
|
|
750
821
|
{
|
|
751
822
|
name: "eslint-config-decent/cjs-and-esm",
|
|
752
823
|
files: ["**/*.js", "**/*.cjs", "**/*.mjs"],
|
|
753
824
|
languageOptions: {
|
|
754
825
|
sourceType: "script"
|
|
755
826
|
},
|
|
756
|
-
...configs$
|
|
827
|
+
...configs$b.cjsAndEsm
|
|
757
828
|
},
|
|
758
829
|
{
|
|
759
830
|
name: "eslint-config-decent/cjs",
|
|
@@ -761,13 +832,29 @@ function tsEslintConfig(options) {
|
|
|
761
832
|
languageOptions: {
|
|
762
833
|
sourceType: "script"
|
|
763
834
|
},
|
|
764
|
-
...configs$
|
|
765
|
-
},
|
|
766
|
-
{
|
|
767
|
-
name: "eslint-config-decent/tests",
|
|
768
|
-
files: ["**/*.tests.ts", "tests/tests.ts"],
|
|
769
|
-
...configs$5.base
|
|
835
|
+
...configs$b.cjs
|
|
770
836
|
},
|
|
837
|
+
...enableMocha ? [
|
|
838
|
+
{
|
|
839
|
+
name: "eslint-config-decent/mocha-tests",
|
|
840
|
+
files: ["**/*.tests.ts", "tests/tests.ts"],
|
|
841
|
+
...configs$6.base
|
|
842
|
+
}
|
|
843
|
+
] : [],
|
|
844
|
+
...enableJest ? [
|
|
845
|
+
{
|
|
846
|
+
name: "eslint-config-decent/jest-tests",
|
|
847
|
+
files: ["**/__tests__/**/*.ts?(x)", "**/*.{spec,test}.ts?(x)"],
|
|
848
|
+
...configs$8.base
|
|
849
|
+
}
|
|
850
|
+
] : [],
|
|
851
|
+
...enableTestingLibrary ? [
|
|
852
|
+
{
|
|
853
|
+
name: "eslint-config-decent/testing-library",
|
|
854
|
+
files: ["**/__tests__/**/*.ts?(x)", "**/*.{spec,test}.ts?(x)"],
|
|
855
|
+
...configs$2.base
|
|
856
|
+
}
|
|
857
|
+
] : [],
|
|
771
858
|
{
|
|
772
859
|
name: "eslint-config-decent/cjs-and-esm-disable-ts-rules",
|
|
773
860
|
files: ["**/*.js", "**/*.cjs", "**/*.mjs"],
|
|
@@ -782,12 +869,16 @@ function config(options) {
|
|
|
782
869
|
|
|
783
870
|
exports.config = config;
|
|
784
871
|
exports.defaultConfig = defaultConfig;
|
|
785
|
-
exports.eslintConfigs = configs$
|
|
786
|
-
exports.
|
|
787
|
-
exports.
|
|
788
|
-
exports.
|
|
789
|
-
exports.
|
|
790
|
-
exports.
|
|
872
|
+
exports.eslintConfigs = configs$b;
|
|
873
|
+
exports.extensionConfigs = configs$a;
|
|
874
|
+
exports.importConfigs = configs$9;
|
|
875
|
+
exports.jestConfigs = configs$8;
|
|
876
|
+
exports.jsdocConfigs = configs$7;
|
|
877
|
+
exports.mochaConfigs = configs$6;
|
|
878
|
+
exports.promiseConfigs = configs$5;
|
|
879
|
+
exports.reactConfigs = configs$4;
|
|
880
|
+
exports.securityConfigs = configs$3;
|
|
881
|
+
exports.testingLibraryConfigs = configs$2;
|
|
791
882
|
exports.tsEslintConfig = tsEslintConfig;
|
|
792
883
|
exports.typescriptEslintConfigs = configs$1;
|
|
793
884
|
exports.unicornConfigs = configs;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,12 +1,28 @@
|
|
|
1
1
|
import { TSESLint } from '@typescript-eslint/utils';
|
|
2
2
|
import { ConfigWithExtends } from 'typescript-eslint';
|
|
3
3
|
|
|
4
|
-
declare const configs$
|
|
4
|
+
declare const configs$b: {
|
|
5
5
|
base: TSESLint.FlatConfig.Config;
|
|
6
6
|
cjsAndEsm: TSESLint.FlatConfig.Config;
|
|
7
7
|
cjs: TSESLint.FlatConfig.Config;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
+
declare const configs$a: {
|
|
11
|
+
base: TSESLint.FlatConfig.Config;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
declare const configs$9: {
|
|
15
|
+
base: TSESLint.FlatConfig.Config;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
declare const configs$8: {
|
|
19
|
+
base: TSESLint.FlatConfig.Config;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
declare const configs$7: {
|
|
23
|
+
base: TSESLint.FlatConfig.Config;
|
|
24
|
+
};
|
|
25
|
+
|
|
10
26
|
declare const configs$6: {
|
|
11
27
|
base: TSESLint.FlatConfig.Config;
|
|
12
28
|
};
|
|
@@ -38,6 +54,10 @@ declare const configs: {
|
|
|
38
54
|
interface DefaultConfigOptions {
|
|
39
55
|
parserOptions?: NonNullable<ConfigWithExtends['languageOptions']>['parserOptions'];
|
|
40
56
|
enableRequireExtensionRule?: boolean;
|
|
57
|
+
enableJest?: boolean;
|
|
58
|
+
enableMocha?: boolean;
|
|
59
|
+
enableReact?: boolean;
|
|
60
|
+
enableTestingLibrary?: boolean;
|
|
41
61
|
}
|
|
42
62
|
/**
|
|
43
63
|
* @deprecated Use `tsEslintConfig` instead
|
|
@@ -56,4 +76,4 @@ declare function tsEslintConfig(options?: DefaultConfigOptions): ConfigWithExten
|
|
|
56
76
|
*/
|
|
57
77
|
declare function config(options?: DefaultConfigOptions): TSESLint.FlatConfig.ConfigArray;
|
|
58
78
|
|
|
59
|
-
export { type DefaultConfigOptions, config, defaultConfig, configs$
|
|
79
|
+
export { type DefaultConfigOptions, config, defaultConfig, configs$b as eslintConfigs, configs$a as extensionConfigs, configs$9 as importConfigs, configs$8 as jestConfigs, configs$7 as jsdocConfigs, configs$6 as mochaConfigs, configs$5 as promiseConfigs, configs$4 as reactConfigs, configs$3 as securityConfigs, configs$2 as testingLibraryConfigs, tsEslintConfig, configs$1 as typescriptEslintConfigs, configs as unicornConfigs };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,12 +1,28 @@
|
|
|
1
1
|
import { TSESLint } from '@typescript-eslint/utils';
|
|
2
2
|
import { ConfigWithExtends } from 'typescript-eslint';
|
|
3
3
|
|
|
4
|
-
declare const configs$
|
|
4
|
+
declare const configs$b: {
|
|
5
5
|
base: TSESLint.FlatConfig.Config;
|
|
6
6
|
cjsAndEsm: TSESLint.FlatConfig.Config;
|
|
7
7
|
cjs: TSESLint.FlatConfig.Config;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
+
declare const configs$a: {
|
|
11
|
+
base: TSESLint.FlatConfig.Config;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
declare const configs$9: {
|
|
15
|
+
base: TSESLint.FlatConfig.Config;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
declare const configs$8: {
|
|
19
|
+
base: TSESLint.FlatConfig.Config;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
declare const configs$7: {
|
|
23
|
+
base: TSESLint.FlatConfig.Config;
|
|
24
|
+
};
|
|
25
|
+
|
|
10
26
|
declare const configs$6: {
|
|
11
27
|
base: TSESLint.FlatConfig.Config;
|
|
12
28
|
};
|
|
@@ -38,6 +54,10 @@ declare const configs: {
|
|
|
38
54
|
interface DefaultConfigOptions {
|
|
39
55
|
parserOptions?: NonNullable<ConfigWithExtends['languageOptions']>['parserOptions'];
|
|
40
56
|
enableRequireExtensionRule?: boolean;
|
|
57
|
+
enableJest?: boolean;
|
|
58
|
+
enableMocha?: boolean;
|
|
59
|
+
enableReact?: boolean;
|
|
60
|
+
enableTestingLibrary?: boolean;
|
|
41
61
|
}
|
|
42
62
|
/**
|
|
43
63
|
* @deprecated Use `tsEslintConfig` instead
|
|
@@ -56,4 +76,4 @@ declare function tsEslintConfig(options?: DefaultConfigOptions): ConfigWithExten
|
|
|
56
76
|
*/
|
|
57
77
|
declare function config(options?: DefaultConfigOptions): TSESLint.FlatConfig.ConfigArray;
|
|
58
78
|
|
|
59
|
-
export { type DefaultConfigOptions, config, defaultConfig, configs$
|
|
79
|
+
export { type DefaultConfigOptions, config, defaultConfig, configs$b as eslintConfigs, configs$a as extensionConfigs, configs$9 as importConfigs, configs$8 as jestConfigs, configs$7 as jsdocConfigs, configs$6 as mochaConfigs, configs$5 as promiseConfigs, configs$4 as reactConfigs, configs$3 as securityConfigs, configs$2 as testingLibraryConfigs, tsEslintConfig, configs$1 as typescriptEslintConfigs, configs as unicornConfigs };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,28 @@
|
|
|
1
1
|
import { TSESLint } from '@typescript-eslint/utils';
|
|
2
2
|
import { ConfigWithExtends } from 'typescript-eslint';
|
|
3
3
|
|
|
4
|
-
declare const configs$
|
|
4
|
+
declare const configs$b: {
|
|
5
5
|
base: TSESLint.FlatConfig.Config;
|
|
6
6
|
cjsAndEsm: TSESLint.FlatConfig.Config;
|
|
7
7
|
cjs: TSESLint.FlatConfig.Config;
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
+
declare const configs$a: {
|
|
11
|
+
base: TSESLint.FlatConfig.Config;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
declare const configs$9: {
|
|
15
|
+
base: TSESLint.FlatConfig.Config;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
declare const configs$8: {
|
|
19
|
+
base: TSESLint.FlatConfig.Config;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
declare const configs$7: {
|
|
23
|
+
base: TSESLint.FlatConfig.Config;
|
|
24
|
+
};
|
|
25
|
+
|
|
10
26
|
declare const configs$6: {
|
|
11
27
|
base: TSESLint.FlatConfig.Config;
|
|
12
28
|
};
|
|
@@ -38,6 +54,10 @@ declare const configs: {
|
|
|
38
54
|
interface DefaultConfigOptions {
|
|
39
55
|
parserOptions?: NonNullable<ConfigWithExtends['languageOptions']>['parserOptions'];
|
|
40
56
|
enableRequireExtensionRule?: boolean;
|
|
57
|
+
enableJest?: boolean;
|
|
58
|
+
enableMocha?: boolean;
|
|
59
|
+
enableReact?: boolean;
|
|
60
|
+
enableTestingLibrary?: boolean;
|
|
41
61
|
}
|
|
42
62
|
/**
|
|
43
63
|
* @deprecated Use `tsEslintConfig` instead
|
|
@@ -56,4 +76,4 @@ declare function tsEslintConfig(options?: DefaultConfigOptions): ConfigWithExten
|
|
|
56
76
|
*/
|
|
57
77
|
declare function config(options?: DefaultConfigOptions): TSESLint.FlatConfig.ConfigArray;
|
|
58
78
|
|
|
59
|
-
export { type DefaultConfigOptions, config, defaultConfig, configs$
|
|
79
|
+
export { type DefaultConfigOptions, config, defaultConfig, configs$b as eslintConfigs, configs$a as extensionConfigs, configs$9 as importConfigs, configs$8 as jestConfigs, configs$7 as jsdocConfigs, configs$6 as mochaConfigs, configs$5 as promiseConfigs, configs$4 as reactConfigs, configs$3 as securityConfigs, configs$2 as testingLibraryConfigs, tsEslintConfig, configs$1 as typescriptEslintConfigs, configs as unicornConfigs };
|
package/dist/index.mjs
CHANGED
|
@@ -6,6 +6,8 @@ import { existsSync, lstatSync } from 'fs';
|
|
|
6
6
|
import { resolve, dirname } from 'path';
|
|
7
7
|
import { ESLintUtils } from '@typescript-eslint/utils';
|
|
8
8
|
import importPlugin from 'eslint-plugin-import-x';
|
|
9
|
+
import jest from 'eslint-plugin-jest';
|
|
10
|
+
import jestDom from 'eslint-plugin-jest-dom';
|
|
9
11
|
import jsdoc from 'eslint-plugin-jsdoc';
|
|
10
12
|
import mocha from 'eslint-plugin-mocha';
|
|
11
13
|
import promise from 'eslint-plugin-promise';
|
|
@@ -13,11 +15,11 @@ import { fixupPluginRules } from '@eslint/compat';
|
|
|
13
15
|
import a11y from 'eslint-plugin-jsx-a11y';
|
|
14
16
|
import react from 'eslint-plugin-react';
|
|
15
17
|
import reactHooks from 'eslint-plugin-react-hooks';
|
|
16
|
-
import testingLibrary from 'eslint-plugin-testing-library';
|
|
17
18
|
import security from 'eslint-plugin-security';
|
|
19
|
+
import testingLibrary from 'eslint-plugin-testing-library';
|
|
18
20
|
import unicorn from 'eslint-plugin-unicorn';
|
|
19
21
|
|
|
20
|
-
const base$
|
|
22
|
+
const base$b = {
|
|
21
23
|
rules: {
|
|
22
24
|
"array-callback-return": ["error", { allowImplicit: true }],
|
|
23
25
|
"block-scoped-var": "error",
|
|
@@ -267,8 +269,8 @@ const cjs = {
|
|
|
267
269
|
strict: ["error", "global"]
|
|
268
270
|
}
|
|
269
271
|
};
|
|
270
|
-
const configs$
|
|
271
|
-
base: base$
|
|
272
|
+
const configs$b = {
|
|
273
|
+
base: base$b,
|
|
272
274
|
cjsAndEsm,
|
|
273
275
|
cjs
|
|
274
276
|
};
|
|
@@ -367,7 +369,7 @@ const requireIndexRule = ESLintUtils.RuleCreator(() => "https://github.com/jgeur
|
|
|
367
369
|
}
|
|
368
370
|
});
|
|
369
371
|
|
|
370
|
-
const base$
|
|
372
|
+
const base$a = {
|
|
371
373
|
plugins: {
|
|
372
374
|
"decent-extension": {
|
|
373
375
|
meta: {
|
|
@@ -385,11 +387,11 @@ const base$8 = {
|
|
|
385
387
|
"decent-extension/require-index": "error"
|
|
386
388
|
}
|
|
387
389
|
};
|
|
388
|
-
const configs$
|
|
389
|
-
base: base$
|
|
390
|
+
const configs$a = {
|
|
391
|
+
base: base$a
|
|
390
392
|
};
|
|
391
393
|
|
|
392
|
-
const base$
|
|
394
|
+
const base$9 = {
|
|
393
395
|
plugins: {
|
|
394
396
|
import: importPlugin
|
|
395
397
|
},
|
|
@@ -404,11 +406,58 @@ const base$7 = {
|
|
|
404
406
|
]
|
|
405
407
|
}
|
|
406
408
|
};
|
|
407
|
-
const configs$
|
|
408
|
-
base: base$
|
|
409
|
+
const configs$9 = {
|
|
410
|
+
base: base$9
|
|
409
411
|
};
|
|
410
412
|
|
|
411
|
-
const base$
|
|
413
|
+
const base$8 = {
|
|
414
|
+
plugins: {
|
|
415
|
+
jest,
|
|
416
|
+
"jest-dom": jestDom
|
|
417
|
+
},
|
|
418
|
+
languageOptions: {
|
|
419
|
+
...jest.configs["flat/recommended"].languageOptions
|
|
420
|
+
},
|
|
421
|
+
rules: {
|
|
422
|
+
...jest.configs["flat/recommended"].rules,
|
|
423
|
+
"jest/max-nested-describe": "error",
|
|
424
|
+
"jest/no-conditional-in-test": "error",
|
|
425
|
+
"jest/no-confusing-set-timeout": "error",
|
|
426
|
+
"jest/no-test-prefixes": "error",
|
|
427
|
+
"jest/prefer-called-with": "error",
|
|
428
|
+
"jest/prefer-comparison-matcher": "error",
|
|
429
|
+
"jest/prefer-equality-matcher": "error",
|
|
430
|
+
"jest/prefer-hooks-in-order": "error",
|
|
431
|
+
"jest/prefer-hooks-on-top": "error",
|
|
432
|
+
"jest/prefer-mock-promise-shorthand": "error",
|
|
433
|
+
"jest/prefer-snapshot-hint": "error",
|
|
434
|
+
...jestDom.configs["flat/recommended"].rules,
|
|
435
|
+
"jest-dom/prefer-checked": "error",
|
|
436
|
+
"jest-dom/prefer-empty": "error",
|
|
437
|
+
"jest-dom/prefer-enabled-disabled": "error",
|
|
438
|
+
"jest-dom/prefer-focus": "error",
|
|
439
|
+
"jest-dom/prefer-in-document": "error",
|
|
440
|
+
"jest-dom/prefer-required": "error",
|
|
441
|
+
"jest-dom/prefer-to-have-attribute": "error",
|
|
442
|
+
"jest-dom/prefer-to-have-class": "error",
|
|
443
|
+
"jest-dom/prefer-to-have-style": "error",
|
|
444
|
+
"jest-dom/prefer-to-have-text-content": "error",
|
|
445
|
+
"jest-dom/prefer-to-have-value": "error",
|
|
446
|
+
"max-classes-per-file": "off",
|
|
447
|
+
"@typescript-eslint/no-confusing-void-expression": "off",
|
|
448
|
+
"@typescript-eslint/no-empty-function": "off",
|
|
449
|
+
"@typescript-eslint/no-unsafe-member-access": "off",
|
|
450
|
+
"@typescript-eslint/no-unsafe-argument": "off",
|
|
451
|
+
"@typescript-eslint/no-unsafe-call": "off",
|
|
452
|
+
"@typescript-eslint/no-unused-vars": "off",
|
|
453
|
+
"@typescript-eslint/unbound-method": "off"
|
|
454
|
+
}
|
|
455
|
+
};
|
|
456
|
+
const configs$8 = {
|
|
457
|
+
base: base$8
|
|
458
|
+
};
|
|
459
|
+
|
|
460
|
+
const base$7 = {
|
|
412
461
|
settings: {
|
|
413
462
|
jsdoc: {
|
|
414
463
|
preferredTypes: {
|
|
@@ -434,11 +483,11 @@ const base$6 = {
|
|
|
434
483
|
"unicorn/prefer-set-has": "error"
|
|
435
484
|
}
|
|
436
485
|
};
|
|
437
|
-
const configs$
|
|
438
|
-
base: base$
|
|
486
|
+
const configs$7 = {
|
|
487
|
+
base: base$7
|
|
439
488
|
};
|
|
440
489
|
|
|
441
|
-
const base$
|
|
490
|
+
const base$6 = {
|
|
442
491
|
plugins: {
|
|
443
492
|
mocha
|
|
444
493
|
},
|
|
@@ -457,11 +506,11 @@ const base$5 = {
|
|
|
457
506
|
"mocha/no-mocha-arrows": "off"
|
|
458
507
|
}
|
|
459
508
|
};
|
|
460
|
-
const configs$
|
|
461
|
-
base: base$
|
|
509
|
+
const configs$6 = {
|
|
510
|
+
base: base$6
|
|
462
511
|
};
|
|
463
512
|
|
|
464
|
-
const base$
|
|
513
|
+
const base$5 = {
|
|
465
514
|
plugins: {
|
|
466
515
|
promise
|
|
467
516
|
},
|
|
@@ -478,11 +527,11 @@ const base$4 = {
|
|
|
478
527
|
"promise/param-names": "error"
|
|
479
528
|
}
|
|
480
529
|
};
|
|
481
|
-
const configs$
|
|
482
|
-
base: base$
|
|
530
|
+
const configs$5 = {
|
|
531
|
+
base: base$5
|
|
483
532
|
};
|
|
484
533
|
|
|
485
|
-
const base$
|
|
534
|
+
const base$4 = {
|
|
486
535
|
settings: {
|
|
487
536
|
react: {
|
|
488
537
|
version: "detect"
|
|
@@ -494,8 +543,7 @@ const base$3 = {
|
|
|
494
543
|
plugins: {
|
|
495
544
|
"jsx-a11y": a11y,
|
|
496
545
|
react,
|
|
497
|
-
"react-hooks": fixupPluginRules(reactHooks)
|
|
498
|
-
"testing-library": fixupPluginRules(testingLibrary)
|
|
546
|
+
"react-hooks": fixupPluginRules(reactHooks)
|
|
499
547
|
},
|
|
500
548
|
rules: {
|
|
501
549
|
...a11y.configs.recommended.rules,
|
|
@@ -547,15 +595,14 @@ const base$3 = {
|
|
|
547
595
|
"react/self-closing-comp": "error",
|
|
548
596
|
"react/style-prop-object": "error",
|
|
549
597
|
"react-hooks/rules-of-hooks": "error",
|
|
550
|
-
"react-hooks/exhaustive-deps": "error"
|
|
551
|
-
...testingLibrary.configs.react.rules
|
|
598
|
+
"react-hooks/exhaustive-deps": "error"
|
|
552
599
|
}
|
|
553
600
|
};
|
|
554
|
-
const configs$
|
|
555
|
-
base: base$
|
|
601
|
+
const configs$4 = {
|
|
602
|
+
base: base$4
|
|
556
603
|
};
|
|
557
604
|
|
|
558
|
-
const base$
|
|
605
|
+
const base$3 = {
|
|
559
606
|
plugins: {
|
|
560
607
|
security
|
|
561
608
|
},
|
|
@@ -575,6 +622,22 @@ const base$2 = {
|
|
|
575
622
|
"security/detect-unsafe-regex": "error"
|
|
576
623
|
}
|
|
577
624
|
};
|
|
625
|
+
const configs$3 = {
|
|
626
|
+
base: base$3
|
|
627
|
+
};
|
|
628
|
+
|
|
629
|
+
const base$2 = {
|
|
630
|
+
plugins: {
|
|
631
|
+
"testing-library": fixupPluginRules(testingLibrary)
|
|
632
|
+
},
|
|
633
|
+
rules: {
|
|
634
|
+
...testingLibrary.configs["flat/react"].rules,
|
|
635
|
+
"testing-library/no-debugging-utils": "error",
|
|
636
|
+
"testing-library/prefer-explicit-assert": "warn",
|
|
637
|
+
"testing-library/prefer-implicit-assert": "error",
|
|
638
|
+
"testing-library/prefer-query-matchers": "off"
|
|
639
|
+
}
|
|
640
|
+
};
|
|
578
641
|
const configs$2 = {
|
|
579
642
|
base: base$2
|
|
580
643
|
};
|
|
@@ -665,6 +728,10 @@ const configs = {
|
|
|
665
728
|
const defaultConfig = tsEslintConfig;
|
|
666
729
|
function tsEslintConfig(options) {
|
|
667
730
|
const enableRequireExtensionRule = options?.enableRequireExtensionRule ?? true;
|
|
731
|
+
const enableJest = options?.enableJest ?? true;
|
|
732
|
+
const enableMocha = options?.enableMocha ?? true;
|
|
733
|
+
const enableReact = options?.enableReact ?? true;
|
|
734
|
+
const enableTestingLibrary = options?.enableTestingLibrary ?? true;
|
|
668
735
|
const languageOptions = {
|
|
669
736
|
globals: {
|
|
670
737
|
...globals.node
|
|
@@ -694,27 +761,27 @@ function tsEslintConfig(options) {
|
|
|
694
761
|
{
|
|
695
762
|
languageOptions,
|
|
696
763
|
settings: {
|
|
697
|
-
...configs$
|
|
764
|
+
...configs$7.base.settings
|
|
698
765
|
}
|
|
699
766
|
},
|
|
700
767
|
{
|
|
701
768
|
name: "eslint-config-decent/base",
|
|
702
769
|
files: ["**/*.ts", "**/*.js", "**/*.cjs", "**/*.mjs", "**/*.tsx"],
|
|
703
770
|
plugins: {
|
|
704
|
-
...configs$
|
|
771
|
+
...configs$a.base.plugins,
|
|
772
|
+
...configs$9.base.plugins,
|
|
705
773
|
...configs$7.base.plugins,
|
|
706
|
-
...configs$
|
|
707
|
-
...configs$
|
|
708
|
-
...configs$2.base.plugins,
|
|
774
|
+
...configs$5.base.plugins,
|
|
775
|
+
...configs$3.base.plugins,
|
|
709
776
|
...configs.base.plugins
|
|
710
777
|
},
|
|
711
778
|
rules: {
|
|
779
|
+
...configs$b.base.rules,
|
|
780
|
+
...enableRequireExtensionRule ? configs$a.base.rules : {},
|
|
712
781
|
...configs$9.base.rules,
|
|
713
|
-
...enableRequireExtensionRule ? configs$8.base.rules : {},
|
|
714
782
|
...configs$7.base.rules,
|
|
715
|
-
...configs$
|
|
716
|
-
...configs$
|
|
717
|
-
...configs$2.base.rules,
|
|
783
|
+
...configs$5.base.rules,
|
|
784
|
+
...configs$3.base.rules,
|
|
718
785
|
...configs.base.rules
|
|
719
786
|
}
|
|
720
787
|
},
|
|
@@ -723,18 +790,20 @@ function tsEslintConfig(options) {
|
|
|
723
790
|
files: ["**/*.ts", "**/*.tsx"],
|
|
724
791
|
...configs$1.base
|
|
725
792
|
},
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
793
|
+
...enableReact ? [
|
|
794
|
+
{
|
|
795
|
+
name: "eslint-config-decent/tsx",
|
|
796
|
+
files: ["**/*.tsx"],
|
|
797
|
+
...configs$4.base
|
|
798
|
+
}
|
|
799
|
+
] : [],
|
|
731
800
|
{
|
|
732
801
|
name: "eslint-config-decent/cjs-and-esm",
|
|
733
802
|
files: ["**/*.js", "**/*.cjs", "**/*.mjs"],
|
|
734
803
|
languageOptions: {
|
|
735
804
|
sourceType: "script"
|
|
736
805
|
},
|
|
737
|
-
...configs$
|
|
806
|
+
...configs$b.cjsAndEsm
|
|
738
807
|
},
|
|
739
808
|
{
|
|
740
809
|
name: "eslint-config-decent/cjs",
|
|
@@ -742,13 +811,29 @@ function tsEslintConfig(options) {
|
|
|
742
811
|
languageOptions: {
|
|
743
812
|
sourceType: "script"
|
|
744
813
|
},
|
|
745
|
-
...configs$
|
|
746
|
-
},
|
|
747
|
-
{
|
|
748
|
-
name: "eslint-config-decent/tests",
|
|
749
|
-
files: ["**/*.tests.ts", "tests/tests.ts"],
|
|
750
|
-
...configs$5.base
|
|
814
|
+
...configs$b.cjs
|
|
751
815
|
},
|
|
816
|
+
...enableMocha ? [
|
|
817
|
+
{
|
|
818
|
+
name: "eslint-config-decent/mocha-tests",
|
|
819
|
+
files: ["**/*.tests.ts", "tests/tests.ts"],
|
|
820
|
+
...configs$6.base
|
|
821
|
+
}
|
|
822
|
+
] : [],
|
|
823
|
+
...enableJest ? [
|
|
824
|
+
{
|
|
825
|
+
name: "eslint-config-decent/jest-tests",
|
|
826
|
+
files: ["**/__tests__/**/*.ts?(x)", "**/*.{spec,test}.ts?(x)"],
|
|
827
|
+
...configs$8.base
|
|
828
|
+
}
|
|
829
|
+
] : [],
|
|
830
|
+
...enableTestingLibrary ? [
|
|
831
|
+
{
|
|
832
|
+
name: "eslint-config-decent/testing-library",
|
|
833
|
+
files: ["**/__tests__/**/*.ts?(x)", "**/*.{spec,test}.ts?(x)"],
|
|
834
|
+
...configs$2.base
|
|
835
|
+
}
|
|
836
|
+
] : [],
|
|
752
837
|
{
|
|
753
838
|
name: "eslint-config-decent/cjs-and-esm-disable-ts-rules",
|
|
754
839
|
files: ["**/*.js", "**/*.cjs", "**/*.mjs"],
|
|
@@ -761,4 +846,4 @@ function config(options) {
|
|
|
761
846
|
return tsEslint.config(...tsEslintConfig(options));
|
|
762
847
|
}
|
|
763
848
|
|
|
764
|
-
export { config, defaultConfig, configs$
|
|
849
|
+
export { config, defaultConfig, configs$b as eslintConfigs, configs$a as extensionConfigs, configs$9 as importConfigs, configs$8 as jestConfigs, configs$7 as jsdocConfigs, configs$6 as mochaConfigs, configs$5 as promiseConfigs, configs$4 as reactConfigs, configs$3 as securityConfigs, configs$2 as testingLibraryConfigs, tsEslintConfig, configs$1 as typescriptEslintConfigs, configs as unicornConfigs };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eslint-config-decent",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "A decent ESLint configuration",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -73,29 +73,31 @@
|
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
75
|
"@eslint/compat": "1.1.1",
|
|
76
|
-
"@eslint/js": "
|
|
77
|
-
"@typescript-eslint/utils": "8.
|
|
78
|
-
"eslint-config-prettier": "
|
|
79
|
-
"eslint-plugin-import-x": "
|
|
80
|
-
"eslint-plugin-
|
|
81
|
-
"eslint-plugin-
|
|
82
|
-
"eslint-plugin-
|
|
83
|
-
"eslint-plugin-
|
|
84
|
-
"eslint-plugin-
|
|
85
|
-
"eslint-plugin-
|
|
86
|
-
"eslint-plugin-
|
|
87
|
-
"eslint-plugin-
|
|
88
|
-
"eslint-plugin-
|
|
89
|
-
"eslint-plugin-
|
|
90
|
-
"
|
|
91
|
-
"
|
|
76
|
+
"@eslint/js": "9.9.0",
|
|
77
|
+
"@typescript-eslint/utils": "8.1.0",
|
|
78
|
+
"eslint-config-prettier": "9.1.0",
|
|
79
|
+
"eslint-plugin-import-x": "3.1.0",
|
|
80
|
+
"eslint-plugin-jest": "28.8.0",
|
|
81
|
+
"eslint-plugin-jest-dom": "5.4.0",
|
|
82
|
+
"eslint-plugin-jsdoc": "50.1.0",
|
|
83
|
+
"eslint-plugin-jsx-a11y": "6.9.0",
|
|
84
|
+
"eslint-plugin-mocha": "10.5.0",
|
|
85
|
+
"eslint-plugin-prettier": "5.2.1",
|
|
86
|
+
"eslint-plugin-promise": "7.1.0",
|
|
87
|
+
"eslint-plugin-react": "7.35.0",
|
|
88
|
+
"eslint-plugin-react-hooks": "4.6.2",
|
|
89
|
+
"eslint-plugin-security": "3.0.1",
|
|
90
|
+
"eslint-plugin-testing-library": "6.3.0",
|
|
91
|
+
"eslint-plugin-unicorn": "55.0.0",
|
|
92
|
+
"globals": "15.9.0",
|
|
93
|
+
"typescript-eslint": "8.1.0"
|
|
92
94
|
},
|
|
93
95
|
"devDependencies": {
|
|
94
|
-
"@swc/core": "1.7.
|
|
96
|
+
"@swc/core": "^1.7.10",
|
|
95
97
|
"@types/node": ">=22",
|
|
96
|
-
"eslint": "^9.
|
|
98
|
+
"eslint": "^9.9.0",
|
|
97
99
|
"husky": "^9.1.4",
|
|
98
|
-
"lint-staged": "^15.2.
|
|
100
|
+
"lint-staged": "^15.2.9",
|
|
99
101
|
"markdownlint-cli": "^0.41.0",
|
|
100
102
|
"npm-run-all": "^4.1.5",
|
|
101
103
|
"pinst": "^3.0.0",
|
package/src/index.ts
CHANGED
|
@@ -7,21 +7,27 @@ import tsEslint, { type ConfigWithExtends } from 'typescript-eslint';
|
|
|
7
7
|
import { configs as eslintConfigs } from './eslint.js';
|
|
8
8
|
import { configs as extensionConfigs } from './extension.js';
|
|
9
9
|
import { configs as importConfigs } from './import.js';
|
|
10
|
+
import { configs as jestConfigs } from './jest.js';
|
|
10
11
|
import { configs as jsdocConfigs } from './jsdoc.js';
|
|
11
12
|
import { configs as mochaConfigs } from './mocha.js';
|
|
12
13
|
import { configs as promiseConfigs } from './promise.js';
|
|
13
14
|
import { configs as reactConfigs } from './react.js';
|
|
14
15
|
import { configs as securityConfigs } from './security.js';
|
|
16
|
+
import { configs as testingLibraryConfigs } from './testingLibrary.js';
|
|
15
17
|
import { configs as typescriptEslintConfigs } from './typescriptEslint.js';
|
|
16
18
|
import { configs as unicornConfigs } from './unicorn.js';
|
|
17
19
|
|
|
18
20
|
export {
|
|
19
21
|
eslintConfigs, //
|
|
22
|
+
extensionConfigs,
|
|
20
23
|
importConfigs,
|
|
24
|
+
jestConfigs,
|
|
21
25
|
jsdocConfigs,
|
|
26
|
+
mochaConfigs,
|
|
22
27
|
promiseConfigs,
|
|
23
28
|
reactConfigs,
|
|
24
29
|
securityConfigs,
|
|
30
|
+
testingLibraryConfigs,
|
|
25
31
|
typescriptEslintConfigs,
|
|
26
32
|
unicornConfigs,
|
|
27
33
|
};
|
|
@@ -29,6 +35,10 @@ export {
|
|
|
29
35
|
export interface DefaultConfigOptions {
|
|
30
36
|
parserOptions?: NonNullable<ConfigWithExtends['languageOptions']>['parserOptions'];
|
|
31
37
|
enableRequireExtensionRule?: boolean;
|
|
38
|
+
enableJest?: boolean;
|
|
39
|
+
enableMocha?: boolean;
|
|
40
|
+
enableReact?: boolean;
|
|
41
|
+
enableTestingLibrary?: boolean;
|
|
32
42
|
}
|
|
33
43
|
|
|
34
44
|
/**
|
|
@@ -43,6 +53,10 @@ export const defaultConfig = tsEslintConfig;
|
|
|
43
53
|
*/
|
|
44
54
|
export function tsEslintConfig(options?: DefaultConfigOptions): ConfigWithExtends[] {
|
|
45
55
|
const enableRequireExtensionRule = options?.enableRequireExtensionRule ?? true;
|
|
56
|
+
const enableJest = options?.enableJest ?? true;
|
|
57
|
+
const enableMocha = options?.enableMocha ?? true;
|
|
58
|
+
const enableReact = options?.enableReact ?? true;
|
|
59
|
+
const enableTestingLibrary = options?.enableTestingLibrary ?? true;
|
|
46
60
|
const languageOptions: ConfigWithExtends['languageOptions'] = {
|
|
47
61
|
globals: {
|
|
48
62
|
...globals.node,
|
|
@@ -103,11 +117,15 @@ export function tsEslintConfig(options?: DefaultConfigOptions): ConfigWithExtend
|
|
|
103
117
|
files: ['**/*.ts', '**/*.tsx'],
|
|
104
118
|
...typescriptEslintConfigs.base,
|
|
105
119
|
},
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
120
|
+
...(enableReact
|
|
121
|
+
? [
|
|
122
|
+
{
|
|
123
|
+
name: 'eslint-config-decent/tsx',
|
|
124
|
+
files: ['**/*.tsx'],
|
|
125
|
+
...reactConfigs.base,
|
|
126
|
+
},
|
|
127
|
+
]
|
|
128
|
+
: []),
|
|
111
129
|
{
|
|
112
130
|
name: 'eslint-config-decent/cjs-and-esm',
|
|
113
131
|
files: ['**/*.js', '**/*.cjs', '**/*.mjs'],
|
|
@@ -124,12 +142,36 @@ export function tsEslintConfig(options?: DefaultConfigOptions): ConfigWithExtend
|
|
|
124
142
|
},
|
|
125
143
|
...eslintConfigs.cjs,
|
|
126
144
|
},
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
145
|
+
...(enableMocha
|
|
146
|
+
? [
|
|
147
|
+
{
|
|
148
|
+
name: 'eslint-config-decent/mocha-tests',
|
|
149
|
+
files: ['**/*.tests.ts', 'tests/tests.ts'],
|
|
130
150
|
|
|
131
|
-
|
|
132
|
-
|
|
151
|
+
...mochaConfigs.base,
|
|
152
|
+
},
|
|
153
|
+
]
|
|
154
|
+
: []),
|
|
155
|
+
...(enableJest
|
|
156
|
+
? [
|
|
157
|
+
{
|
|
158
|
+
name: 'eslint-config-decent/jest-tests',
|
|
159
|
+
files: ['**/__tests__/**/*.ts?(x)', '**/*.{spec,test}.ts?(x)'],
|
|
160
|
+
|
|
161
|
+
...jestConfigs.base,
|
|
162
|
+
},
|
|
163
|
+
]
|
|
164
|
+
: []),
|
|
165
|
+
...(enableTestingLibrary
|
|
166
|
+
? [
|
|
167
|
+
{
|
|
168
|
+
name: 'eslint-config-decent/testing-library',
|
|
169
|
+
files: ['**/__tests__/**/*.ts?(x)', '**/*.{spec,test}.ts?(x)'],
|
|
170
|
+
|
|
171
|
+
...testingLibraryConfigs.base,
|
|
172
|
+
},
|
|
173
|
+
]
|
|
174
|
+
: []),
|
|
133
175
|
{
|
|
134
176
|
name: 'eslint-config-decent/cjs-and-esm-disable-ts-rules',
|
|
135
177
|
files: ['**/*.js', '**/*.cjs', '**/*.mjs'],
|
package/src/jest.ts
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { TSESLint } from '@typescript-eslint/utils';
|
|
2
|
+
import jest from 'eslint-plugin-jest';
|
|
3
|
+
import jestDom from 'eslint-plugin-jest-dom';
|
|
4
|
+
|
|
5
|
+
const base: TSESLint.FlatConfig.Config = {
|
|
6
|
+
plugins: {
|
|
7
|
+
jest,
|
|
8
|
+
'jest-dom': jestDom,
|
|
9
|
+
},
|
|
10
|
+
languageOptions: {
|
|
11
|
+
...jest.configs['flat/recommended'].languageOptions,
|
|
12
|
+
},
|
|
13
|
+
rules: {
|
|
14
|
+
...jest.configs['flat/recommended'].rules,
|
|
15
|
+
'jest/max-nested-describe': 'error',
|
|
16
|
+
'jest/no-conditional-in-test': 'error',
|
|
17
|
+
'jest/no-confusing-set-timeout': 'error',
|
|
18
|
+
'jest/no-test-prefixes': 'error',
|
|
19
|
+
'jest/prefer-called-with': 'error',
|
|
20
|
+
'jest/prefer-comparison-matcher': 'error',
|
|
21
|
+
'jest/prefer-equality-matcher': 'error',
|
|
22
|
+
'jest/prefer-hooks-in-order': 'error',
|
|
23
|
+
'jest/prefer-hooks-on-top': 'error',
|
|
24
|
+
'jest/prefer-mock-promise-shorthand': 'error',
|
|
25
|
+
'jest/prefer-snapshot-hint': 'error',
|
|
26
|
+
|
|
27
|
+
...jestDom.configs['flat/recommended'].rules,
|
|
28
|
+
'jest-dom/prefer-checked': 'error',
|
|
29
|
+
'jest-dom/prefer-empty': 'error',
|
|
30
|
+
'jest-dom/prefer-enabled-disabled': 'error',
|
|
31
|
+
'jest-dom/prefer-focus': 'error',
|
|
32
|
+
'jest-dom/prefer-in-document': 'error',
|
|
33
|
+
'jest-dom/prefer-required': 'error',
|
|
34
|
+
'jest-dom/prefer-to-have-attribute': 'error',
|
|
35
|
+
'jest-dom/prefer-to-have-class': 'error',
|
|
36
|
+
'jest-dom/prefer-to-have-style': 'error',
|
|
37
|
+
'jest-dom/prefer-to-have-text-content': 'error',
|
|
38
|
+
'jest-dom/prefer-to-have-value': 'error',
|
|
39
|
+
|
|
40
|
+
'max-classes-per-file': 'off',
|
|
41
|
+
|
|
42
|
+
'@typescript-eslint/no-confusing-void-expression': 'off',
|
|
43
|
+
'@typescript-eslint/no-empty-function': 'off',
|
|
44
|
+
'@typescript-eslint/no-unsafe-member-access': 'off',
|
|
45
|
+
'@typescript-eslint/no-unsafe-argument': 'off',
|
|
46
|
+
'@typescript-eslint/no-unsafe-call': 'off',
|
|
47
|
+
'@typescript-eslint/no-unused-vars': 'off',
|
|
48
|
+
'@typescript-eslint/unbound-method': 'off',
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const configs = {
|
|
53
|
+
base,
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export default {
|
|
57
|
+
configs,
|
|
58
|
+
};
|
package/src/react.ts
CHANGED
|
@@ -3,7 +3,6 @@ import type { TSESLint } from '@typescript-eslint/utils';
|
|
|
3
3
|
import a11y from 'eslint-plugin-jsx-a11y';
|
|
4
4
|
import react from 'eslint-plugin-react';
|
|
5
5
|
import reactHooks from 'eslint-plugin-react-hooks';
|
|
6
|
-
import testingLibrary from 'eslint-plugin-testing-library';
|
|
7
6
|
|
|
8
7
|
const base: TSESLint.FlatConfig.Config = {
|
|
9
8
|
settings: {
|
|
@@ -18,7 +17,6 @@ const base: TSESLint.FlatConfig.Config = {
|
|
|
18
17
|
'jsx-a11y': a11y,
|
|
19
18
|
react,
|
|
20
19
|
'react-hooks': fixupPluginRules(reactHooks) as typeof reactHooks,
|
|
21
|
-
'testing-library': fixupPluginRules(testingLibrary) as typeof testingLibrary,
|
|
22
20
|
},
|
|
23
21
|
rules: {
|
|
24
22
|
...a11y.configs.recommended.rules,
|
|
@@ -73,8 +71,6 @@ const base: TSESLint.FlatConfig.Config = {
|
|
|
73
71
|
|
|
74
72
|
'react-hooks/rules-of-hooks': 'error',
|
|
75
73
|
'react-hooks/exhaustive-deps': 'error',
|
|
76
|
-
|
|
77
|
-
...testingLibrary.configs.react.rules,
|
|
78
74
|
},
|
|
79
75
|
};
|
|
80
76
|
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { fixupPluginRules } from '@eslint/compat';
|
|
2
|
+
import type { TSESLint } from '@typescript-eslint/utils';
|
|
3
|
+
import testingLibrary from 'eslint-plugin-testing-library';
|
|
4
|
+
|
|
5
|
+
const base: TSESLint.FlatConfig.Config = {
|
|
6
|
+
plugins: {
|
|
7
|
+
'testing-library': fixupPluginRules(testingLibrary) as typeof testingLibrary,
|
|
8
|
+
},
|
|
9
|
+
rules: {
|
|
10
|
+
...testingLibrary.configs['flat/react'].rules,
|
|
11
|
+
|
|
12
|
+
'testing-library/no-debugging-utils': 'error',
|
|
13
|
+
'testing-library/prefer-explicit-assert': 'warn',
|
|
14
|
+
'testing-library/prefer-implicit-assert': 'error',
|
|
15
|
+
'testing-library/prefer-query-matchers': 'off',
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export const configs = {
|
|
20
|
+
base,
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export default {
|
|
24
|
+
configs,
|
|
25
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
declare module 'eslint-plugin-jest-dom' {
|
|
2
|
+
import type { TSESLint } from '@typescript-eslint/utils';
|
|
3
|
+
const value: TSESLint.FlatConfig.Plugin & {
|
|
4
|
+
configs: {
|
|
5
|
+
'flat/all': TSESLint.FlatConfig.Config;
|
|
6
|
+
'flat/recommended': TSESLint.FlatConfig.Config;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export default value;
|
|
10
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare module 'eslint-plugin-jest' {
|
|
2
|
+
import type { TSESLint } from '@typescript-eslint/utils';
|
|
3
|
+
const value: TSESLint.FlatConfig.Plugin & {
|
|
4
|
+
configs: {
|
|
5
|
+
'flat/all': TSESLint.FlatConfig.Config;
|
|
6
|
+
'flat/recommended': TSESLint.FlatConfig.Config;
|
|
7
|
+
'flat/style': TSESLint.FlatConfig.Config;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
export default value;
|
|
11
|
+
}
|
|
@@ -2,7 +2,10 @@ declare module 'eslint-plugin-testing-library' {
|
|
|
2
2
|
import type { TSESLint } from '@typescript-eslint/utils';
|
|
3
3
|
const value: TSESLint.FlatConfig.Plugin & {
|
|
4
4
|
configs: {
|
|
5
|
-
|
|
5
|
+
'flat/angular': TSESLint.FlatConfig.Config;
|
|
6
|
+
'flat/dom': TSESLint.FlatConfig.Config;
|
|
7
|
+
'flat/react': TSESLint.FlatConfig.Config;
|
|
8
|
+
'flat/vue': TSESLint.FlatConfig.Config;
|
|
6
9
|
};
|
|
7
10
|
};
|
|
8
11
|
export default value;
|