@typescript-eslint/eslint-plugin 8.42.1-alpha.12 → 8.42.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.
@@ -184,7 +184,7 @@ exports.default = (0, util_1.createRule)({
184
184
  : isReadonlyArrayType && node.typeName.name !== 'ReadonlyArray'
185
185
  ? 'errorStringArraySimpleReadonly'
186
186
  : 'errorStringArraySimple';
187
- if (!typeParams || typeParams.length === 0) {
187
+ if (!typeParams) {
188
188
  // Create an 'any' array
189
189
  context.report({
190
190
  node,
@@ -1 +1 @@
1
- {"version":3,"file":"no-deprecated.d.ts","sourceRoot":"","sources":["../../src/rules/no-deprecated.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAiBpD,KAAK,UAAU,GAAG,YAAY,GAAG,sBAAsB,CAAC;AAExD,KAAK,OAAO,GAAG;IACb;QACE,KAAK,CAAC,EAAE,oBAAoB,EAAE,CAAC;KAChC;CACF,CAAC;;AAEF,wBAsaG"}
1
+ {"version":3,"file":"no-deprecated.d.ts","sourceRoot":"","sources":["../../src/rules/no-deprecated.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAiBpD,KAAK,UAAU,GAAG,YAAY,GAAG,sBAAsB,CAAC;AAExD,KAAK,OAAO,GAAG;IACb;QACE,KAAK,CAAC,EAAE,oBAAoB,EAAE,CAAC;KAChC;CACF,CAAC;;AAEF,wBAicG"}
@@ -153,15 +153,15 @@ exports.default = (0, util_1.createRule)({
153
153
  return false;
154
154
  }
155
155
  }
156
- function isInsideExportOrImport(node) {
156
+ function isInsideImport(node) {
157
157
  let current = node;
158
158
  while (true) {
159
159
  switch (current.type) {
160
- case utils_1.AST_NODE_TYPES.ExportAllDeclaration:
161
- case utils_1.AST_NODE_TYPES.ExportNamedDeclaration:
162
160
  case utils_1.AST_NODE_TYPES.ImportDeclaration:
163
161
  return true;
164
162
  case utils_1.AST_NODE_TYPES.ArrowFunctionExpression:
163
+ case utils_1.AST_NODE_TYPES.ExportAllDeclaration:
164
+ case utils_1.AST_NODE_TYPES.ExportNamedDeclaration:
165
165
  case utils_1.AST_NODE_TYPES.BlockStatement:
166
166
  case utils_1.AST_NODE_TYPES.ClassDeclaration:
167
167
  case utils_1.AST_NODE_TYPES.TSInterfaceDeclaration:
@@ -293,7 +293,7 @@ exports.default = (0, util_1.createRule)({
293
293
  return searchForDeprecationInAliasesChain(services.getSymbolAtLocation(node), true);
294
294
  }
295
295
  function checkIdentifier(node) {
296
- if (isDeclaration(node) || isInsideExportOrImport(node)) {
296
+ if (isDeclaration(node) || isInsideImport(node)) {
297
297
  return;
298
298
  }
299
299
  const reason = getDeprecationReason(node);
@@ -352,7 +352,26 @@ exports.default = (0, util_1.createRule)({
352
352
  }
353
353
  }
354
354
  return {
355
- Identifier: checkIdentifier,
355
+ Identifier(node) {
356
+ const { parent } = node;
357
+ if (parent.type === utils_1.AST_NODE_TYPES.ExportNamedDeclaration ||
358
+ parent.type === utils_1.AST_NODE_TYPES.ExportAllDeclaration) {
359
+ return;
360
+ }
361
+ if (parent.type === utils_1.AST_NODE_TYPES.ExportSpecifier) {
362
+ // only deal with the alias (exported) side, not the local binding
363
+ if (parent.exported !== node) {
364
+ return;
365
+ }
366
+ const symbol = services.getSymbolAtLocation(node);
367
+ const aliasDeprecation = getJsDocDeprecation(symbol);
368
+ if (aliasDeprecation != null) {
369
+ return;
370
+ }
371
+ }
372
+ // whether it's a plain identifier or the exported alias
373
+ checkIdentifier(node);
374
+ },
356
375
  JSXIdentifier(node) {
357
376
  if (node.parent.type !== utils_1.AST_NODE_TYPES.JSXClosingElement) {
358
377
  checkIdentifier(node);
@@ -1 +1 @@
1
- {"version":3,"file":"prefer-return-this-type.d.ts","sourceRoot":"","sources":["../../src/rules/prefer-return-this-type.ts"],"names":[],"mappings":";AAeA,wBA8JG"}
1
+ {"version":3,"file":"prefer-return-this-type.d.ts","sourceRoot":"","sources":["../../src/rules/prefer-return-this-type.ts"],"names":[],"mappings":";AAgBA,wBAsKG"}
@@ -34,6 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  const utils_1 = require("@typescript-eslint/utils");
37
+ const ts_api_utils_1 = require("ts-api-utils");
37
38
  const ts = __importStar(require("typescript"));
38
39
  const util_1 = require("../util");
39
40
  exports.default = (0, util_1.createRule)({
@@ -109,6 +110,11 @@ exports.default = (0, util_1.createRule)({
109
110
  hasReturnThis = true;
110
111
  return;
111
112
  }
113
+ if ((0, ts_api_utils_1.isUnionType)(type) &&
114
+ type.types.some(typePart => typePart === classType)) {
115
+ hasReturnClassType = true;
116
+ return true;
117
+ }
112
118
  return;
113
119
  });
114
120
  return !hasReturnClassType && hasReturnThis;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typescript-eslint/eslint-plugin",
3
- "version": "8.42.1-alpha.12",
3
+ "version": "8.42.1-alpha.13",
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.42.1-alpha.12",
63
- "@typescript-eslint/type-utils": "8.42.1-alpha.12",
64
- "@typescript-eslint/utils": "8.42.1-alpha.12",
65
- "@typescript-eslint/visitor-keys": "8.42.1-alpha.12",
62
+ "@typescript-eslint/scope-manager": "8.42.1-alpha.13",
63
+ "@typescript-eslint/type-utils": "8.42.1-alpha.13",
64
+ "@typescript-eslint/utils": "8.42.1-alpha.13",
65
+ "@typescript-eslint/visitor-keys": "8.42.1-alpha.13",
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.42.1-alpha.12",
75
- "@typescript-eslint/rule-tester": "8.42.1-alpha.12",
74
+ "@typescript-eslint/rule-schema-to-typescript-types": "8.42.1-alpha.13",
75
+ "@typescript-eslint/rule-tester": "8.42.1-alpha.13",
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.42.1-alpha.12",
95
+ "@typescript-eslint/parser": "^8.42.1-alpha.13",
96
96
  "eslint": "^8.57.0 || ^9.0.0",
97
97
  "typescript": ">=4.8.4 <6.0.0"
98
98
  },