@typescript-eslint/eslint-plugin 8.48.1-alpha.3 → 8.48.1-alpha.5

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.
@@ -80,16 +80,18 @@ exports.default = (0, util_1.createRule)({
80
80
  * can't be resolved.
81
81
  */
82
82
  function isSymbolTypeBased(symbol) {
83
- while (symbol && symbol.flags & ts.SymbolFlags.Alias) {
84
- symbol = checker.getAliasedSymbol(symbol);
85
- if (symbol.getDeclarations()?.find(ts.isTypeOnlyImportOrExportDeclaration)) {
86
- return true;
87
- }
88
- }
89
83
  if (!symbol || checker.isUnknownSymbol(symbol)) {
90
84
  return undefined;
91
85
  }
92
- return !(symbol.flags & ts.SymbolFlags.Value);
86
+ if (symbol.getDeclarations()?.some(ts.isTypeOnlyImportOrExportDeclaration)) {
87
+ return true;
88
+ }
89
+ if (symbol.flags & ts.SymbolFlags.Value) {
90
+ return false;
91
+ }
92
+ return symbol.flags & ts.SymbolFlags.Alias
93
+ ? isSymbolTypeBased(checker.getImmediateAliasedSymbol(symbol))
94
+ : true;
93
95
  }
94
96
  return {
95
97
  ExportAllDeclaration(node) {
@@ -171,21 +171,26 @@ exports.default = (0, util_1.createRule)({
171
171
  }
172
172
  return Usefulness.Always;
173
173
  }
174
- function hasBaseTypes(type) {
175
- return (tsutils.isObjectType(type) &&
176
- tsutils.isObjectFlagSet(type, ts.ObjectFlags.Interface | ts.ObjectFlags.Class));
174
+ function getBaseTypesForType(type) {
175
+ if (!tsutils.isObjectType(type)) {
176
+ return [];
177
+ }
178
+ const interfaceTarget = tsutils.isTypeReference(type)
179
+ ? type.target
180
+ : type;
181
+ const interfaceType = tsutils.isObjectFlagSet(interfaceTarget, ts.ObjectFlags.Interface | ts.ObjectFlags.Class) && interfaceTarget;
182
+ if (!interfaceType) {
183
+ return [];
184
+ }
185
+ return checker.getBaseTypes(interfaceType);
177
186
  }
178
187
  function isIgnoredTypeOrBase(type, seen = new Set()) {
179
188
  if (seen.has(type)) {
180
189
  return false;
181
190
  }
182
191
  seen.add(type);
183
- const typeName = (0, util_1.getTypeName)(checker, type);
184
- return (ignoredTypeNames.includes(typeName) ||
185
- (hasBaseTypes(type) &&
186
- checker
187
- .getBaseTypes(type)
188
- .some(base => isIgnoredTypeOrBase(base, seen))));
192
+ return (ignoredTypeNames.includes((0, util_1.getTypeName)(checker, type)) ||
193
+ getBaseTypesForType(type).some(base => isIgnoredTypeOrBase(base, seen)));
189
194
  }
190
195
  function collectToStringCertainty(type, visited) {
191
196
  if (visited.has(type)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typescript-eslint/eslint-plugin",
3
- "version": "8.48.1-alpha.3",
3
+ "version": "8.48.1-alpha.5",
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.48.1-alpha.3",
63
- "@typescript-eslint/type-utils": "8.48.1-alpha.3",
64
- "@typescript-eslint/utils": "8.48.1-alpha.3",
65
- "@typescript-eslint/visitor-keys": "8.48.1-alpha.3",
62
+ "@typescript-eslint/scope-manager": "8.48.1-alpha.5",
63
+ "@typescript-eslint/type-utils": "8.48.1-alpha.5",
64
+ "@typescript-eslint/utils": "8.48.1-alpha.5",
65
+ "@typescript-eslint/visitor-keys": "8.48.1-alpha.5",
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.48.1-alpha.3",
75
- "@typescript-eslint/rule-tester": "8.48.1-alpha.3",
74
+ "@typescript-eslint/rule-schema-to-typescript-types": "8.48.1-alpha.5",
75
+ "@typescript-eslint/rule-tester": "8.48.1-alpha.5",
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.48.1-alpha.3",
95
+ "@typescript-eslint/parser": "^8.48.1-alpha.5",
96
96
  "eslint": "^8.57.0 || ^9.0.0",
97
97
  "typescript": ">=4.8.4 <6.0.0"
98
98
  },