@typescript-eslint/eslint-plugin 8.46.1 → 8.46.2-alpha.1
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.
|
@@ -51,28 +51,6 @@ function includesType(parserServices, node, typeFlagIn) {
|
|
|
51
51
|
}
|
|
52
52
|
return false;
|
|
53
53
|
}
|
|
54
|
-
function isAlwaysTruthyOperand(comparedName, nullishComparisonType, parserServices) {
|
|
55
|
-
const ANY_UNKNOWN_FLAGS = ts.TypeFlags.Any | ts.TypeFlags.Unknown;
|
|
56
|
-
const comparedNameType = parserServices.getTypeAtLocation(comparedName);
|
|
57
|
-
if ((0, util_1.isTypeFlagSet)(comparedNameType, ANY_UNKNOWN_FLAGS)) {
|
|
58
|
-
return false;
|
|
59
|
-
}
|
|
60
|
-
switch (nullishComparisonType) {
|
|
61
|
-
case gatherLogicalOperands_1.NullishComparisonType.Boolean:
|
|
62
|
-
case gatherLogicalOperands_1.NullishComparisonType.NotBoolean: {
|
|
63
|
-
const types = (0, ts_api_utils_1.unionConstituents)(comparedNameType);
|
|
64
|
-
return types.every(type => !(0, ts_api_utils_1.isFalsyType)(type));
|
|
65
|
-
}
|
|
66
|
-
case gatherLogicalOperands_1.NullishComparisonType.NotStrictEqualUndefined:
|
|
67
|
-
case gatherLogicalOperands_1.NullishComparisonType.NotStrictEqualNull:
|
|
68
|
-
case gatherLogicalOperands_1.NullishComparisonType.StrictEqualNull:
|
|
69
|
-
case gatherLogicalOperands_1.NullishComparisonType.StrictEqualUndefined:
|
|
70
|
-
return !(0, util_1.isTypeFlagSet)(comparedNameType, ts.TypeFlags.Null | ts.TypeFlags.Undefined);
|
|
71
|
-
case gatherLogicalOperands_1.NullishComparisonType.NotEqualNullOrUndefined:
|
|
72
|
-
case gatherLogicalOperands_1.NullishComparisonType.EqualNullOrUndefined:
|
|
73
|
-
return !(0, util_1.isTypeFlagSet)(comparedNameType, ts.TypeFlags.Null | ts.TypeFlags.Undefined);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
54
|
function isValidAndLastChainOperand(ComparisonValueType, comparisonType, parserServices) {
|
|
77
55
|
const type = parserServices.getTypeAtLocation(ComparisonValueType);
|
|
78
56
|
const ANY_UNKNOWN_FLAGS = ts.TypeFlags.Any | ts.TypeFlags.Unknown;
|
|
@@ -505,14 +483,6 @@ function analyzeChain(context, parserServices, options, node, operator, chain, l
|
|
|
505
483
|
}
|
|
506
484
|
break;
|
|
507
485
|
}
|
|
508
|
-
case gatherLogicalOperands_1.NullishComparisonType.StrictEqualNull:
|
|
509
|
-
case gatherLogicalOperands_1.NullishComparisonType.NotStrictEqualNull: {
|
|
510
|
-
if (comparisonResult === compareNodes_1.NodeComparisonResult.Subset &&
|
|
511
|
-
isAlwaysTruthyOperand(lastOperand.comparedName, lastOperand.comparisonType, parserServices)) {
|
|
512
|
-
lastChain = operand;
|
|
513
|
-
}
|
|
514
|
-
break;
|
|
515
|
-
}
|
|
516
486
|
}
|
|
517
487
|
}
|
|
518
488
|
maybeReportThenReset();
|
|
@@ -551,8 +521,7 @@ function analyzeChain(context, parserServices, options, node, operator, chain, l
|
|
|
551
521
|
? isValidAndLastChainOperand
|
|
552
522
|
: isValidOrLastChainOperand;
|
|
553
523
|
if (comparisonResult === compareNodes_1.NodeComparisonResult.Subset &&
|
|
554
|
-
(
|
|
555
|
-
isValidLastChainOperand(lastChainOperand.comparisonValue, lastChainOperand.comparisonType, parserServices))) {
|
|
524
|
+
isValidLastChainOperand(lastChainOperand.comparisonValue, lastChainOperand.comparisonType, parserServices)) {
|
|
556
525
|
lastChain = lastChainOperand;
|
|
557
526
|
}
|
|
558
527
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@typescript-eslint/eslint-plugin",
|
|
3
|
-
"version": "8.46.1",
|
|
3
|
+
"version": "8.46.2-alpha.1",
|
|
4
4
|
"description": "TypeScript plugin for ESLint",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -59,10 +59,10 @@
|
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"@eslint-community/regexpp": "^4.10.0",
|
|
62
|
-
"@typescript-eslint/scope-manager": "8.46.1",
|
|
63
|
-
"@typescript-eslint/type-utils": "8.46.1",
|
|
64
|
-
"@typescript-eslint/utils": "8.46.1",
|
|
65
|
-
"@typescript-eslint/visitor-keys": "8.46.1",
|
|
62
|
+
"@typescript-eslint/scope-manager": "8.46.2-alpha.1",
|
|
63
|
+
"@typescript-eslint/type-utils": "8.46.2-alpha.1",
|
|
64
|
+
"@typescript-eslint/utils": "8.46.2-alpha.1",
|
|
65
|
+
"@typescript-eslint/visitor-keys": "8.46.2-alpha.1",
|
|
66
66
|
"graphemer": "^1.4.0",
|
|
67
67
|
"ignore": "^7.0.0",
|
|
68
68
|
"natural-compare": "^1.4.0",
|
|
@@ -71,8 +71,8 @@
|
|
|
71
71
|
"devDependencies": {
|
|
72
72
|
"@types/mdast": "^4.0.3",
|
|
73
73
|
"@types/natural-compare": "*",
|
|
74
|
-
"@typescript-eslint/rule-schema-to-typescript-types": "8.46.1",
|
|
75
|
-
"@typescript-eslint/rule-tester": "8.46.1",
|
|
74
|
+
"@typescript-eslint/rule-schema-to-typescript-types": "8.46.2-alpha.1",
|
|
75
|
+
"@typescript-eslint/rule-tester": "8.46.2-alpha.1",
|
|
76
76
|
"@vitest/coverage-v8": "^3.1.3",
|
|
77
77
|
"ajv": "^6.12.6",
|
|
78
78
|
"cross-fetch": "*",
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"vitest": "^3.1.3"
|
|
93
93
|
},
|
|
94
94
|
"peerDependencies": {
|
|
95
|
-
"@typescript-eslint/parser": "^8.46.1",
|
|
95
|
+
"@typescript-eslint/parser": "^8.46.2-alpha.1",
|
|
96
96
|
"eslint": "^8.57.0 || ^9.0.0",
|
|
97
97
|
"typescript": ">=4.8.4 <6.0.0"
|
|
98
98
|
},
|