@depup/typescript-eslint__eslint-plugin 8.68.0-depup.0 → 8.70.0-depup.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 +3 -3
- package/changes.json +2 -2
- package/dist/configs/eslintrc/all.d.ts +1 -0
- package/dist/configs/eslintrc/all.js +1 -0
- package/dist/configs/eslintrc/disable-type-checked.d.ts +1 -0
- package/dist/configs/eslintrc/disable-type-checked.js +1 -0
- package/dist/configs/eslintrc/strict-type-checked-only.d.ts +1 -0
- package/dist/configs/eslintrc/strict-type-checked-only.js +1 -0
- package/dist/configs/eslintrc/strict-type-checked.d.ts +1 -0
- package/dist/configs/eslintrc/strict-type-checked.js +1 -0
- package/dist/configs/flat/all.js +1 -0
- package/dist/configs/flat/disable-type-checked.js +1 -0
- package/dist/configs/flat/strict-type-checked-only.js +1 -0
- package/dist/configs/flat/strict-type-checked.js +1 -0
- package/dist/index.d.ts +8 -1
- package/dist/raw-plugin.d.ts +8 -1
- package/dist/rules/index.d.ts +4 -1
- package/dist/rules/index.js +2 -0
- package/dist/rules/member-ordering.js +57 -1
- package/dist/rules/no-deprecated.js +1 -1
- package/dist/rules/no-generated-empty-object-type.d.ts +4 -0
- package/dist/rules/no-generated-empty-object-type.js +92 -0
- package/dist/rules/no-meaningless-void-operator.d.ts +1 -1
- package/dist/rules/no-meaningless-void-operator.js +42 -1
- package/dist/rules/no-misused-promises.d.ts +5 -1
- package/dist/rules/no-misused-promises.js +61 -1
- package/dist/rules/no-mixed-enums.js +33 -23
- package/dist/rules/no-unnecessary-condition.js +28 -5
- package/dist/rules/unified-signatures.js +1 -5
- package/package.json +18 -18
package/README.md
CHANGED
|
@@ -13,8 +13,8 @@ npm install @depup/typescript-eslint__eslint-plugin
|
|
|
13
13
|
|
|
14
14
|
| Field | Value |
|
|
15
15
|
|-------|-------|
|
|
16
|
-
| Original | [@typescript-eslint/eslint-plugin](https://www.npmjs.com/package/@typescript-eslint/eslint-plugin) @ 8.
|
|
17
|
-
| Processed | 2026-08
|
|
16
|
+
| Original | [@typescript-eslint/eslint-plugin](https://www.npmjs.com/package/@typescript-eslint/eslint-plugin) @ 8.70.0 |
|
|
17
|
+
| Processed | 2026-09-08 |
|
|
18
18
|
| Smoke test | passed |
|
|
19
19
|
| Deps updated | 1 |
|
|
20
20
|
|
|
@@ -22,7 +22,7 @@ npm install @depup/typescript-eslint__eslint-plugin
|
|
|
22
22
|
|
|
23
23
|
| Dependency | From | To |
|
|
24
24
|
|------------|------|-----|
|
|
25
|
-
| ignore | ^7.0.5 | ^7.0.
|
|
25
|
+
| ignore | ^7.0.5 | ^7.0.8 |
|
|
26
26
|
|
|
27
27
|
---
|
|
28
28
|
|
package/changes.json
CHANGED
|
@@ -51,6 +51,7 @@ declare const _default: {
|
|
|
51
51
|
'@typescript-eslint/no-extraneous-class': "error";
|
|
52
52
|
'@typescript-eslint/no-floating-promises': "error";
|
|
53
53
|
'@typescript-eslint/no-for-in-array': "error";
|
|
54
|
+
'@typescript-eslint/no-generated-empty-object-type': "error";
|
|
54
55
|
'no-implied-eval': "off";
|
|
55
56
|
'@typescript-eslint/no-implied-eval': "error";
|
|
56
57
|
'@typescript-eslint/no-import-type-side-effects': "error";
|
|
@@ -58,6 +58,7 @@ module.exports = {
|
|
|
58
58
|
'@typescript-eslint/no-extraneous-class': 'error',
|
|
59
59
|
'@typescript-eslint/no-floating-promises': 'error',
|
|
60
60
|
'@typescript-eslint/no-for-in-array': 'error',
|
|
61
|
+
'@typescript-eslint/no-generated-empty-object-type': 'error',
|
|
61
62
|
'no-implied-eval': 'off',
|
|
62
63
|
'@typescript-eslint/no-implied-eval': 'error',
|
|
63
64
|
'@typescript-eslint/no-import-type-side-effects': 'error',
|
|
@@ -17,6 +17,7 @@ declare const _default: {
|
|
|
17
17
|
'@typescript-eslint/no-duplicate-type-constituents': "off";
|
|
18
18
|
'@typescript-eslint/no-floating-promises': "off";
|
|
19
19
|
'@typescript-eslint/no-for-in-array': "off";
|
|
20
|
+
'@typescript-eslint/no-generated-empty-object-type': "off";
|
|
20
21
|
'@typescript-eslint/no-implied-eval': "off";
|
|
21
22
|
'@typescript-eslint/no-meaningless-void-operator': "off";
|
|
22
23
|
'@typescript-eslint/no-misused-promises': "off";
|
|
@@ -20,6 +20,7 @@ module.exports = {
|
|
|
20
20
|
'@typescript-eslint/no-duplicate-type-constituents': 'off',
|
|
21
21
|
'@typescript-eslint/no-floating-promises': 'off',
|
|
22
22
|
'@typescript-eslint/no-for-in-array': 'off',
|
|
23
|
+
'@typescript-eslint/no-generated-empty-object-type': 'off',
|
|
23
24
|
'@typescript-eslint/no-implied-eval': 'off',
|
|
24
25
|
'@typescript-eslint/no-meaningless-void-operator': 'off',
|
|
25
26
|
'@typescript-eslint/no-misused-promises': 'off',
|
|
@@ -9,6 +9,7 @@ declare const _default: {
|
|
|
9
9
|
'@typescript-eslint/no-duplicate-type-constituents': "error";
|
|
10
10
|
'@typescript-eslint/no-floating-promises': "error";
|
|
11
11
|
'@typescript-eslint/no-for-in-array': "error";
|
|
12
|
+
'@typescript-eslint/no-generated-empty-object-type': "error";
|
|
12
13
|
'no-implied-eval': "off";
|
|
13
14
|
'@typescript-eslint/no-implied-eval': "error";
|
|
14
15
|
'@typescript-eslint/no-meaningless-void-operator': "error";
|
|
@@ -16,6 +16,7 @@ module.exports = {
|
|
|
16
16
|
'@typescript-eslint/no-duplicate-type-constituents': 'error',
|
|
17
17
|
'@typescript-eslint/no-floating-promises': 'error',
|
|
18
18
|
'@typescript-eslint/no-for-in-array': 'error',
|
|
19
|
+
'@typescript-eslint/no-generated-empty-object-type': 'error',
|
|
19
20
|
'no-implied-eval': 'off',
|
|
20
21
|
'@typescript-eslint/no-implied-eval': 'error',
|
|
21
22
|
'@typescript-eslint/no-meaningless-void-operator': 'error',
|
|
@@ -20,6 +20,7 @@ declare const _default: {
|
|
|
20
20
|
'@typescript-eslint/no-extraneous-class': "error";
|
|
21
21
|
'@typescript-eslint/no-floating-promises': "error";
|
|
22
22
|
'@typescript-eslint/no-for-in-array': "error";
|
|
23
|
+
'@typescript-eslint/no-generated-empty-object-type': "error";
|
|
23
24
|
'no-implied-eval': "off";
|
|
24
25
|
'@typescript-eslint/no-implied-eval': "error";
|
|
25
26
|
'@typescript-eslint/no-invalid-void-type': "error";
|
|
@@ -28,6 +28,7 @@ module.exports = {
|
|
|
28
28
|
'@typescript-eslint/no-extraneous-class': 'error',
|
|
29
29
|
'@typescript-eslint/no-floating-promises': 'error',
|
|
30
30
|
'@typescript-eslint/no-for-in-array': 'error',
|
|
31
|
+
'@typescript-eslint/no-generated-empty-object-type': 'error',
|
|
31
32
|
'no-implied-eval': 'off',
|
|
32
33
|
'@typescript-eslint/no-implied-eval': 'error',
|
|
33
34
|
'@typescript-eslint/no-invalid-void-type': 'error',
|
package/dist/configs/flat/all.js
CHANGED
|
@@ -71,6 +71,7 @@ exports.default = (plugin, parser) => [
|
|
|
71
71
|
'@typescript-eslint/no-extraneous-class': 'error',
|
|
72
72
|
'@typescript-eslint/no-floating-promises': 'error',
|
|
73
73
|
'@typescript-eslint/no-for-in-array': 'error',
|
|
74
|
+
'@typescript-eslint/no-generated-empty-object-type': 'error',
|
|
74
75
|
'no-implied-eval': 'off',
|
|
75
76
|
'@typescript-eslint/no-implied-eval': 'error',
|
|
76
77
|
'@typescript-eslint/no-import-type-side-effects': 'error',
|
|
@@ -25,6 +25,7 @@ exports.default = (_plugin, _parser) => ({
|
|
|
25
25
|
'@typescript-eslint/no-duplicate-type-constituents': 'off',
|
|
26
26
|
'@typescript-eslint/no-floating-promises': 'off',
|
|
27
27
|
'@typescript-eslint/no-for-in-array': 'off',
|
|
28
|
+
'@typescript-eslint/no-generated-empty-object-type': 'off',
|
|
28
29
|
'@typescript-eslint/no-implied-eval': 'off',
|
|
29
30
|
'@typescript-eslint/no-meaningless-void-operator': 'off',
|
|
30
31
|
'@typescript-eslint/no-misused-promises': 'off',
|
|
@@ -29,6 +29,7 @@ exports.default = (plugin, parser) => [
|
|
|
29
29
|
'@typescript-eslint/no-duplicate-type-constituents': 'error',
|
|
30
30
|
'@typescript-eslint/no-floating-promises': 'error',
|
|
31
31
|
'@typescript-eslint/no-for-in-array': 'error',
|
|
32
|
+
'@typescript-eslint/no-generated-empty-object-type': 'error',
|
|
32
33
|
'no-implied-eval': 'off',
|
|
33
34
|
'@typescript-eslint/no-implied-eval': 'error',
|
|
34
35
|
'@typescript-eslint/no-meaningless-void-operator': 'error',
|
|
@@ -41,6 +41,7 @@ exports.default = (plugin, parser) => [
|
|
|
41
41
|
'@typescript-eslint/no-extraneous-class': 'error',
|
|
42
42
|
'@typescript-eslint/no-floating-promises': 'error',
|
|
43
43
|
'@typescript-eslint/no-for-in-array': 'error',
|
|
44
|
+
'@typescript-eslint/no-generated-empty-object-type': 'error',
|
|
44
45
|
'no-implied-eval': 'off',
|
|
45
46
|
'@typescript-eslint/no-implied-eval': 'error',
|
|
46
47
|
'@typescript-eslint/no-invalid-void-type': 'error',
|
package/dist/index.d.ts
CHANGED
|
@@ -53,6 +53,7 @@ declare const _default: {
|
|
|
53
53
|
'@typescript-eslint/no-extraneous-class': "error";
|
|
54
54
|
'@typescript-eslint/no-floating-promises': "error";
|
|
55
55
|
'@typescript-eslint/no-for-in-array': "error";
|
|
56
|
+
'@typescript-eslint/no-generated-empty-object-type': "error";
|
|
56
57
|
'no-implied-eval': "off";
|
|
57
58
|
'@typescript-eslint/no-implied-eval': "error";
|
|
58
59
|
'@typescript-eslint/no-import-type-side-effects': "error";
|
|
@@ -180,6 +181,7 @@ declare const _default: {
|
|
|
180
181
|
'@typescript-eslint/no-duplicate-type-constituents': "off";
|
|
181
182
|
'@typescript-eslint/no-floating-promises': "off";
|
|
182
183
|
'@typescript-eslint/no-for-in-array': "off";
|
|
184
|
+
'@typescript-eslint/no-generated-empty-object-type': "off";
|
|
183
185
|
'@typescript-eslint/no-implied-eval': "off";
|
|
184
186
|
'@typescript-eslint/no-meaningless-void-operator': "off";
|
|
185
187
|
'@typescript-eslint/no-misused-promises': "off";
|
|
@@ -468,6 +470,7 @@ declare const _default: {
|
|
|
468
470
|
'@typescript-eslint/no-extraneous-class': "error";
|
|
469
471
|
'@typescript-eslint/no-floating-promises': "error";
|
|
470
472
|
'@typescript-eslint/no-for-in-array': "error";
|
|
473
|
+
'@typescript-eslint/no-generated-empty-object-type': "error";
|
|
471
474
|
'no-implied-eval': "off";
|
|
472
475
|
'@typescript-eslint/no-implied-eval': "error";
|
|
473
476
|
'@typescript-eslint/no-invalid-void-type': "error";
|
|
@@ -554,6 +557,7 @@ declare const _default: {
|
|
|
554
557
|
'@typescript-eslint/no-duplicate-type-constituents': "error";
|
|
555
558
|
'@typescript-eslint/no-floating-promises': "error";
|
|
556
559
|
'@typescript-eslint/no-for-in-array': "error";
|
|
560
|
+
'@typescript-eslint/no-generated-empty-object-type': "error";
|
|
557
561
|
'no-implied-eval': "off";
|
|
558
562
|
'@typescript-eslint/no-implied-eval': "error";
|
|
559
563
|
'@typescript-eslint/no-meaningless-void-operator': "error";
|
|
@@ -820,6 +824,9 @@ declare const _default: {
|
|
|
820
824
|
'no-for-in-array': import("@typescript-eslint/utils/ts-eslint").RuleModule<"forInViolation", [], import("../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
821
825
|
name: string;
|
|
822
826
|
};
|
|
827
|
+
'no-generated-empty-object-type': import("@typescript-eslint/utils/ts-eslint").RuleModule<"noGeneratedEmptyObjectType", [], import("../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
828
|
+
name: string;
|
|
829
|
+
};
|
|
823
830
|
'no-implied-eval': import("@typescript-eslint/utils/ts-eslint").RuleModule<"noFunctionConstructor" | "noImpliedEvalError", [], import("../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
824
831
|
name: string;
|
|
825
832
|
};
|
|
@@ -855,7 +862,7 @@ declare const _default: {
|
|
|
855
862
|
}], import("../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
856
863
|
name: string;
|
|
857
864
|
};
|
|
858
|
-
'no-meaningless-void-operator': import("@typescript-eslint/utils/ts-eslint").RuleModule<"meaninglessVoidOperator" | "removeVoid", import("./rules/no-meaningless-void-operator").Options, import("../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
865
|
+
'no-meaningless-void-operator': import("@typescript-eslint/utils/ts-eslint").RuleModule<"meaninglessVoidOnNonCall" | "meaninglessVoidOperator" | "removeVoid", import("./rules/no-meaningless-void-operator").Options, import("../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
859
866
|
name: string;
|
|
860
867
|
};
|
|
861
868
|
'no-misused-new': import("@typescript-eslint/utils/ts-eslint").RuleModule<"errorMessageClass" | "errorMessageInterface", [], import("../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
package/dist/raw-plugin.d.ts
CHANGED
|
@@ -75,6 +75,7 @@ declare const _default: {
|
|
|
75
75
|
'@typescript-eslint/no-extraneous-class': "error";
|
|
76
76
|
'@typescript-eslint/no-floating-promises': "error";
|
|
77
77
|
'@typescript-eslint/no-for-in-array': "error";
|
|
78
|
+
'@typescript-eslint/no-generated-empty-object-type': "error";
|
|
78
79
|
'no-implied-eval': "off";
|
|
79
80
|
'@typescript-eslint/no-implied-eval': "error";
|
|
80
81
|
'@typescript-eslint/no-import-type-side-effects': "error";
|
|
@@ -202,6 +203,7 @@ declare const _default: {
|
|
|
202
203
|
'@typescript-eslint/no-duplicate-type-constituents': "off";
|
|
203
204
|
'@typescript-eslint/no-floating-promises': "off";
|
|
204
205
|
'@typescript-eslint/no-for-in-array': "off";
|
|
206
|
+
'@typescript-eslint/no-generated-empty-object-type': "off";
|
|
205
207
|
'@typescript-eslint/no-implied-eval': "off";
|
|
206
208
|
'@typescript-eslint/no-meaningless-void-operator': "off";
|
|
207
209
|
'@typescript-eslint/no-misused-promises': "off";
|
|
@@ -491,6 +493,7 @@ declare const _default: {
|
|
|
491
493
|
'@typescript-eslint/no-extraneous-class': "error";
|
|
492
494
|
'@typescript-eslint/no-floating-promises': "error";
|
|
493
495
|
'@typescript-eslint/no-for-in-array': "error";
|
|
496
|
+
'@typescript-eslint/no-generated-empty-object-type': "error";
|
|
494
497
|
'no-implied-eval': "off";
|
|
495
498
|
'@typescript-eslint/no-implied-eval': "error";
|
|
496
499
|
'@typescript-eslint/no-invalid-void-type': "error";
|
|
@@ -577,6 +580,7 @@ declare const _default: {
|
|
|
577
580
|
'@typescript-eslint/no-duplicate-type-constituents': "error";
|
|
578
581
|
'@typescript-eslint/no-floating-promises': "error";
|
|
579
582
|
'@typescript-eslint/no-for-in-array': "error";
|
|
583
|
+
'@typescript-eslint/no-generated-empty-object-type': "error";
|
|
580
584
|
'no-implied-eval': "off";
|
|
581
585
|
'@typescript-eslint/no-implied-eval': "error";
|
|
582
586
|
'@typescript-eslint/no-meaningless-void-operator': "error";
|
|
@@ -843,6 +847,9 @@ declare const _default: {
|
|
|
843
847
|
'no-for-in-array': TSESLint.RuleModule<"forInViolation", [], import("../rules").ESLintPluginDocs, TSESLint.RuleListener> & {
|
|
844
848
|
name: string;
|
|
845
849
|
};
|
|
850
|
+
'no-generated-empty-object-type': TSESLint.RuleModule<"noGeneratedEmptyObjectType", [], import("../rules").ESLintPluginDocs, TSESLint.RuleListener> & {
|
|
851
|
+
name: string;
|
|
852
|
+
};
|
|
846
853
|
'no-implied-eval': TSESLint.RuleModule<"noFunctionConstructor" | "noImpliedEvalError", [], import("../rules").ESLintPluginDocs, TSESLint.RuleListener> & {
|
|
847
854
|
name: string;
|
|
848
855
|
};
|
|
@@ -878,7 +885,7 @@ declare const _default: {
|
|
|
878
885
|
}], import("../rules").ESLintPluginDocs, TSESLint.RuleListener> & {
|
|
879
886
|
name: string;
|
|
880
887
|
};
|
|
881
|
-
'no-meaningless-void-operator': TSESLint.RuleModule<"meaninglessVoidOperator" | "removeVoid", import("./rules/no-meaningless-void-operator").Options, import("../rules").ESLintPluginDocs, TSESLint.RuleListener> & {
|
|
888
|
+
'no-meaningless-void-operator': TSESLint.RuleModule<"meaninglessVoidOnNonCall" | "meaninglessVoidOperator" | "removeVoid", import("./rules/no-meaningless-void-operator").Options, import("../rules").ESLintPluginDocs, TSESLint.RuleListener> & {
|
|
882
889
|
name: string;
|
|
883
890
|
};
|
|
884
891
|
'no-misused-new': TSESLint.RuleModule<"errorMessageClass" | "errorMessageInterface", [], import("../rules").ESLintPluginDocs, TSESLint.RuleListener> & {
|
package/dist/rules/index.d.ts
CHANGED
|
@@ -145,6 +145,9 @@ declare const rules: {
|
|
|
145
145
|
'no-for-in-array': import("@typescript-eslint/utils/ts-eslint").RuleModule<"forInViolation", [], import("../../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
146
146
|
name: string;
|
|
147
147
|
};
|
|
148
|
+
'no-generated-empty-object-type': import("@typescript-eslint/utils/ts-eslint").RuleModule<"noGeneratedEmptyObjectType", [], import("../../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
149
|
+
name: string;
|
|
150
|
+
};
|
|
148
151
|
'no-implied-eval': import("@typescript-eslint/utils/ts-eslint").RuleModule<"noFunctionConstructor" | "noImpliedEvalError", [], import("../../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
149
152
|
name: string;
|
|
150
153
|
};
|
|
@@ -180,7 +183,7 @@ declare const rules: {
|
|
|
180
183
|
}], import("../../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
181
184
|
name: string;
|
|
182
185
|
};
|
|
183
|
-
'no-meaningless-void-operator': import("@typescript-eslint/utils/ts-eslint").RuleModule<"meaninglessVoidOperator" | "removeVoid", import("./no-meaningless-void-operator").Options, import("../../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
186
|
+
'no-meaningless-void-operator': import("@typescript-eslint/utils/ts-eslint").RuleModule<"meaninglessVoidOnNonCall" | "meaninglessVoidOperator" | "removeVoid", import("./no-meaningless-void-operator").Options, import("../../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
|
184
187
|
name: string;
|
|
185
188
|
};
|
|
186
189
|
'no-misused-new': import("@typescript-eslint/utils/ts-eslint").RuleModule<"errorMessageClass" | "errorMessageInterface", [], import("../../rules").ESLintPluginDocs, import("@typescript-eslint/utils/ts-eslint").RuleListener> & {
|
package/dist/rules/index.js
CHANGED
|
@@ -44,6 +44,7 @@ const no_extra_non_null_assertion_1 = __importDefault(require("./no-extra-non-nu
|
|
|
44
44
|
const no_extraneous_class_1 = __importDefault(require("./no-extraneous-class"));
|
|
45
45
|
const no_floating_promises_1 = __importDefault(require("./no-floating-promises"));
|
|
46
46
|
const no_for_in_array_1 = __importDefault(require("./no-for-in-array"));
|
|
47
|
+
const no_generated_empty_object_type_1 = __importDefault(require("./no-generated-empty-object-type"));
|
|
47
48
|
const no_implied_eval_1 = __importDefault(require("./no-implied-eval"));
|
|
48
49
|
const no_import_type_side_effects_1 = __importDefault(require("./no-import-type-side-effects"));
|
|
49
50
|
const no_inferrable_types_1 = __importDefault(require("./no-inferrable-types"));
|
|
@@ -179,6 +180,7 @@ const rules = {
|
|
|
179
180
|
'no-extraneous-class': no_extraneous_class_1.default,
|
|
180
181
|
'no-floating-promises': no_floating_promises_1.default,
|
|
181
182
|
'no-for-in-array': no_for_in_array_1.default,
|
|
183
|
+
'no-generated-empty-object-type': no_generated_empty_object_type_1.default,
|
|
182
184
|
'no-implied-eval': no_implied_eval_1.default,
|
|
183
185
|
'no-import-type-side-effects': no_import_type_side_effects_1.default,
|
|
184
186
|
'no-inferrable-types': no_inferrable_types_1.default,
|
|
@@ -330,6 +330,57 @@ function isMemberOptional(node) {
|
|
|
330
330
|
}
|
|
331
331
|
return false;
|
|
332
332
|
}
|
|
333
|
+
function getMemberInitializer(node) {
|
|
334
|
+
switch (node.type) {
|
|
335
|
+
case utils_1.AST_NODE_TYPES.AccessorProperty:
|
|
336
|
+
case utils_1.AST_NODE_TYPES.PropertyDefinition:
|
|
337
|
+
return node.value;
|
|
338
|
+
}
|
|
339
|
+
return undefined;
|
|
340
|
+
}
|
|
341
|
+
function getThisPropertyName(node) {
|
|
342
|
+
return node.computed
|
|
343
|
+
? (0, util_1.getStaticStringValue)(node.property)
|
|
344
|
+
: node.property.name;
|
|
345
|
+
}
|
|
346
|
+
function isEvaluatedLater(node, initializer) {
|
|
347
|
+
for (let current = node; current !== initializer.parent; current = (0, util_1.nullThrows)(current.parent, util_1.NullThrowsReasons.MissingParent)) {
|
|
348
|
+
if (current.type === utils_1.AST_NODE_TYPES.ArrowFunctionExpression ||
|
|
349
|
+
current.type === utils_1.AST_NODE_TYPES.ClassBody ||
|
|
350
|
+
current.type === utils_1.AST_NODE_TYPES.FunctionExpression) {
|
|
351
|
+
return true;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
return false;
|
|
355
|
+
}
|
|
356
|
+
function collectImmediateThisPropertyNames(initializer) {
|
|
357
|
+
const names = new Set();
|
|
358
|
+
(0, util_1.forEachChildESTree)(initializer, node => {
|
|
359
|
+
if (node.type === utils_1.AST_NODE_TYPES.MemberExpression &&
|
|
360
|
+
node.object.type === utils_1.AST_NODE_TYPES.ThisExpression &&
|
|
361
|
+
!isEvaluatedLater(node, initializer)) {
|
|
362
|
+
const name = getThisPropertyName(node);
|
|
363
|
+
if (name != null) {
|
|
364
|
+
names.add(name);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
return null;
|
|
368
|
+
});
|
|
369
|
+
return names;
|
|
370
|
+
}
|
|
371
|
+
function isBlockedByEarlierMemberReferences(member, members, fromIndex, toIndex, sourceCode) {
|
|
372
|
+
const initializer = getMemberInitializer(member);
|
|
373
|
+
if (!initializer) {
|
|
374
|
+
return false;
|
|
375
|
+
}
|
|
376
|
+
const referencedNames = collectImmediateThisPropertyNames(initializer);
|
|
377
|
+
return members.slice(fromIndex, toIndex).some(other => {
|
|
378
|
+
const otherName = getMemberName(other, sourceCode);
|
|
379
|
+
return (otherName != null &&
|
|
380
|
+
getMemberInitializer(other) != null &&
|
|
381
|
+
referencedNames.has(otherName));
|
|
382
|
+
});
|
|
383
|
+
}
|
|
333
384
|
/**
|
|
334
385
|
* Gets the calculated rank using the provided method definition.
|
|
335
386
|
* The algorithm is as follows:
|
|
@@ -664,13 +715,17 @@ exports.default = (0, util_1.createRule)({
|
|
|
664
715
|
*/
|
|
665
716
|
function checkAlphaSort(members, order) {
|
|
666
717
|
let previousName = '';
|
|
718
|
+
let previousIndex = 0;
|
|
667
719
|
let isCorrectlySorted = true;
|
|
668
720
|
// Find first member which isn't correctly sorted
|
|
669
|
-
members.forEach(member => {
|
|
721
|
+
members.forEach((member, index) => {
|
|
670
722
|
const name = getMemberName(member, context.sourceCode);
|
|
671
723
|
// Note: Not all members have names
|
|
672
724
|
if (name) {
|
|
673
725
|
if (naturalOutOfOrder(name, previousName, order)) {
|
|
726
|
+
if (isBlockedByEarlierMemberReferences(member, members, previousIndex, index, context.sourceCode)) {
|
|
727
|
+
return;
|
|
728
|
+
}
|
|
674
729
|
context.report({
|
|
675
730
|
node: member,
|
|
676
731
|
messageId: 'incorrectOrder',
|
|
@@ -682,6 +737,7 @@ exports.default = (0, util_1.createRule)({
|
|
|
682
737
|
isCorrectlySorted = false;
|
|
683
738
|
}
|
|
684
739
|
previousName = name;
|
|
740
|
+
previousIndex = index;
|
|
685
741
|
}
|
|
686
742
|
});
|
|
687
743
|
return isCorrectlySorted;
|
|
@@ -291,7 +291,7 @@ exports.default = (0, util_1.createRule)({
|
|
|
291
291
|
return (searchForDeprecationInAliasesChain(propertySymbol, true) ??
|
|
292
292
|
getJsDocDeprecation(property) ??
|
|
293
293
|
getJsDocDeprecation(propertySymbol) ??
|
|
294
|
-
|
|
294
|
+
searchForDeprecationInAliasesChain(valueSymbol, true));
|
|
295
295
|
}
|
|
296
296
|
return searchForDeprecationInAliasesChain(services.getSymbolAtLocation(node), true);
|
|
297
297
|
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
const utils_1 = require("@typescript-eslint/utils");
|
|
37
|
+
const tsutils = __importStar(require("ts-api-utils"));
|
|
38
|
+
const ts = __importStar(require("typescript"));
|
|
39
|
+
const util_1 = require("../util");
|
|
40
|
+
exports.default = (0, util_1.createRule)({
|
|
41
|
+
name: 'no-generated-empty-object-type',
|
|
42
|
+
meta: {
|
|
43
|
+
type: 'problem',
|
|
44
|
+
docs: {
|
|
45
|
+
description: 'Disallow type operations that resolve to the "empty object" type',
|
|
46
|
+
recommended: 'strict',
|
|
47
|
+
requiresTypeChecking: true,
|
|
48
|
+
},
|
|
49
|
+
messages: {
|
|
50
|
+
noGeneratedEmptyObjectType: 'This type resolves to `{}`, the empty object type. This was likely not intentional.',
|
|
51
|
+
},
|
|
52
|
+
schema: [],
|
|
53
|
+
},
|
|
54
|
+
defaultOptions: [],
|
|
55
|
+
create(context) {
|
|
56
|
+
const services = (0, util_1.getParserServices)(context);
|
|
57
|
+
const checker = services.program.getTypeChecker();
|
|
58
|
+
function isEmptyObjectType(type) {
|
|
59
|
+
return (tsutils.isObjectType(type) &&
|
|
60
|
+
!tsutils.isObjectFlagSet(type, ts.ObjectFlags.Class | ts.ObjectFlags.Interface) &&
|
|
61
|
+
checker.getPropertiesOfType(type).length === 0 &&
|
|
62
|
+
checker.getIndexInfosOfType(type).length === 0 &&
|
|
63
|
+
type.getCallSignatures().length === 0 &&
|
|
64
|
+
type.getConstructSignatures().length === 0 &&
|
|
65
|
+
// Types still awaiting type arguments, such as `Record<T, unknown>`
|
|
66
|
+
// inside a generic declaration, also have no members yet.
|
|
67
|
+
checker.isTypeAssignableTo(checker.getNumberType(), type));
|
|
68
|
+
}
|
|
69
|
+
function containsEmptyObjectType(type) {
|
|
70
|
+
return (isEmptyObjectType(type) ||
|
|
71
|
+
(type.isUnion() && type.types.some(isEmptyObjectType)));
|
|
72
|
+
}
|
|
73
|
+
function checkNode(node) {
|
|
74
|
+
if (containsEmptyObjectType(services.getTypeAtLocation(node))) {
|
|
75
|
+
context.report({
|
|
76
|
+
node,
|
|
77
|
+
messageId: 'noGeneratedEmptyObjectType',
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return {
|
|
82
|
+
TSIntersectionType: checkNode,
|
|
83
|
+
TSTypeReference(node) {
|
|
84
|
+
if (node.typeArguments &&
|
|
85
|
+
node.parent.type !== utils_1.AST_NODE_TYPES.TSIntersectionType) {
|
|
86
|
+
checkNode(node);
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
//# sourceMappingURL=no-generated-empty-object-type.js.map
|
|
@@ -4,7 +4,7 @@ export type Options = [
|
|
|
4
4
|
checkNever: boolean;
|
|
5
5
|
}
|
|
6
6
|
];
|
|
7
|
-
declare const _default: TSESLint.RuleModule<"meaninglessVoidOperator" | "removeVoid", Options, import("../../rules").ESLintPluginDocs, TSESLint.RuleListener> & {
|
|
7
|
+
declare const _default: TSESLint.RuleModule<"meaninglessVoidOnNonCall" | "meaninglessVoidOperator" | "removeVoid", Options, import("../../rules").ESLintPluginDocs, TSESLint.RuleListener> & {
|
|
8
8
|
name: string;
|
|
9
9
|
};
|
|
10
10
|
export default _default;
|
|
@@ -49,6 +49,7 @@ exports.default = (0, util_1.createRule)({
|
|
|
49
49
|
fixable: 'code',
|
|
50
50
|
hasSuggestions: true,
|
|
51
51
|
messages: {
|
|
52
|
+
meaninglessVoidOnNonCall: "void operator is useless here; it should only discard a call's return value",
|
|
52
53
|
meaninglessVoidOperator: "void operator shouldn't be used on {{type}}; it should convey that a return value is being ignored",
|
|
53
54
|
removeVoid: "Remove 'void'",
|
|
54
55
|
},
|
|
@@ -59,7 +60,7 @@ exports.default = (0, util_1.createRule)({
|
|
|
59
60
|
properties: {
|
|
60
61
|
checkNever: {
|
|
61
62
|
type: 'boolean',
|
|
62
|
-
description:
|
|
63
|
+
description: "Whether to suggest removing `void` when a call's return type is `never`.",
|
|
63
64
|
},
|
|
64
65
|
},
|
|
65
66
|
},
|
|
@@ -77,6 +78,27 @@ exports.default = (0, util_1.createRule)({
|
|
|
77
78
|
context.sourceCode.getTokens(node)[1].range[0],
|
|
78
79
|
]);
|
|
79
80
|
};
|
|
81
|
+
const inner = unwrapVoidArgument(node.argument);
|
|
82
|
+
if (inner.type !== utils_1.AST_NODE_TYPES.CallExpression) {
|
|
83
|
+
// `void 0` is a common undefined idiom, not a discarded call.
|
|
84
|
+
if (inner.type === utils_1.AST_NODE_TYPES.Literal && inner.value === 0) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
const tsArgument = services.esTreeNodeToTSNodeMap.get(node.argument);
|
|
88
|
+
const argType = services.getTypeAtLocation(node.argument);
|
|
89
|
+
// Allow `void promiseValue` so this rule does not fight no-floating-promises.
|
|
90
|
+
if (tsutils.isThenableType(checker, tsArgument, argType)) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
context.report({
|
|
94
|
+
node,
|
|
95
|
+
messageId: 'meaninglessVoidOnNonCall',
|
|
96
|
+
fix: node.parent.type === utils_1.AST_NODE_TYPES.ExpressionStatement
|
|
97
|
+
? fix
|
|
98
|
+
: undefined,
|
|
99
|
+
});
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
80
102
|
const argType = services.getTypeAtLocation(node.argument);
|
|
81
103
|
const unionParts = tsutils.unionConstituents(argType);
|
|
82
104
|
if (unionParts.every(part => tsutils.isTypeFlagSet(part, ts.TypeFlags.Void | ts.TypeFlags.Undefined))) {
|
|
@@ -100,4 +122,23 @@ exports.default = (0, util_1.createRule)({
|
|
|
100
122
|
};
|
|
101
123
|
},
|
|
102
124
|
});
|
|
125
|
+
function unwrapVoidArgument(node) {
|
|
126
|
+
let current = node;
|
|
127
|
+
while (true) {
|
|
128
|
+
switch (current.type) {
|
|
129
|
+
case utils_1.AST_NODE_TYPES.ChainExpression:
|
|
130
|
+
case utils_1.AST_NODE_TYPES.TSAsExpression:
|
|
131
|
+
case utils_1.AST_NODE_TYPES.TSNonNullExpression:
|
|
132
|
+
case utils_1.AST_NODE_TYPES.TSSatisfiesExpression:
|
|
133
|
+
case utils_1.AST_NODE_TYPES.TSTypeAssertion:
|
|
134
|
+
current = current.expression;
|
|
135
|
+
continue;
|
|
136
|
+
case utils_1.AST_NODE_TYPES.SequenceExpression:
|
|
137
|
+
current = (0, util_1.nullThrows)(current.expressions.at(-1), 'Expected SequenceExpression to have at least one expression');
|
|
138
|
+
continue;
|
|
139
|
+
default:
|
|
140
|
+
return current;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
}
|
|
103
144
|
//# sourceMappingURL=no-meaningless-void-operator.js.map
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import type { TSESLint } from '@typescript-eslint/utils';
|
|
2
2
|
export type Options = [
|
|
3
3
|
{
|
|
4
|
-
checksConditionals?: boolean;
|
|
4
|
+
checksConditionals?: boolean | ChecksConditionalsOptions;
|
|
5
5
|
checksSpreads?: boolean;
|
|
6
6
|
checksVoidReturn?: boolean | ChecksVoidReturnOptions;
|
|
7
7
|
}
|
|
8
8
|
];
|
|
9
|
+
export type FlagUnionsOptions = 'all' | 'none' | 'strict';
|
|
10
|
+
export interface ChecksConditionalsOptions {
|
|
11
|
+
flagUnions?: FlagUnionsOptions;
|
|
12
|
+
}
|
|
9
13
|
export interface ChecksVoidReturnOptions {
|
|
10
14
|
arguments?: boolean;
|
|
11
15
|
attributes?: boolean;
|
|
@@ -89,8 +89,25 @@ exports.default = (0, util_1.createRule)({
|
|
|
89
89
|
additionalProperties: false,
|
|
90
90
|
properties: {
|
|
91
91
|
checksConditionals: {
|
|
92
|
-
type: 'boolean',
|
|
93
92
|
description: 'Whether to warn when a Promise is provided to conditional statements.',
|
|
93
|
+
oneOf: [
|
|
94
|
+
{
|
|
95
|
+
type: 'boolean',
|
|
96
|
+
description: 'Whether to check conditionals.',
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
type: 'object',
|
|
100
|
+
additionalProperties: false,
|
|
101
|
+
description: 'Detailed settings for conditional inspection.',
|
|
102
|
+
properties: {
|
|
103
|
+
flagUnions: {
|
|
104
|
+
type: 'string',
|
|
105
|
+
description: 'Configures how union types containing Promise-like types are checked.',
|
|
106
|
+
enum: ['all', 'strict', 'none'],
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
],
|
|
94
111
|
},
|
|
95
112
|
checksSpreads: {
|
|
96
113
|
type: 'boolean',
|
|
@@ -151,6 +168,7 @@ exports.default = (0, util_1.createRule)({
|
|
|
151
168
|
const services = (0, util_1.getParserServices)(context);
|
|
152
169
|
const checker = services.program.getTypeChecker();
|
|
153
170
|
const checkedNodes = new Set();
|
|
171
|
+
const flagUnionsOption = normalizeFlagUnionsOption(checksConditionals);
|
|
154
172
|
const conditionalChecks = {
|
|
155
173
|
'CallExpression > MemberExpression': checkArrayPredicates,
|
|
156
174
|
ConditionalExpression: checkTestConditional,
|
|
@@ -284,6 +302,22 @@ exports.default = (0, util_1.createRule)({
|
|
|
284
302
|
node,
|
|
285
303
|
messageId: 'conditional',
|
|
286
304
|
});
|
|
305
|
+
return;
|
|
306
|
+
}
|
|
307
|
+
if (
|
|
308
|
+
// none -> Report `Promise` but not `Promise | ...`
|
|
309
|
+
(flagUnionsOption === 'none' && isAlwaysThenable(checker, tsNode)) ||
|
|
310
|
+
//
|
|
311
|
+
// all -> Report `Promise` and `Promise | ...`
|
|
312
|
+
(flagUnionsOption === 'all' && isSometimesThenable(checker, tsNode)) ||
|
|
313
|
+
//
|
|
314
|
+
// strict -> Report `Promise<T> | T` but not `Promise<T> | NotT`
|
|
315
|
+
(flagUnionsOption === 'strict' &&
|
|
316
|
+
hasMatchingPromiseTypeArgument(checker, tsNode))) {
|
|
317
|
+
context.report({
|
|
318
|
+
node,
|
|
319
|
+
messageId: 'conditional',
|
|
320
|
+
});
|
|
287
321
|
}
|
|
288
322
|
}
|
|
289
323
|
function checkArrayPredicates(node) {
|
|
@@ -801,4 +835,30 @@ function hasWellKnownSymbolWithVoidReturn(checker, node, type, symbolName) {
|
|
|
801
835
|
return isVoidReturningFunctionType(checker, node, checker.getTypeOfSymbolAtLocation(symbol, node));
|
|
802
836
|
});
|
|
803
837
|
}
|
|
838
|
+
/**
|
|
839
|
+
* Check that the Promise argument is the same as the rest of the type when it is a Union that contains Promise.
|
|
840
|
+
*/
|
|
841
|
+
function hasMatchingPromiseTypeArgument(checker, node) {
|
|
842
|
+
const type = checker.getTypeAtLocation(node);
|
|
843
|
+
const unionConstituents = tsutils.unionConstituents(checker.getApparentType(type));
|
|
844
|
+
const promiseType = unionConstituents.find(type => tsutils.isThenableType(checker, node, type));
|
|
845
|
+
if (!promiseType) {
|
|
846
|
+
return false;
|
|
847
|
+
}
|
|
848
|
+
const nonPromiseUnionConstituents = unionConstituents.filter(type => type !== promiseType);
|
|
849
|
+
const awaitedType = checker.getAwaitedType(promiseType);
|
|
850
|
+
if (!awaitedType) {
|
|
851
|
+
return false;
|
|
852
|
+
}
|
|
853
|
+
const awaitedTypeConstituents = tsutils.unionConstituents(awaitedType);
|
|
854
|
+
return (nonPromiseUnionConstituents.length === awaitedTypeConstituents.length &&
|
|
855
|
+
nonPromiseUnionConstituents.every(type => awaitedTypeConstituents.some(awaited => checker.isTypeAssignableTo(type, awaited) &&
|
|
856
|
+
checker.isTypeAssignableTo(awaited, type))));
|
|
857
|
+
}
|
|
858
|
+
function normalizeFlagUnionsOption(checksConditionals) {
|
|
859
|
+
if (!checksConditionals || checksConditionals === true) {
|
|
860
|
+
return 'none';
|
|
861
|
+
}
|
|
862
|
+
return checksConditionals.flagUnions ?? 'none';
|
|
863
|
+
}
|
|
804
864
|
//# sourceMappingURL=no-misused-promises.js.map
|
|
@@ -62,14 +62,40 @@ exports.default = (0, util_1.createRule)({
|
|
|
62
62
|
create(context) {
|
|
63
63
|
const parserServices = (0, util_1.getParserServices)(context);
|
|
64
64
|
const typeChecker = parserServices.program.getTypeChecker();
|
|
65
|
+
function getModuleName(id) {
|
|
66
|
+
if (id.type === utils_1.AST_NODE_TYPES.Literal) {
|
|
67
|
+
return JSON.stringify(id.value);
|
|
68
|
+
}
|
|
69
|
+
let qualifiers = '';
|
|
70
|
+
let current = id;
|
|
71
|
+
while (current.type === utils_1.AST_NODE_TYPES.TSQualifiedName) {
|
|
72
|
+
qualifiers = `.${current.right.name}${qualifiers}`;
|
|
73
|
+
current = current.left;
|
|
74
|
+
}
|
|
75
|
+
return context.sourceCode.getText(current) + qualifiers;
|
|
76
|
+
}
|
|
77
|
+
function getMergedScopes(scope) {
|
|
78
|
+
const { block } = scope;
|
|
79
|
+
if (block.type !== utils_1.AST_NODE_TYPES.TSModuleDeclaration) {
|
|
80
|
+
return [scope];
|
|
81
|
+
}
|
|
82
|
+
const name = getModuleName(block.id);
|
|
83
|
+
return getEnclosingScopes(block).flatMap(enclosing => enclosing.childScopes.filter(childScope => childScope.block.type === utils_1.AST_NODE_TYPES.TSModuleDeclaration &&
|
|
84
|
+
getModuleName(childScope.block.id) === name));
|
|
85
|
+
}
|
|
86
|
+
function getEnclosingScopes(node) {
|
|
87
|
+
const enclosing = (0, util_1.nullThrows)(context.sourceCode.getScope(node).upper, util_1.NullThrowsReasons.MissingParent);
|
|
88
|
+
return node.parent.type === utils_1.AST_NODE_TYPES.ExportNamedDeclaration
|
|
89
|
+
? getMergedScopes(enclosing)
|
|
90
|
+
: [enclosing];
|
|
91
|
+
}
|
|
65
92
|
function collectNodeDefinitions(node) {
|
|
66
93
|
const { name } = node.id;
|
|
67
94
|
const found = {
|
|
68
95
|
imports: [],
|
|
69
96
|
previousSibling: undefined,
|
|
70
97
|
};
|
|
71
|
-
|
|
72
|
-
for (const definition of scope.upper?.set.get(name)?.defs ?? []) {
|
|
98
|
+
for (const definition of getEnclosingScopes(node).flatMap(enclosing => enclosing.set.get(name)?.defs ?? [])) {
|
|
73
99
|
if (definition.node.type === utils_1.AST_NODE_TYPES.TSEnumDeclaration &&
|
|
74
100
|
definition.node.range[0] < node.range[0] &&
|
|
75
101
|
definition.node.body.members.length > 0) {
|
|
@@ -77,6 +103,7 @@ exports.default = (0, util_1.createRule)({
|
|
|
77
103
|
break;
|
|
78
104
|
}
|
|
79
105
|
}
|
|
106
|
+
let scope = context.sourceCode.getScope(node);
|
|
80
107
|
while (scope) {
|
|
81
108
|
scope.set.get(name)?.defs.forEach(definition => {
|
|
82
109
|
if (definition.type === scope_manager_1.DefinitionType.ImportBinding) {
|
|
@@ -138,33 +165,16 @@ exports.default = (0, util_1.createRule)({
|
|
|
138
165
|
// Case: Multiple enum declarations in the same file
|
|
139
166
|
// enum MyEnum { A }
|
|
140
167
|
// enum MyEnum { B }
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}
|
|
144
|
-
// Case: Namespace declaration merging
|
|
168
|
+
//
|
|
169
|
+
// ...including ones merged across namespace declarations
|
|
145
170
|
// namespace MyNamespace {
|
|
146
171
|
// export enum MyEnum { A }
|
|
147
172
|
// }
|
|
148
173
|
// namespace MyNamespace {
|
|
149
174
|
// export enum MyEnum { B }
|
|
150
175
|
// }
|
|
151
|
-
if (
|
|
152
|
-
|
|
153
|
-
// https://github.com/typescript-eslint/typescript-eslint/issues/8352
|
|
154
|
-
// TODO: We don't need to dip into the TypeScript type checker here!
|
|
155
|
-
// Merged namespaces must all exist in the same file.
|
|
156
|
-
// We could instead compare this file's nodes to find the merges.
|
|
157
|
-
const tsNode = parserServices.esTreeNodeToTSNodeMap.get(node.id);
|
|
158
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
159
|
-
const declarations = typeChecker
|
|
160
|
-
.getSymbolAtLocation(tsNode)
|
|
161
|
-
.getDeclarations();
|
|
162
|
-
const [{ initializer }] = declarations[0]
|
|
163
|
-
.members;
|
|
164
|
-
return initializer &&
|
|
165
|
-
tsutils.isTypeFlagSet(typeChecker.getTypeAtLocation(initializer), ts.TypeFlags.StringLike)
|
|
166
|
-
? AllowedType.String
|
|
167
|
-
: AllowedType.Number;
|
|
176
|
+
if (previousSibling) {
|
|
177
|
+
return getMemberType(previousSibling.body.members[0]);
|
|
168
178
|
}
|
|
169
179
|
// Finally, we default to the type of the first enum member
|
|
170
180
|
return getMemberType(node.body.members[0]);
|
|
@@ -110,6 +110,24 @@ function booleanComparison(left, operator, right) {
|
|
|
110
110
|
return left >= right;
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
|
+
function isOnlyUsedForTruthiness(node) {
|
|
114
|
+
const parent = node.parent;
|
|
115
|
+
switch (parent.type) {
|
|
116
|
+
case utils_1.AST_NODE_TYPES.ConditionalExpression:
|
|
117
|
+
case utils_1.AST_NODE_TYPES.DoWhileStatement:
|
|
118
|
+
case utils_1.AST_NODE_TYPES.ForStatement:
|
|
119
|
+
case utils_1.AST_NODE_TYPES.IfStatement:
|
|
120
|
+
case utils_1.AST_NODE_TYPES.WhileStatement:
|
|
121
|
+
return parent.test === node;
|
|
122
|
+
case utils_1.AST_NODE_TYPES.LogicalExpression:
|
|
123
|
+
return ((parent.operator === '&&' && parent.left === node) ||
|
|
124
|
+
isOnlyUsedForTruthiness(parent));
|
|
125
|
+
case utils_1.AST_NODE_TYPES.UnaryExpression:
|
|
126
|
+
return parent.operator === '!';
|
|
127
|
+
default:
|
|
128
|
+
return false;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
113
131
|
const constantLoopConditionsAllowedLiterals = new Set([
|
|
114
132
|
true,
|
|
115
133
|
false,
|
|
@@ -266,15 +284,20 @@ exports.default = (0, util_1.createRule)({
|
|
|
266
284
|
if (!isNoUncheckedIndexedAccess && isArrayIndexExpression(expression)) {
|
|
267
285
|
return;
|
|
268
286
|
}
|
|
269
|
-
//
|
|
270
|
-
//
|
|
287
|
+
// Only check the right side when the logical expression is used for
|
|
288
|
+
// truthiness, as the left side has already been checked by
|
|
289
|
+
// checkLogicalExpressionForUnnecessaryConditionals.
|
|
271
290
|
//
|
|
272
|
-
// Unless the node is nullish coalescing, as it's common to use patterns like
|
|
273
|
-
//
|
|
291
|
+
// Unless the node is nullish coalescing, as it's common to use patterns like
|
|
292
|
+
// `nullBool ?? true` to perform strict boolean checks. If we inspect the right
|
|
293
|
+
// here, it'll usually be a constant condition on purpose.
|
|
274
294
|
// In this case it's better to inspect the type of the expression as a whole.
|
|
275
295
|
if (expression.type === utils_1.AST_NODE_TYPES.LogicalExpression &&
|
|
276
296
|
expression.operator !== '??') {
|
|
277
|
-
|
|
297
|
+
if (isOnlyUsedForTruthiness(expression)) {
|
|
298
|
+
checkNode(expression.right);
|
|
299
|
+
}
|
|
300
|
+
return;
|
|
278
301
|
}
|
|
279
302
|
const type = (0, util_1.getConstrainedTypeAtLocation)(services, expression);
|
|
280
303
|
if (isConditionalAlwaysNecessary(type)) {
|
|
@@ -334,8 +334,7 @@ exports.default = (0, util_1.createRule)({
|
|
|
334
334
|
(b.type === utils_1.AST_NODE_TYPES.RestElement) && optionalA === optionalB);
|
|
335
335
|
}
|
|
336
336
|
function typeParametersAreEqual(a, b) {
|
|
337
|
-
return (a.name.name === b.name.name &&
|
|
338
|
-
constraintsAreEqual(a.constraint, b.constraint));
|
|
337
|
+
return (a.name.name === b.name.name && typesAreEqual(a.constraint, b.constraint));
|
|
339
338
|
}
|
|
340
339
|
function typesAreEqual(a, b) {
|
|
341
340
|
return (a === b ||
|
|
@@ -343,9 +342,6 @@ exports.default = (0, util_1.createRule)({
|
|
|
343
342
|
b != null &&
|
|
344
343
|
context.sourceCode.getText(a) === context.sourceCode.getText(b)));
|
|
345
344
|
}
|
|
346
|
-
function constraintsAreEqual(a, b) {
|
|
347
|
-
return a === b || (a != null && a.type === b?.type);
|
|
348
|
-
}
|
|
349
345
|
/* Returns the first index where `a` and `b` differ. */
|
|
350
346
|
function getIndexOfFirstDifference(a, b, equal) {
|
|
351
347
|
for (let i = 0; i < a.length && i < b.length; i++) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@depup/typescript-eslint__eslint-plugin",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.70.0-depup.0",
|
|
4
4
|
"description": "TypeScript plugin for ESLint (with updated dependencies)",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -55,11 +55,11 @@
|
|
|
55
55
|
],
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"@eslint-community/regexpp": "^4.12.2",
|
|
58
|
-
"@typescript-eslint/scope-manager": "8.
|
|
59
|
-
"@typescript-eslint/type-utils": "8.
|
|
60
|
-
"@typescript-eslint/utils": "8.
|
|
61
|
-
"@typescript-eslint/visitor-keys": "8.
|
|
62
|
-
"ignore": "^7.0.
|
|
58
|
+
"@typescript-eslint/scope-manager": "8.70.0",
|
|
59
|
+
"@typescript-eslint/type-utils": "8.70.0",
|
|
60
|
+
"@typescript-eslint/utils": "8.70.0",
|
|
61
|
+
"@typescript-eslint/visitor-keys": "8.70.0",
|
|
62
|
+
"ignore": "^7.0.8",
|
|
63
63
|
"natural-compare": "^1.4.0",
|
|
64
64
|
"ts-api-utils": "^2.5.0"
|
|
65
65
|
},
|
|
@@ -68,8 +68,8 @@
|
|
|
68
68
|
"@types/mdast": "^4.0.4",
|
|
69
69
|
"@types/natural-compare": "^1.4.3",
|
|
70
70
|
"@types/react": "^18.3.21",
|
|
71
|
-
"@typescript-eslint/rule-schema-to-typescript-types": "8.
|
|
72
|
-
"@typescript-eslint/rule-tester": "8.
|
|
71
|
+
"@typescript-eslint/rule-schema-to-typescript-types": "8.70.0",
|
|
72
|
+
"@typescript-eslint/rule-tester": "8.70.0",
|
|
73
73
|
"@typescript/native": "npm:typescript@^7.0.2",
|
|
74
74
|
"@vitest/coverage-v8": "^4.0.18",
|
|
75
75
|
"ajv": "^6.12.6",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"vitest": "^4.0.18"
|
|
90
90
|
},
|
|
91
91
|
"peerDependencies": {
|
|
92
|
-
"@typescript-eslint/parser": "^8.
|
|
92
|
+
"@typescript-eslint/parser": "^8.70.0",
|
|
93
93
|
"eslint": "^8.57.0 || ^9.0.0 || ^10.0.0",
|
|
94
94
|
"typescript": ">=4.8.4 <6.1.0"
|
|
95
95
|
},
|
|
@@ -105,12 +105,12 @@
|
|
|
105
105
|
"targets": {
|
|
106
106
|
"generate-breaking-changes": {
|
|
107
107
|
"command": "tsx tools/generate-breaking-changes.mts",
|
|
108
|
-
"options": {
|
|
109
|
-
"cwd": "{projectRoot}"
|
|
110
|
-
},
|
|
111
108
|
"dependsOn": [
|
|
112
109
|
"type-utils:build"
|
|
113
|
-
]
|
|
110
|
+
],
|
|
111
|
+
"options": {
|
|
112
|
+
"cwd": "{projectRoot}"
|
|
113
|
+
}
|
|
114
114
|
},
|
|
115
115
|
"lint": {
|
|
116
116
|
"command": "eslint"
|
|
@@ -121,10 +121,10 @@
|
|
|
121
121
|
"dependsOn": [
|
|
122
122
|
"build"
|
|
123
123
|
],
|
|
124
|
+
"command": "pnpm pack --out attw-check.tgz && attw attw-check.tgz --profile node16 --exclude-entrypoints use-at-your-own-risk/raw-plugin --exclude-entrypoints use-at-your-own-risk/rules --ignore-rules named-exports",
|
|
124
125
|
"options": {
|
|
125
126
|
"cwd": "{projectRoot}"
|
|
126
|
-
}
|
|
127
|
-
"command": "pnpm pack --out attw-check.tgz && attw attw-check.tgz --profile node16 --exclude-entrypoints use-at-your-own-risk/raw-plugin --exclude-entrypoints use-at-your-own-risk/rules --ignore-rules named-exports"
|
|
127
|
+
}
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
},
|
|
@@ -144,13 +144,13 @@
|
|
|
144
144
|
"changes": {
|
|
145
145
|
"ignore": {
|
|
146
146
|
"from": "^7.0.5",
|
|
147
|
-
"to": "^7.0.
|
|
147
|
+
"to": "^7.0.8"
|
|
148
148
|
}
|
|
149
149
|
},
|
|
150
150
|
"depsUpdated": 1,
|
|
151
151
|
"originalPackage": "@typescript-eslint/eslint-plugin",
|
|
152
|
-
"originalVersion": "8.
|
|
153
|
-
"processedAt": "2026-
|
|
152
|
+
"originalVersion": "8.70.0",
|
|
153
|
+
"processedAt": "2026-09-08T00:33:17.890Z",
|
|
154
154
|
"smokeTest": "passed"
|
|
155
155
|
}
|
|
156
156
|
}
|