eslint 9.34.0 → 9.36.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/README.md +6 -1
- package/lib/eslint/eslint.js +8 -4
- package/lib/linter/esquery.js +3 -0
- package/lib/rule-tester/rule-tester.js +3 -0
- package/lib/rules/array-callback-return.js +0 -1
- package/lib/rules/index.js +1 -0
- package/lib/rules/no-empty-function.js +19 -0
- package/lib/rules/no-empty-static-block.js +25 -1
- package/lib/rules/no-empty.js +37 -0
- package/lib/rules/no-eval.js +3 -1
- package/lib/rules/no-loss-of-precision.js +1 -1
- package/lib/rules/no-misleading-character-class.js +7 -2
- package/lib/rules/preserve-caught-error.js +539 -0
- package/lib/rules/require-unicode-regexp.js +3 -1
- package/lib/rules/strict.js +2 -1
- package/lib/services/suppressions-service.js +3 -0
- package/lib/types/index.d.ts +4 -0
- package/lib/types/rules.d.ts +226 -79
- package/package.json +3 -3
package/lib/types/rules.d.ts
CHANGED
@@ -60,25 +60,19 @@ type EitherGroupOrRegEx =
|
|
60
60
|
// Base type for import name specifiers, ensuring mutual exclusivity
|
61
61
|
type EitherNameSpecifiers =
|
62
62
|
| {
|
63
|
-
importNames
|
63
|
+
importNames?: string[];
|
64
|
+
importNamePattern?: string;
|
64
65
|
allowImportNames?: never;
|
65
|
-
importNamePattern?: never;
|
66
66
|
allowImportNamePattern?: never;
|
67
67
|
}
|
68
68
|
| {
|
69
|
-
|
70
|
-
allowImportNames?: never;
|
71
|
-
importNames?: never;
|
72
|
-
allowImportNamePattern?: never;
|
73
|
-
}
|
74
|
-
| {
|
75
|
-
allowImportNames: string[];
|
69
|
+
allowImportNames?: string[];
|
76
70
|
importNames?: never;
|
77
71
|
importNamePattern?: never;
|
78
72
|
allowImportNamePattern?: never;
|
79
73
|
}
|
80
74
|
| {
|
81
|
-
allowImportNamePattern
|
75
|
+
allowImportNamePattern?: string;
|
82
76
|
importNames?: never;
|
83
77
|
allowImportNames?: never;
|
84
78
|
importNamePattern?: never;
|
@@ -90,6 +84,18 @@ type ValidNoRestrictedImportPatternOptions =
|
|
90
84
|
EitherGroupOrRegEx &
|
91
85
|
EitherNameSpecifiers;
|
92
86
|
|
87
|
+
interface CapitalizedCommentsCommonOptions {
|
88
|
+
ignorePattern?: string;
|
89
|
+
/**
|
90
|
+
* @default false
|
91
|
+
*/
|
92
|
+
ignoreInlineComments?: boolean;
|
93
|
+
/**
|
94
|
+
* @default false
|
95
|
+
*/
|
96
|
+
ignoreConsecutiveComments?: boolean;
|
97
|
+
}
|
98
|
+
|
93
99
|
//-----------------------------------------------------------------------------
|
94
100
|
// Public types
|
95
101
|
//-----------------------------------------------------------------------------
|
@@ -402,17 +408,13 @@ export interface ESLintRules extends Linter.RulesRecord {
|
|
402
408
|
"capitalized-comments": Linter.RuleEntry<
|
403
409
|
[
|
404
410
|
"always" | "never",
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
* @default false
|
413
|
-
*/
|
414
|
-
ignoreConsecutiveComments: boolean;
|
415
|
-
}>,
|
411
|
+
(
|
412
|
+
| CapitalizedCommentsCommonOptions
|
413
|
+
| Partial<{
|
414
|
+
line: CapitalizedCommentsCommonOptions;
|
415
|
+
block: CapitalizedCommentsCommonOptions;
|
416
|
+
}>
|
417
|
+
),
|
416
418
|
]
|
417
419
|
>;
|
418
420
|
|
@@ -1020,6 +1022,7 @@ export interface ESLintRules extends Linter.RulesRecord {
|
|
1020
1022
|
*/
|
1021
1023
|
properties: "always" | "never";
|
1022
1024
|
exceptions: string[];
|
1025
|
+
exceptionPatterns: string[];
|
1023
1026
|
}>,
|
1024
1027
|
]
|
1025
1028
|
>;
|
@@ -1038,6 +1041,10 @@ export interface ESLintRules extends Linter.RulesRecord {
|
|
1038
1041
|
* @default false
|
1039
1042
|
*/
|
1040
1043
|
properties: boolean;
|
1044
|
+
/**
|
1045
|
+
* @default false
|
1046
|
+
*/
|
1047
|
+
classFields: boolean;
|
1041
1048
|
/**
|
1042
1049
|
* @default false
|
1043
1050
|
*/
|
@@ -1661,7 +1668,21 @@ export interface ESLintRules extends Linter.RulesRecord {
|
|
1661
1668
|
* @since 5.0.0-alpha.3
|
1662
1669
|
* @see https://eslint.org/docs/latest/rules/max-classes-per-file
|
1663
1670
|
*/
|
1664
|
-
"max-classes-per-file": Linter.RuleEntry<
|
1671
|
+
"max-classes-per-file": Linter.RuleEntry<
|
1672
|
+
[
|
1673
|
+
| number
|
1674
|
+
| Partial<{
|
1675
|
+
/**
|
1676
|
+
* @default false
|
1677
|
+
*/
|
1678
|
+
ignoreExpressions: boolean;
|
1679
|
+
/**
|
1680
|
+
* @default 1
|
1681
|
+
*/
|
1682
|
+
max: number;
|
1683
|
+
}>,
|
1684
|
+
]
|
1685
|
+
>;
|
1665
1686
|
|
1666
1687
|
/**
|
1667
1688
|
* Rule to enforce a maximum depth that blocks can be nested.
|
@@ -1671,12 +1692,18 @@ export interface ESLintRules extends Linter.RulesRecord {
|
|
1671
1692
|
*/
|
1672
1693
|
"max-depth": Linter.RuleEntry<
|
1673
1694
|
[
|
1674
|
-
|
1675
|
-
|
1676
|
-
|
1677
|
-
|
1678
|
-
|
1679
|
-
|
1695
|
+
| number
|
1696
|
+
| Partial<{
|
1697
|
+
/**
|
1698
|
+
* @deprecated
|
1699
|
+
* @default 4
|
1700
|
+
*/
|
1701
|
+
maximum: number;
|
1702
|
+
/**
|
1703
|
+
* @default 4
|
1704
|
+
*/
|
1705
|
+
max: number;
|
1706
|
+
}>,
|
1680
1707
|
]
|
1681
1708
|
>;
|
1682
1709
|
|
@@ -1764,24 +1791,25 @@ export interface ESLintRules extends Linter.RulesRecord {
|
|
1764
1791
|
*/
|
1765
1792
|
"max-lines-per-function": Linter.RuleEntry<
|
1766
1793
|
[
|
1767
|
-
|
1768
|
-
|
1769
|
-
|
1770
|
-
|
1771
|
-
|
1772
|
-
|
1773
|
-
|
1774
|
-
|
1775
|
-
|
1776
|
-
|
1777
|
-
|
1778
|
-
|
1779
|
-
|
1780
|
-
|
1781
|
-
|
1782
|
-
|
1783
|
-
|
1784
|
-
|
1794
|
+
| number
|
1795
|
+
| Partial<{
|
1796
|
+
/**
|
1797
|
+
* @default 50
|
1798
|
+
*/
|
1799
|
+
max: number;
|
1800
|
+
/**
|
1801
|
+
* @default false
|
1802
|
+
*/
|
1803
|
+
skipBlankLines: boolean;
|
1804
|
+
/**
|
1805
|
+
* @default false
|
1806
|
+
*/
|
1807
|
+
skipComments: boolean;
|
1808
|
+
/**
|
1809
|
+
* @default false
|
1810
|
+
*/
|
1811
|
+
IIFEs: boolean;
|
1812
|
+
}>,
|
1785
1813
|
]
|
1786
1814
|
>;
|
1787
1815
|
|
@@ -1793,13 +1821,18 @@ export interface ESLintRules extends Linter.RulesRecord {
|
|
1793
1821
|
*/
|
1794
1822
|
"max-nested-callbacks": Linter.RuleEntry<
|
1795
1823
|
[
|
1824
|
+
| number
|
1796
1825
|
| Partial<{
|
1826
|
+
/**
|
1827
|
+
* @deprecated
|
1828
|
+
* @default 10
|
1829
|
+
*/
|
1830
|
+
maximum: number;
|
1797
1831
|
/**
|
1798
1832
|
* @default 10
|
1799
1833
|
*/
|
1800
1834
|
max: number;
|
1801
|
-
}
|
1802
|
-
| number,
|
1835
|
+
}>,
|
1803
1836
|
]
|
1804
1837
|
>;
|
1805
1838
|
|
@@ -1811,7 +1844,13 @@ export interface ESLintRules extends Linter.RulesRecord {
|
|
1811
1844
|
*/
|
1812
1845
|
"max-params": Linter.RuleEntry<
|
1813
1846
|
[
|
1847
|
+
| number
|
1814
1848
|
| Partial<{
|
1849
|
+
/**
|
1850
|
+
* @deprecated
|
1851
|
+
* @default 3
|
1852
|
+
*/
|
1853
|
+
maximum: number;
|
1815
1854
|
/**
|
1816
1855
|
* @default 3
|
1817
1856
|
*/
|
@@ -1820,8 +1859,7 @@ export interface ESLintRules extends Linter.RulesRecord {
|
|
1820
1859
|
* @default false
|
1821
1860
|
*/
|
1822
1861
|
countVoidThis: boolean;
|
1823
|
-
}
|
1824
|
-
| number,
|
1862
|
+
}>,
|
1825
1863
|
]
|
1826
1864
|
>;
|
1827
1865
|
|
@@ -1833,17 +1871,26 @@ export interface ESLintRules extends Linter.RulesRecord {
|
|
1833
1871
|
*/
|
1834
1872
|
"max-statements": Linter.RuleEntry<
|
1835
1873
|
[
|
1836
|
-
|
1837
|
-
|
1838
|
-
|
1839
|
-
|
1840
|
-
|
1841
|
-
|
1842
|
-
|
1843
|
-
|
1844
|
-
|
1845
|
-
|
1846
|
-
|
1874
|
+
(
|
1875
|
+
| number
|
1876
|
+
| Partial<{
|
1877
|
+
/**
|
1878
|
+
* @deprecated
|
1879
|
+
* @default 10
|
1880
|
+
*/
|
1881
|
+
maximum: number;
|
1882
|
+
/**
|
1883
|
+
* @default 10
|
1884
|
+
*/
|
1885
|
+
max: number;
|
1886
|
+
}>
|
1887
|
+
),
|
1888
|
+
Partial<{
|
1889
|
+
/**
|
1890
|
+
* @default false
|
1891
|
+
*/
|
1892
|
+
ignoreTopLevelFunctions: boolean;
|
1893
|
+
}>,
|
1847
1894
|
]
|
1848
1895
|
>;
|
1849
1896
|
|
@@ -2020,7 +2067,24 @@ export interface ESLintRules extends Linter.RulesRecord {
|
|
2020
2067
|
"no-bitwise": Linter.RuleEntry<
|
2021
2068
|
[
|
2022
2069
|
Partial<{
|
2023
|
-
|
2070
|
+
/**
|
2071
|
+
* @default []
|
2072
|
+
*/
|
2073
|
+
allow: Array<
|
2074
|
+
| "^"
|
2075
|
+
| "|"
|
2076
|
+
| "&"
|
2077
|
+
| "<<"
|
2078
|
+
| ">>"
|
2079
|
+
| ">>>"
|
2080
|
+
| "^="
|
2081
|
+
| "|="
|
2082
|
+
| "&="
|
2083
|
+
| "<<="
|
2084
|
+
| ">>="
|
2085
|
+
| ">>>="
|
2086
|
+
| "~"
|
2087
|
+
>;
|
2024
2088
|
/**
|
2025
2089
|
* @default false
|
2026
2090
|
*/
|
@@ -2172,9 +2236,9 @@ export interface ESLintRules extends Linter.RulesRecord {
|
|
2172
2236
|
[
|
2173
2237
|
{
|
2174
2238
|
/**
|
2175
|
-
* @default
|
2239
|
+
* @default "allExceptWhileTrue"
|
2176
2240
|
*/
|
2177
|
-
checkLoops: boolean;
|
2241
|
+
checkLoops: "all" | "allExceptWhileTrue" | "none" | boolean;
|
2178
2242
|
},
|
2179
2243
|
]
|
2180
2244
|
>;
|
@@ -2401,7 +2465,16 @@ export interface ESLintRules extends Linter.RulesRecord {
|
|
2401
2465
|
* @since 1.7.0
|
2402
2466
|
* @see https://eslint.org/docs/latest/rules/no-empty-pattern
|
2403
2467
|
*/
|
2404
|
-
"no-empty-pattern": Linter.RuleEntry<
|
2468
|
+
"no-empty-pattern": Linter.RuleEntry<
|
2469
|
+
[
|
2470
|
+
Partial<{
|
2471
|
+
/**
|
2472
|
+
* @default false
|
2473
|
+
*/
|
2474
|
+
allowObjectPatternsAsParameters: boolean;
|
2475
|
+
}>,
|
2476
|
+
]
|
2477
|
+
>;
|
2405
2478
|
|
2406
2479
|
/**
|
2407
2480
|
* Rule to disallow empty static blocks.
|
@@ -2674,7 +2747,16 @@ export interface ESLintRules extends Linter.RulesRecord {
|
|
2674
2747
|
* @since 2.0.0-alpha-1
|
2675
2748
|
* @see https://eslint.org/docs/latest/rules/no-implicit-globals
|
2676
2749
|
*/
|
2677
|
-
"no-implicit-globals": Linter.RuleEntry<
|
2750
|
+
"no-implicit-globals": Linter.RuleEntry<
|
2751
|
+
[
|
2752
|
+
Partial<{
|
2753
|
+
/**
|
2754
|
+
* @default false
|
2755
|
+
*/
|
2756
|
+
lexicalBindings: boolean;
|
2757
|
+
}>,
|
2758
|
+
]
|
2759
|
+
>;
|
2678
2760
|
|
2679
2761
|
/**
|
2680
2762
|
* Rule to disallow the use of `eval()`-like methods.
|
@@ -2701,7 +2783,13 @@ export interface ESLintRules extends Linter.RulesRecord {
|
|
2701
2783
|
* @since 0.10.0
|
2702
2784
|
* @see https://eslint.org/docs/latest/rules/no-inline-comments
|
2703
2785
|
*/
|
2704
|
-
"no-inline-comments": Linter.RuleEntry<
|
2786
|
+
"no-inline-comments": Linter.RuleEntry<
|
2787
|
+
[
|
2788
|
+
Partial<{
|
2789
|
+
ignorePattern: string;
|
2790
|
+
}>,
|
2791
|
+
]
|
2792
|
+
>;
|
2705
2793
|
|
2706
2794
|
/**
|
2707
2795
|
* Rule to disallow variable or `function` declarations in nested blocks.
|
@@ -2709,7 +2797,17 @@ export interface ESLintRules extends Linter.RulesRecord {
|
|
2709
2797
|
* @since 0.6.0
|
2710
2798
|
* @see https://eslint.org/docs/latest/rules/no-inner-declarations
|
2711
2799
|
*/
|
2712
|
-
"no-inner-declarations": Linter.RuleEntry<
|
2800
|
+
"no-inner-declarations": Linter.RuleEntry<
|
2801
|
+
[
|
2802
|
+
"functions" | "both",
|
2803
|
+
Partial<{
|
2804
|
+
/**
|
2805
|
+
* @default "allow"
|
2806
|
+
*/
|
2807
|
+
blockScopedFunctions: "allow" | "disallow";
|
2808
|
+
}>,
|
2809
|
+
]
|
2810
|
+
>;
|
2713
2811
|
|
2714
2812
|
/**
|
2715
2813
|
* Rule to disallow invalid regular expression strings in `RegExp` constructors.
|
@@ -2773,6 +2871,10 @@ export interface ESLintRules extends Linter.RulesRecord {
|
|
2773
2871
|
* @default false
|
2774
2872
|
*/
|
2775
2873
|
skipTemplates: boolean;
|
2874
|
+
/**
|
2875
|
+
* @default false
|
2876
|
+
*/
|
2877
|
+
skipJSXText: boolean;
|
2776
2878
|
}>,
|
2777
2879
|
]
|
2778
2880
|
>;
|
@@ -2861,11 +2963,19 @@ export interface ESLintRules extends Linter.RulesRecord {
|
|
2861
2963
|
/**
|
2862
2964
|
* @default []
|
2863
2965
|
*/
|
2864
|
-
ignore: number
|
2966
|
+
ignore: Array<number | string>;
|
2865
2967
|
/**
|
2866
2968
|
* @default false
|
2867
2969
|
*/
|
2868
2970
|
ignoreArrayIndexes: boolean;
|
2971
|
+
/**
|
2972
|
+
* @default false
|
2973
|
+
*/
|
2974
|
+
ignoreDefaultValues: boolean;
|
2975
|
+
/**
|
2976
|
+
* @default false
|
2977
|
+
*/
|
2978
|
+
ignoreClassFieldInitialValues: boolean;
|
2869
2979
|
/**
|
2870
2980
|
* @default false
|
2871
2981
|
*/
|
@@ -2987,7 +3097,16 @@ export interface ESLintRules extends Linter.RulesRecord {
|
|
2987
3097
|
* @since 3.14.0
|
2988
3098
|
* @see https://eslint.org/docs/latest/rules/no-multi-assign
|
2989
3099
|
*/
|
2990
|
-
"no-multi-assign": Linter.RuleEntry<
|
3100
|
+
"no-multi-assign": Linter.RuleEntry<
|
3101
|
+
[
|
3102
|
+
Partial<{
|
3103
|
+
/**
|
3104
|
+
* @default false
|
3105
|
+
*/
|
3106
|
+
ignoreNonDeclaration: boolean;
|
3107
|
+
}>,
|
3108
|
+
]
|
3109
|
+
>;
|
2991
3110
|
|
2992
3111
|
/**
|
2993
3112
|
* Rule to disallow multiple spaces.
|
@@ -3441,9 +3560,9 @@ export interface ESLintRules extends Linter.RulesRecord {
|
|
3441
3560
|
paths: Array<
|
3442
3561
|
string | ValidNoRestrictedImportPathOptions
|
3443
3562
|
>;
|
3444
|
-
patterns:
|
3445
|
-
|
3446
|
-
|
3563
|
+
patterns:
|
3564
|
+
| Array<string>
|
3565
|
+
| Array<ValidNoRestrictedImportPatternOptions>;
|
3447
3566
|
}>
|
3448
3567
|
>,
|
3449
3568
|
]
|
@@ -3561,7 +3680,16 @@ export interface ESLintRules extends Linter.RulesRecord {
|
|
3561
3680
|
* @since 2.0.0-rc.0
|
3562
3681
|
* @see https://eslint.org/docs/latest/rules/no-self-assign
|
3563
3682
|
*/
|
3564
|
-
"no-self-assign": Linter.RuleEntry<
|
3683
|
+
"no-self-assign": Linter.RuleEntry<
|
3684
|
+
[
|
3685
|
+
Partial<{
|
3686
|
+
/**
|
3687
|
+
* @default true
|
3688
|
+
*/
|
3689
|
+
props: boolean;
|
3690
|
+
}>,
|
3691
|
+
]
|
3692
|
+
>;
|
3565
3693
|
|
3566
3694
|
/**
|
3567
3695
|
* Rule to disallow comparisons where both sides are exactly the same.
|
@@ -3935,12 +4063,13 @@ export interface ESLintRules extends Linter.RulesRecord {
|
|
3935
4063
|
/**
|
3936
4064
|
* @default []
|
3937
4065
|
*/
|
3938
|
-
ignore:
|
4066
|
+
ignore: Array<
|
3939
4067
|
| "WhileStatement"
|
3940
4068
|
| "DoWhileStatement"
|
3941
4069
|
| "ForStatement"
|
3942
4070
|
| "ForInStatement"
|
3943
|
-
| "ForOfStatement"
|
4071
|
+
| "ForOfStatement"
|
4072
|
+
>;
|
3944
4073
|
}>,
|
3945
4074
|
]
|
3946
4075
|
>;
|
@@ -4299,7 +4428,7 @@ export interface ESLintRules extends Linter.RulesRecord {
|
|
4299
4428
|
*/
|
4300
4429
|
"no-warning-comments": Linter.RuleEntry<
|
4301
4430
|
[
|
4302
|
-
{
|
4431
|
+
Partial<{
|
4303
4432
|
/**
|
4304
4433
|
* @default ["todo", "fixme", "xxx"]
|
4305
4434
|
*/
|
@@ -4308,7 +4437,8 @@ export interface ESLintRules extends Linter.RulesRecord {
|
|
4308
4437
|
* @default 'start'
|
4309
4438
|
*/
|
4310
4439
|
location: "start" | "anywhere";
|
4311
|
-
|
4440
|
+
decoration: string[];
|
4441
|
+
}>,
|
4312
4442
|
]
|
4313
4443
|
>;
|
4314
4444
|
|
@@ -4809,6 +4939,23 @@ export interface ESLintRules extends Linter.RulesRecord {
|
|
4809
4939
|
*/
|
4810
4940
|
"prefer-template": Linter.RuleEntry<[]>;
|
4811
4941
|
|
4942
|
+
/**
|
4943
|
+
* Rule to disallow losing originally caught error when re-throwing custom errors.
|
4944
|
+
*
|
4945
|
+
* @since 9.35.0
|
4946
|
+
* @see https://eslint.org/docs/latest/rules/preserve-caught-error
|
4947
|
+
*/
|
4948
|
+
"preserve-caught-error": Linter.RuleEntry<
|
4949
|
+
[
|
4950
|
+
Partial<{
|
4951
|
+
/**
|
4952
|
+
* @default false
|
4953
|
+
*/
|
4954
|
+
requireCatchParameter: boolean;
|
4955
|
+
}>,
|
4956
|
+
]
|
4957
|
+
>;
|
4958
|
+
|
4812
4959
|
/**
|
4813
4960
|
* Rule to require quotes around object literal property names.
|
4814
4961
|
*
|
@@ -5331,7 +5478,7 @@ export interface ESLintRules extends Linter.RulesRecord {
|
|
5331
5478
|
*/
|
5332
5479
|
enforceForSwitchCase: boolean;
|
5333
5480
|
/**
|
5334
|
-
* @default
|
5481
|
+
* @default false
|
5335
5482
|
*/
|
5336
5483
|
enforceForIndexOf: boolean;
|
5337
5484
|
}>,
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "eslint",
|
3
|
-
"version": "9.
|
3
|
+
"version": "9.36.0",
|
4
4
|
"author": "Nicholas C. Zakas <nicholas+npm@nczconsulting.com>",
|
5
5
|
"description": "An AST-based pattern checker for JavaScript.",
|
6
6
|
"type": "commonjs",
|
@@ -104,13 +104,13 @@
|
|
104
104
|
"homepage": "https://eslint.org",
|
105
105
|
"bugs": "https://github.com/eslint/eslint/issues/",
|
106
106
|
"dependencies": {
|
107
|
-
"@eslint-community/eslint-utils": "^4.
|
107
|
+
"@eslint-community/eslint-utils": "^4.8.0",
|
108
108
|
"@eslint-community/regexpp": "^4.12.1",
|
109
109
|
"@eslint/config-array": "^0.21.0",
|
110
110
|
"@eslint/config-helpers": "^0.3.1",
|
111
111
|
"@eslint/core": "^0.15.2",
|
112
112
|
"@eslint/eslintrc": "^3.3.1",
|
113
|
-
"@eslint/js": "9.
|
113
|
+
"@eslint/js": "9.36.0",
|
114
114
|
"@eslint/plugin-kit": "^0.3.5",
|
115
115
|
"@humanfs/node": "^0.16.6",
|
116
116
|
"@humanwhocodes/module-importer": "^1.0.1",
|