@typescript-eslint/eslint-plugin 8.71.1-alpha.11 → 8.71.1-alpha.13

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.
@@ -52,21 +52,25 @@ function includesType(parserServices, node, typeFlagIn) {
52
52
  }
53
53
  return false;
54
54
  }
55
+ const MAYBE_UNDEFINED_FLAGS = ts.TypeFlags.Any |
56
+ ts.TypeFlags.Unknown |
57
+ ts.TypeFlags.InstantiableNonPrimitive |
58
+ ts.TypeFlags.Undefined |
59
+ ts.TypeFlags.Void;
55
60
  function isValidAndLastChainOperand(ComparisonValueType, comparisonType, parserServices) {
56
- const type = parserServices.getTypeAtLocation(ComparisonValueType);
57
- const ANY_UNKNOWN_FLAGS = ts.TypeFlags.Any | ts.TypeFlags.Unknown;
61
+ const type = (0, util_1.getConstrainedTypeAtLocation)(parserServices, ComparisonValueType);
58
62
  const types = (0, ts_api_utils_1.unionConstituents)(type);
59
63
  switch (comparisonType) {
60
64
  case gatherLogicalOperands_1.ComparisonType.Equal: {
61
65
  const isNullish = types.some(t => (0, util_1.isTypeFlagSet)(t,
62
66
  // eslint-disable-next-line @typescript-eslint/no-unsafe-enum-assignment
63
- ANY_UNKNOWN_FLAGS | ts.TypeFlags.Null | ts.TypeFlags.Undefined));
67
+ MAYBE_UNDEFINED_FLAGS | ts.TypeFlags.Null));
64
68
  return !isNullish;
65
69
  }
66
70
  case gatherLogicalOperands_1.ComparisonType.StrictEqual: {
67
71
  const isUndefined = types.some(t =>
68
72
  // eslint-disable-next-line @typescript-eslint/no-unsafe-enum-assignment
69
- (0, util_1.isTypeFlagSet)(t, ANY_UNKNOWN_FLAGS | ts.TypeFlags.Undefined));
73
+ (0, util_1.isTypeFlagSet)(t, MAYBE_UNDEFINED_FLAGS));
70
74
  return !isUndefined;
71
75
  }
72
76
  case gatherLogicalOperands_1.ComparisonType.NotStrictEqual: {
@@ -78,20 +82,19 @@ function isValidAndLastChainOperand(ComparisonValueType, comparisonType, parserS
78
82
  }
79
83
  }
80
84
  function isValidOrLastChainOperand(ComparisonValueType, comparisonType, parserServices) {
81
- const type = parserServices.getTypeAtLocation(ComparisonValueType);
82
- const ANY_UNKNOWN_FLAGS = ts.TypeFlags.Any | ts.TypeFlags.Unknown;
85
+ const type = (0, util_1.getConstrainedTypeAtLocation)(parserServices, ComparisonValueType);
83
86
  const types = (0, ts_api_utils_1.unionConstituents)(type);
84
87
  switch (comparisonType) {
85
88
  case gatherLogicalOperands_1.ComparisonType.NotEqual: {
86
89
  const isNullish = types.some(t => (0, util_1.isTypeFlagSet)(t,
87
90
  // eslint-disable-next-line @typescript-eslint/no-unsafe-enum-assignment
88
- ANY_UNKNOWN_FLAGS | ts.TypeFlags.Null | ts.TypeFlags.Undefined));
91
+ MAYBE_UNDEFINED_FLAGS | ts.TypeFlags.Null));
89
92
  return !isNullish;
90
93
  }
91
94
  case gatherLogicalOperands_1.ComparisonType.NotStrictEqual: {
92
95
  const isUndefined = types.some(t =>
93
96
  // eslint-disable-next-line @typescript-eslint/no-unsafe-enum-assignment
94
- (0, util_1.isTypeFlagSet)(t, ANY_UNKNOWN_FLAGS | ts.TypeFlags.Undefined));
97
+ (0, util_1.isTypeFlagSet)(t, MAYBE_UNDEFINED_FLAGS));
95
98
  return !isUndefined;
96
99
  }
97
100
  case gatherLogicalOperands_1.ComparisonType.Equal:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typescript-eslint/eslint-plugin",
3
- "version": "8.71.1-alpha.11",
3
+ "version": "8.71.1-alpha.13",
4
4
  "description": "TypeScript plugin for ESLint",
5
5
  "files": [
6
6
  "dist",
@@ -47,10 +47,10 @@
47
47
  ],
48
48
  "dependencies": {
49
49
  "@eslint-community/regexpp": "^4.12.2",
50
- "@typescript-eslint/scope-manager": "8.71.1-alpha.11",
51
- "@typescript-eslint/type-utils": "8.71.1-alpha.11",
52
- "@typescript-eslint/utils": "8.71.1-alpha.11",
53
- "@typescript-eslint/visitor-keys": "8.71.1-alpha.11",
50
+ "@typescript-eslint/scope-manager": "8.71.1-alpha.13",
51
+ "@typescript-eslint/type-utils": "8.71.1-alpha.13",
52
+ "@typescript-eslint/utils": "8.71.1-alpha.13",
53
+ "@typescript-eslint/visitor-keys": "8.71.1-alpha.13",
54
54
  "ignore": "^7.0.5",
55
55
  "natural-compare": "^1.4.0",
56
56
  "ts-api-utils": "^2.5.0"
@@ -60,8 +60,8 @@
60
60
  "@types/mdast": "^4.0.4",
61
61
  "@types/natural-compare": "^1.4.3",
62
62
  "@types/react": "^18.3.21",
63
- "@typescript-eslint/rule-schema-to-typescript-types": "8.71.1-alpha.11",
64
- "@typescript-eslint/rule-tester": "8.71.1-alpha.11",
63
+ "@typescript-eslint/rule-schema-to-typescript-types": "8.71.1-alpha.13",
64
+ "@typescript-eslint/rule-tester": "8.71.1-alpha.13",
65
65
  "@typescript/native": "npm:typescript@^7.0.2",
66
66
  "@vitest/coverage-v8": "^4.0.18",
67
67
  "ajv": "^6.12.6",
@@ -81,7 +81,7 @@
81
81
  "vitest": "^4.0.18"
82
82
  },
83
83
  "peerDependencies": {
84
- "@typescript-eslint/parser": "^8.71.1-alpha.11",
84
+ "@typescript-eslint/parser": "^8.71.1-alpha.13",
85
85
  "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0",
86
86
  "typescript": ">=4.8.4 <6.1.0"
87
87
  },