@depup/typescript-eslint__eslint-plugin 8.69.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 +2 -2
- package/changes.json +1 -1
- 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 +7 -0
- package/dist/raw-plugin.d.ts +7 -0
- package/dist/rules/index.d.ts +3 -0
- 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-unnecessary-condition.js +28 -5
- package/package.json +16 -16
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-09-
|
|
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
|
|
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
|
};
|
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
|
};
|
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
|
};
|
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
|
|
@@ -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)) {
|
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,10 +55,10 @@
|
|
|
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.
|
|
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
62
|
"ignore": "^7.0.8",
|
|
63
63
|
"natural-compare": "^1.4.0",
|
|
64
64
|
"ts-api-utils": "^2.5.0"
|
|
@@ -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
|
},
|
|
@@ -149,8 +149,8 @@
|
|
|
149
149
|
},
|
|
150
150
|
"depsUpdated": 1,
|
|
151
151
|
"originalPackage": "@typescript-eslint/eslint-plugin",
|
|
152
|
-
"originalVersion": "8.
|
|
153
|
-
"processedAt": "2026-09-
|
|
152
|
+
"originalVersion": "8.70.0",
|
|
153
|
+
"processedAt": "2026-09-08T00:33:17.890Z",
|
|
154
154
|
"smokeTest": "passed"
|
|
155
155
|
}
|
|
156
156
|
}
|