@typescript-eslint/typescript-estree 8.51.1-alpha.1 → 8.51.1-alpha.11

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.
@@ -53,7 +53,7 @@ function astConverter(ast, parseSettings, shouldPreserveNodeMaps) {
53
53
  * Optionally convert and include all comments in the AST
54
54
  */
55
55
  if (parseSettings.comment) {
56
- estree.comments = (0, convert_comments_1.convertComments)(ast, parseSettings.codeFullText);
56
+ estree.comments = (0, convert_comments_1.convertComments)(ast);
57
57
  }
58
58
  const astMaps = instance.getASTMaps();
59
59
  return { astMaps, estree };
@@ -0,0 +1,2 @@
1
+ import * as ts from 'typescript';
2
+ export declare function checkSyntaxError(tsNode: ts.Node): void;
@@ -0,0 +1,303 @@
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
+ exports.checkSyntaxError = checkSyntaxError;
37
+ const ts = __importStar(require("typescript"));
38
+ const check_modifiers_1 = require("./check-modifiers");
39
+ const node_utils_1 = require("./node-utils");
40
+ const SyntaxKind = ts.SyntaxKind;
41
+ function checkSyntaxError(tsNode) {
42
+ (0, check_modifiers_1.checkModifiers)(tsNode);
43
+ const node = tsNode;
44
+ switch (node.kind) {
45
+ case SyntaxKind.SwitchStatement:
46
+ if (node.caseBlock.clauses.filter(switchCase => switchCase.kind === SyntaxKind.DefaultClause).length > 1) {
47
+ throw (0, node_utils_1.createError)(node, "A 'default' clause cannot appear more than once in a 'switch' statement.");
48
+ }
49
+ break;
50
+ case SyntaxKind.ThrowStatement:
51
+ if (node.expression.end === node.expression.pos) {
52
+ throw (0, node_utils_1.createError)(node, 'A throw statement must throw an expression.');
53
+ }
54
+ break;
55
+ case SyntaxKind.CatchClause:
56
+ if (node.variableDeclaration?.initializer) {
57
+ throw (0, node_utils_1.createError)(node.variableDeclaration.initializer, 'Catch clause variable cannot have an initializer.');
58
+ }
59
+ break;
60
+ case SyntaxKind.FunctionDeclaration: {
61
+ const isDeclare = (0, node_utils_1.hasModifier)(SyntaxKind.DeclareKeyword, node);
62
+ const isAsync = (0, node_utils_1.hasModifier)(SyntaxKind.AsyncKeyword, node);
63
+ const isGenerator = !!node.asteriskToken;
64
+ if (isDeclare) {
65
+ if (node.body) {
66
+ throw (0, node_utils_1.createError)(node, 'An implementation cannot be declared in ambient contexts.');
67
+ }
68
+ else if (isAsync) {
69
+ throw (0, node_utils_1.createError)(node, "'async' modifier cannot be used in an ambient context.");
70
+ }
71
+ else if (isGenerator) {
72
+ throw (0, node_utils_1.createError)(node, 'Generators are not allowed in an ambient context.');
73
+ }
74
+ }
75
+ else if (!node.body && isGenerator) {
76
+ throw (0, node_utils_1.createError)(node, 'A function signature cannot be declared as a generator.');
77
+ }
78
+ break;
79
+ }
80
+ case SyntaxKind.VariableDeclaration: {
81
+ const hasExclamationToken = !!node.exclamationToken;
82
+ if (hasExclamationToken) {
83
+ if (node.initializer) {
84
+ throw (0, node_utils_1.createError)(node, 'Declarations with initializers cannot also have definite assignment assertions.');
85
+ }
86
+ else if (node.name.kind !== SyntaxKind.Identifier || !node.type) {
87
+ throw (0, node_utils_1.createError)(node, 'Declarations with definite assignment assertions must also have type annotations.');
88
+ }
89
+ }
90
+ if (node.parent.kind === SyntaxKind.VariableDeclarationList) {
91
+ const variableDeclarationList = node.parent;
92
+ const kind = (0, node_utils_1.getDeclarationKind)(variableDeclarationList);
93
+ if ((variableDeclarationList.parent.kind === SyntaxKind.ForInStatement ||
94
+ variableDeclarationList.parent.kind === SyntaxKind.ForStatement) &&
95
+ (kind === 'using' || kind === 'await using')) {
96
+ if (!node.initializer) {
97
+ throw (0, node_utils_1.createError)(node, `'${kind}' declarations may not be initialized in for statement.`);
98
+ }
99
+ if (node.name.kind !== SyntaxKind.Identifier) {
100
+ throw (0, node_utils_1.createError)(node.name, `'${kind}' declarations may not have binding patterns.`);
101
+ }
102
+ }
103
+ if (variableDeclarationList.parent.kind === SyntaxKind.VariableStatement) {
104
+ const variableStatement = variableDeclarationList.parent;
105
+ if (kind === 'using' || kind === 'await using') {
106
+ if (!node.initializer) {
107
+ throw (0, node_utils_1.createError)(node, `'${kind}' declarations must be initialized.`);
108
+ }
109
+ if (node.name.kind !== SyntaxKind.Identifier) {
110
+ throw (0, node_utils_1.createError)(node.name, `'${kind}' declarations may not have binding patterns.`);
111
+ }
112
+ }
113
+ const hasDeclareKeyword = (0, node_utils_1.hasModifier)(SyntaxKind.DeclareKeyword, variableStatement);
114
+ // Definite assignment only allowed for non-declare let and var
115
+ if ((hasDeclareKeyword ||
116
+ ['await using', 'const', 'using'].includes(kind)) &&
117
+ hasExclamationToken) {
118
+ throw (0, node_utils_1.createError)(node, `A definite assignment assertion '!' is not permitted in this context.`);
119
+ }
120
+ if (hasDeclareKeyword &&
121
+ node.initializer &&
122
+ (['let', 'var'].includes(kind) || node.type)) {
123
+ throw (0, node_utils_1.createError)(node, `Initializers are not permitted in ambient contexts.`);
124
+ }
125
+ // Theoretically, only certain initializers are allowed for declare const,
126
+ // (TS1254: A 'const' initializer in an ambient context must be a string
127
+ // or numeric literal or literal enum reference.) but we just allow
128
+ // all expressions
129
+ // Note! No-declare does not mean the variable is not ambient, because
130
+ // it can be further nested in other declare contexts. Therefore we cannot
131
+ // check for const initializers.
132
+ }
133
+ }
134
+ break;
135
+ }
136
+ case SyntaxKind.VariableStatement: {
137
+ const declarations = node.declarationList.declarations;
138
+ if (!declarations.length) {
139
+ throw (0, node_utils_1.createError)(node, 'A variable declaration list must have at least one variable declarator.');
140
+ }
141
+ break;
142
+ }
143
+ case SyntaxKind.PropertyAssignment: {
144
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
145
+ const { exclamationToken, questionToken } = node;
146
+ if (questionToken) {
147
+ throw (0, node_utils_1.createError)(questionToken, 'A property assignment cannot have a question token.');
148
+ }
149
+ if (exclamationToken) {
150
+ throw (0, node_utils_1.createError)(exclamationToken, 'A property assignment cannot have an exclamation token.');
151
+ }
152
+ break;
153
+ }
154
+ case SyntaxKind.ShorthandPropertyAssignment: {
155
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
156
+ const { exclamationToken, modifiers, questionToken } = node;
157
+ if (modifiers) {
158
+ throw (0, node_utils_1.createError)(modifiers[0], 'A shorthand property assignment cannot have modifiers.');
159
+ }
160
+ if (questionToken) {
161
+ throw (0, node_utils_1.createError)(questionToken, 'A shorthand property assignment cannot have a question token.');
162
+ }
163
+ if (exclamationToken) {
164
+ throw (0, node_utils_1.createError)(exclamationToken, 'A shorthand property assignment cannot have an exclamation token.');
165
+ }
166
+ break;
167
+ }
168
+ case SyntaxKind.PropertyDeclaration: {
169
+ const isAbstract = (0, node_utils_1.hasModifier)(SyntaxKind.AbstractKeyword, node);
170
+ if (isAbstract && node.initializer) {
171
+ throw (0, node_utils_1.createError)(node.initializer, `Abstract property cannot have an initializer.`);
172
+ }
173
+ if (node.name.kind === SyntaxKind.StringLiteral &&
174
+ node.name.text === 'constructor') {
175
+ throw (0, node_utils_1.createError)(node.name, "Classes may not have a field named 'constructor'.");
176
+ }
177
+ break;
178
+ }
179
+ case SyntaxKind.TaggedTemplateExpression:
180
+ if (node.tag.flags & ts.NodeFlags.OptionalChain) {
181
+ throw (0, node_utils_1.createError)(node, 'Tagged template expressions are not permitted in an optional chain.');
182
+ }
183
+ break;
184
+ case SyntaxKind.ClassDeclaration:
185
+ if (!node.name &&
186
+ (!(0, node_utils_1.hasModifier)(ts.SyntaxKind.ExportKeyword, node) ||
187
+ !(0, node_utils_1.hasModifier)(ts.SyntaxKind.DefaultKeyword, node))) {
188
+ throw (0, node_utils_1.createError)(node, "A class declaration without the 'default' modifier must have a name.");
189
+ }
190
+ break;
191
+ case SyntaxKind.BinaryExpression:
192
+ if (node.operatorToken.kind !== SyntaxKind.InKeyword &&
193
+ node.left.kind === SyntaxKind.PrivateIdentifier) {
194
+ throw (0, node_utils_1.createError)(node.left, "Private identifiers cannot appear on the right-hand-side of an 'in' expression.");
195
+ }
196
+ else if (node.right.kind === SyntaxKind.PrivateIdentifier) {
197
+ throw (0, node_utils_1.createError)(node.right, "Private identifiers are only allowed on the left-hand-side of an 'in' expression.");
198
+ }
199
+ break;
200
+ case SyntaxKind.MappedType:
201
+ if (node.members && node.members.length > 0) {
202
+ throw (0, node_utils_1.createError)(node.members[0], 'A mapped type may not declare properties or methods.');
203
+ }
204
+ break;
205
+ case SyntaxKind.PropertySignature: {
206
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
207
+ const { initializer } = node;
208
+ if (initializer) {
209
+ throw (0, node_utils_1.createError)(initializer, 'A property signature cannot have an initializer.');
210
+ }
211
+ break;
212
+ }
213
+ case SyntaxKind.FunctionType: {
214
+ // eslint-disable-next-line @typescript-eslint/no-deprecated
215
+ const { modifiers } = node;
216
+ if (modifiers) {
217
+ throw (0, node_utils_1.createError)(modifiers[0], 'A function type cannot have modifiers.');
218
+ }
219
+ break;
220
+ }
221
+ case SyntaxKind.EnumMember: {
222
+ const computed = node.name.kind === ts.SyntaxKind.ComputedPropertyName;
223
+ if (computed) {
224
+ throw (0, node_utils_1.createError)(node.name, 'Computed property names are not allowed in enums.');
225
+ }
226
+ if (node.name.kind === SyntaxKind.NumericLiteral ||
227
+ node.name.kind === SyntaxKind.BigIntLiteral) {
228
+ throw (0, node_utils_1.createError)(node.name, 'An enum member cannot have a numeric name.');
229
+ }
230
+ break;
231
+ }
232
+ case SyntaxKind.ExternalModuleReference:
233
+ if (node.expression.kind !== SyntaxKind.StringLiteral) {
234
+ throw (0, node_utils_1.createError)(node.expression, 'String literal expected.');
235
+ }
236
+ break;
237
+ case SyntaxKind.PrefixUnaryExpression:
238
+ case SyntaxKind.PostfixUnaryExpression: {
239
+ const operator = (0, node_utils_1.getTextForTokenKind)(node.operator);
240
+ /**
241
+ * ESTree uses UpdateExpression for ++/--
242
+ */
243
+ if ((operator === '++' || operator === '--') &&
244
+ !(0, node_utils_1.isValidAssignmentTarget)(node.operand)) {
245
+ throw (0, node_utils_1.createError)(node.operand, 'Invalid left-hand side expression in unary operation');
246
+ }
247
+ break;
248
+ }
249
+ case SyntaxKind.ImportDeclaration:
250
+ assertModuleSpecifier(node, false);
251
+ break;
252
+ case SyntaxKind.ExportDeclaration:
253
+ assertModuleSpecifier(node, node.exportClause?.kind === SyntaxKind.NamedExports);
254
+ break;
255
+ case SyntaxKind.CallExpression:
256
+ if (node.expression.kind === SyntaxKind.ImportKeyword &&
257
+ node.arguments.length !== 1 &&
258
+ node.arguments.length !== 2) {
259
+ throw (0, node_utils_1.createError)(node.arguments.length > 1 ? node.arguments[2] : node, 'Dynamic import requires exactly one or two arguments.');
260
+ }
261
+ break;
262
+ case SyntaxKind.ForInStatement:
263
+ case SyntaxKind.ForOfStatement: {
264
+ checkForStatementDeclaration(node);
265
+ break;
266
+ }
267
+ // No default
268
+ }
269
+ }
270
+ function checkForStatementDeclaration(node) {
271
+ const { initializer, kind } = node;
272
+ const loop = kind === SyntaxKind.ForInStatement ? 'for...in' : 'for...of';
273
+ if (ts.isVariableDeclarationList(initializer)) {
274
+ if (initializer.declarations.length !== 1) {
275
+ throw (0, node_utils_1.createError)(initializer, `Only a single variable declaration is allowed in a '${loop}' statement.`);
276
+ }
277
+ const declaration = initializer.declarations[0];
278
+ if (declaration.initializer) {
279
+ throw (0, node_utils_1.createError)(declaration, `The variable declaration of a '${loop}' statement cannot have an initializer.`);
280
+ }
281
+ else if (declaration.type) {
282
+ throw (0, node_utils_1.createError)(declaration, `The variable declaration of a '${loop}' statement cannot have a type annotation.`);
283
+ }
284
+ if (kind === SyntaxKind.ForInStatement &&
285
+ initializer.flags & ts.NodeFlags.Using) {
286
+ throw (0, node_utils_1.createError)(initializer, "The left-hand side of a 'for...in' statement cannot be a 'using' declaration.");
287
+ }
288
+ }
289
+ else if (!(0, node_utils_1.isValidAssignmentTarget)(initializer) &&
290
+ initializer.kind !== SyntaxKind.ObjectLiteralExpression &&
291
+ initializer.kind !== SyntaxKind.ArrayLiteralExpression) {
292
+ throw (0, node_utils_1.createError)(initializer, `The left-hand side of a '${loop}' statement must be a variable or a property access.`);
293
+ }
294
+ }
295
+ function assertModuleSpecifier(node, allowNull) {
296
+ if (!allowNull && node.moduleSpecifier == null) {
297
+ throw (0, node_utils_1.createError)(node, 'Module specifier must be a string literal.');
298
+ }
299
+ if (node.moduleSpecifier &&
300
+ node.moduleSpecifier.kind !== SyntaxKind.StringLiteral) {
301
+ throw (0, node_utils_1.createError)(node.moduleSpecifier, 'Module specifier must be a string literal.');
302
+ }
303
+ }
@@ -3,8 +3,7 @@ import type { TSESTree } from './ts-estree';
3
3
  /**
4
4
  * Convert all comments for the given AST.
5
5
  * @param ast the AST object
6
- * @param code the TypeScript code
7
6
  * @returns the converted ESTreeComment
8
7
  * @private
9
8
  */
10
- export declare function convertComments(ast: ts.SourceFile, code: string): TSESTree.Comment[];
9
+ export declare function convertComments(ast: ts.SourceFile): TSESTree.Comment[];
@@ -41,31 +41,21 @@ const ts_estree_1 = require("./ts-estree");
41
41
  /**
42
42
  * Convert all comments for the given AST.
43
43
  * @param ast the AST object
44
- * @param code the TypeScript code
45
44
  * @returns the converted ESTreeComment
46
45
  * @private
47
46
  */
48
- function convertComments(ast, code) {
49
- const comments = [];
50
- tsutils.forEachComment(ast, (_, comment) => {
51
- const type = comment.kind === ts.SyntaxKind.SingleLineCommentTrivia
47
+ function convertComments(ast) {
48
+ return Array.from(tsutils.iterateComments(ast), ({ end, kind, pos, value }) => {
49
+ const type = kind === ts.SyntaxKind.SingleLineCommentTrivia
52
50
  ? ts_estree_1.AST_TOKEN_TYPES.Line
53
51
  : ts_estree_1.AST_TOKEN_TYPES.Block;
54
- const range = [comment.pos, comment.end];
52
+ const range = [pos, end];
55
53
  const loc = (0, node_utils_1.getLocFor)(range, ast);
56
- // both comments start with 2 characters - /* or //
57
- const textStart = range[0] + 2;
58
- const textEnd = comment.kind === ts.SyntaxKind.SingleLineCommentTrivia
59
- ? // single line comments end at the end
60
- range[1]
61
- : // multiline comments end 2 characters early
62
- range[1] - 2;
63
- comments.push({
54
+ return {
64
55
  type,
65
56
  loc,
66
57
  range,
67
- value: code.slice(textStart, textEnd),
68
- });
69
- }, ast);
70
- return comments;
58
+ value,
59
+ };
60
+ });
71
61
  }
package/dist/convert.d.ts CHANGED
@@ -33,7 +33,6 @@ export declare class Converter {
33
33
  * @returns the converted ESTreeNode
34
34
  */
35
35
  constructor(ast: ts.SourceFile, options?: ConverterOptions);
36
- private assertModuleSpecifier;
37
36
  private convertBindingNameWithTypeAnnotation;
38
37
  /**
39
38
  * Coverts body Nodes and add a directive field to StringLiterals
@@ -78,7 +77,7 @@ export declare class Converter {
78
77
  * @param node parent used to create this node
79
78
  * @returns TypeParameterInstantiation node
80
79
  */
81
- private convertTypeArgumentsToTypeParameterInstantiation;
80
+ private convertTypeArguments;
82
81
  /**
83
82
  * Converts a ts.Node's typeParameters to TSTypeParameterDeclaration node
84
83
  * @param typeParameters ts.Node typeParameters
package/dist/convert.js CHANGED
@@ -38,7 +38,7 @@ exports.convertError = convertError;
38
38
  // There's lots of funny stuff due to the typing of ts.Node
39
39
  /* eslint-disable @typescript-eslint/no-non-null-assertion, @typescript-eslint/no-unnecessary-condition, @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-return, @typescript-eslint/no-unsafe-member-access */
40
40
  const ts = __importStar(require("typescript"));
41
- const check_modifiers_1 = require("./check-modifiers");
41
+ const check_syntax_errors_1 = require("./check-syntax-errors");
42
42
  const getModifiers_1 = require("./getModifiers");
43
43
  const node_utils_1 = require("./node-utils");
44
44
  const ts_estree_1 = require("./ts-estree");
@@ -76,35 +76,11 @@ class Converter {
76
76
  this.ast = ast;
77
77
  this.options = { ...options };
78
78
  }
79
- #checkForStatementDeclaration(initializer, kind) {
80
- const loop = kind === ts.SyntaxKind.ForInStatement ? 'for...in' : 'for...of';
81
- if (ts.isVariableDeclarationList(initializer)) {
82
- if (initializer.declarations.length !== 1) {
83
- this.#throwError(initializer, `Only a single variable declaration is allowed in a '${loop}' statement.`);
84
- }
85
- const declaration = initializer.declarations[0];
86
- if (declaration.initializer) {
87
- this.#throwError(declaration, `The variable declaration of a '${loop}' statement cannot have an initializer.`);
88
- }
89
- else if (declaration.type) {
90
- this.#throwError(declaration, `The variable declaration of a '${loop}' statement cannot have a type annotation.`);
91
- }
92
- if (kind === ts.SyntaxKind.ForInStatement &&
93
- initializer.flags & ts.NodeFlags.Using) {
94
- this.#throwError(initializer, "The left-hand side of a 'for...in' statement cannot be a 'using' declaration.");
95
- }
96
- }
97
- else if (!(0, node_utils_1.isValidAssignmentTarget)(initializer) &&
98
- initializer.kind !== ts.SyntaxKind.ObjectLiteralExpression &&
99
- initializer.kind !== ts.SyntaxKind.ArrayLiteralExpression) {
100
- this.#throwError(initializer, `The left-hand side of a '${loop}' statement must be a variable or a property access.`);
101
- }
102
- }
103
- #checkModifiers(node) {
79
+ #checkSyntaxError(node) {
104
80
  if (this.options.allowInvalidAST) {
105
81
  return;
106
82
  }
107
- (0, check_modifiers_1.checkModifiers)(node);
83
+ (0, check_syntax_errors_1.checkSyntaxError)(node);
108
84
  }
109
85
  #throwError(node, message) {
110
86
  if (this.options.allowInvalidAST) {
@@ -127,7 +103,7 @@ class Converter {
127
103
  ? () => node[valueKey]
128
104
  : () => {
129
105
  if (!warned) {
130
- process.emitWarning(`The '${aliasKey}' property is deprecated on ${node.type} nodes. Use '${valueKey}' instead. See https://typescript-eslint.io/troubleshooting/faqs/general#the-key-property-is-deprecated-on-type-nodes-use-key-instead-warnings.`, 'DeprecationWarning');
106
+ process.emitWarning(`The '${aliasKey}' property is deprecated on ${node.type} nodes. Use '${valueKey}' instead. See https://tseslint.com/key-property-deprecated.`, 'DeprecationWarning');
131
107
  warned = true;
132
108
  }
133
109
  return node[valueKey];
@@ -154,8 +130,7 @@ class Converter {
154
130
  if (preferredKey) {
155
131
  message += ` Use ${preferredKey} instead.`;
156
132
  }
157
- message +=
158
- ' See https://typescript-eslint.io/troubleshooting/faqs/general#the-key-property-is-deprecated-on-type-nodes-use-key-instead-warnings.';
133
+ message += ' See https://tseslint.com/key-property-deprecated.';
159
134
  process.emitWarning(message, 'DeprecationWarning');
160
135
  warned = true;
161
136
  }
@@ -171,15 +146,6 @@ class Converter {
171
146
  });
172
147
  return node;
173
148
  }
174
- assertModuleSpecifier(node, allowNull) {
175
- if (!allowNull && node.moduleSpecifier == null) {
176
- this.#throwError(node, 'Module specifier must be a string literal.');
177
- }
178
- if (node.moduleSpecifier &&
179
- node.moduleSpecifier?.kind !== SyntaxKind.StringLiteral) {
180
- this.#throwError(node.moduleSpecifier, 'Module specifier must be a string literal.');
181
- }
182
- }
183
149
  convertBindingNameWithTypeAnnotation(name, tsType, parent) {
184
150
  const id = this.convertPattern(name);
185
151
  if (tsType) {
@@ -302,7 +268,11 @@ class Converter {
302
268
  * @param node parent used to create this node
303
269
  * @returns TypeParameterInstantiation node
304
270
  */
305
- convertTypeArgumentsToTypeParameterInstantiation(typeArguments, node) {
271
+ convertTypeArguments(node) {
272
+ const { typeArguments } = node;
273
+ if (!typeArguments) {
274
+ return undefined;
275
+ }
306
276
  const greaterThanToken = (0, node_utils_1.findNextToken)(typeArguments, this.ast, this.ast);
307
277
  const range = [typeArguments.pos - 1, greaterThanToken.end];
308
278
  if (typeArguments.length === 0) {
@@ -364,7 +334,7 @@ class Converter {
364
334
  if (!node) {
365
335
  return null;
366
336
  }
367
- this.#checkModifiers(node);
337
+ this.#checkSyntaxError(node);
368
338
  const pattern = this.allowPattern;
369
339
  if (allowPattern != null) {
370
340
  this.allowPattern = allowPattern;
@@ -582,9 +552,6 @@ class Converter {
582
552
  test: this.convertChild(node.expression),
583
553
  });
584
554
  case SyntaxKind.SwitchStatement:
585
- if (node.caseBlock.clauses.filter(switchCase => switchCase.kind === SyntaxKind.DefaultClause).length > 1) {
586
- this.#throwError(node, "A 'default' clause cannot appear more than once in a 'switch' statement.");
587
- }
588
555
  return this.createNode(node, {
589
556
  type: ts_estree_1.AST_NODE_TYPES.SwitchStatement,
590
557
  cases: this.convertChildren(node.caseBlock.clauses),
@@ -602,9 +569,6 @@ class Converter {
602
569
  });
603
570
  // Exceptions
604
571
  case SyntaxKind.ThrowStatement:
605
- if (node.expression.end === node.expression.pos) {
606
- this.#throwError(node, 'A throw statement must throw an expression.');
607
- }
608
572
  return this.createNode(node, {
609
573
  type: ts_estree_1.AST_NODE_TYPES.ThrowStatement,
610
574
  argument: this.convertChild(node.expression),
@@ -617,9 +581,6 @@ class Converter {
617
581
  handler: this.convertChild(node.catchClause),
618
582
  });
619
583
  case SyntaxKind.CatchClause:
620
- if (node.variableDeclaration?.initializer) {
621
- this.#throwError(node.variableDeclaration.initializer, 'Catch clause variable cannot have an initializer.');
622
- }
623
584
  return this.createNode(node, {
624
585
  type: ts_estree_1.AST_NODE_TYPES.CatchClause,
625
586
  body: this.convertChild(node.block),
@@ -653,7 +614,6 @@ class Converter {
653
614
  update: this.convertChild(node.incrementor),
654
615
  });
655
616
  case SyntaxKind.ForInStatement:
656
- this.#checkForStatementDeclaration(node.initializer, node.kind);
657
617
  return this.createNode(node, {
658
618
  type: ts_estree_1.AST_NODE_TYPES.ForInStatement,
659
619
  body: this.convertChild(node.statement),
@@ -661,7 +621,6 @@ class Converter {
661
621
  right: this.convertChild(node.expression),
662
622
  });
663
623
  case SyntaxKind.ForOfStatement: {
664
- this.#checkForStatementDeclaration(node.initializer, node.kind);
665
624
  return this.createNode(node, {
666
625
  type: ts_estree_1.AST_NODE_TYPES.ForOfStatement,
667
626
  await: node.awaitModifier?.kind === SyntaxKind.AwaitKeyword,
@@ -675,20 +634,6 @@ class Converter {
675
634
  const isDeclare = (0, node_utils_1.hasModifier)(SyntaxKind.DeclareKeyword, node);
676
635
  const isAsync = (0, node_utils_1.hasModifier)(SyntaxKind.AsyncKeyword, node);
677
636
  const isGenerator = !!node.asteriskToken;
678
- if (isDeclare) {
679
- if (node.body) {
680
- this.#throwError(node, 'An implementation cannot be declared in ambient contexts.');
681
- }
682
- else if (isAsync) {
683
- this.#throwError(node, "'async' modifier cannot be used in an ambient context.");
684
- }
685
- else if (isGenerator) {
686
- this.#throwError(node, 'Generators are not allowed in an ambient context.');
687
- }
688
- }
689
- else if (!node.body && isGenerator) {
690
- this.#throwError(node, 'A function signature cannot be declared as a generator.');
691
- }
692
637
  const result = this.createNode(node, {
693
638
  // declare implies no body due to the invariant above
694
639
  type: !node.body
@@ -709,60 +654,6 @@ class Converter {
709
654
  }
710
655
  case SyntaxKind.VariableDeclaration: {
711
656
  const hasExclamationToken = !!node.exclamationToken;
712
- if (hasExclamationToken) {
713
- if (node.initializer) {
714
- this.#throwError(node, 'Declarations with initializers cannot also have definite assignment assertions.');
715
- }
716
- else if (node.name.kind !== SyntaxKind.Identifier || !node.type) {
717
- this.#throwError(node, 'Declarations with definite assignment assertions must also have type annotations.');
718
- }
719
- }
720
- if (node.parent.kind === SyntaxKind.VariableDeclarationList) {
721
- const variableDeclarationList = node.parent;
722
- const kind = (0, node_utils_1.getDeclarationKind)(variableDeclarationList);
723
- if ((variableDeclarationList.parent.kind ===
724
- SyntaxKind.ForInStatement ||
725
- variableDeclarationList.parent.kind ===
726
- SyntaxKind.ForStatement) &&
727
- (kind === 'using' || kind === 'await using')) {
728
- if (!node.initializer) {
729
- this.#throwError(node, `'${kind}' declarations may not be initialized in for statement.`);
730
- }
731
- if (node.name.kind !== SyntaxKind.Identifier) {
732
- this.#throwError(node.name, `'${kind}' declarations may not have binding patterns.`);
733
- }
734
- }
735
- if (variableDeclarationList.parent.kind === SyntaxKind.VariableStatement) {
736
- const variableStatement = variableDeclarationList.parent;
737
- if (kind === 'using' || kind === 'await using') {
738
- if (!node.initializer) {
739
- this.#throwError(node, `'${kind}' declarations must be initialized.`);
740
- }
741
- if (node.name.kind !== SyntaxKind.Identifier) {
742
- this.#throwError(node.name, `'${kind}' declarations may not have binding patterns.`);
743
- }
744
- }
745
- const hasDeclareKeyword = (0, node_utils_1.hasModifier)(SyntaxKind.DeclareKeyword, variableStatement);
746
- // Definite assignment only allowed for non-declare let and var
747
- if ((hasDeclareKeyword ||
748
- ['await using', 'const', 'using'].includes(kind)) &&
749
- hasExclamationToken) {
750
- this.#throwError(node, `A definite assignment assertion '!' is not permitted in this context.`);
751
- }
752
- if (hasDeclareKeyword &&
753
- node.initializer &&
754
- (['let', 'var'].includes(kind) || node.type)) {
755
- this.#throwError(node, `Initializers are not permitted in ambient contexts.`);
756
- }
757
- // Theoretically, only certain initializers are allowed for declare const,
758
- // (TS1254: A 'const' initializer in an ambient context must be a string
759
- // or numeric literal or literal enum reference.) but we just allow
760
- // all expressions
761
- // Note! No-declare does not mean the variable is not ambient, because
762
- // it can be further nested in other declare contexts. Therefore we cannot
763
- // check for const initializers.
764
- }
765
- }
766
657
  const init = this.convertChild(node.initializer);
767
658
  const id = this.convertBindingNameWithTypeAnnotation(node.name, node.type, node);
768
659
  return this.createNode(node, {
@@ -774,9 +665,6 @@ class Converter {
774
665
  }
775
666
  case SyntaxKind.VariableStatement: {
776
667
  const declarations = node.declarationList.declarations;
777
- if (!declarations.length) {
778
- this.#throwError(node, 'A variable declaration list must have at least one variable declarator.');
779
- }
780
668
  const result = this.createNode(node, {
781
669
  type: ts_estree_1.AST_NODE_TYPES.VariableDeclaration,
782
670
  declarations: this.convertChildren(declarations),
@@ -855,14 +743,6 @@ class Converter {
855
743
  });
856
744
  }
857
745
  case SyntaxKind.PropertyAssignment: {
858
- // eslint-disable-next-line @typescript-eslint/no-deprecated
859
- const { exclamationToken, questionToken } = node;
860
- if (questionToken) {
861
- this.#throwError(questionToken, 'A property assignment cannot have a question token.');
862
- }
863
- if (exclamationToken) {
864
- this.#throwError(exclamationToken, 'A property assignment cannot have an exclamation token.');
865
- }
866
746
  return this.createNode(node, {
867
747
  type: ts_estree_1.AST_NODE_TYPES.Property,
868
748
  computed: (0, node_utils_1.isComputedProperty)(node.name),
@@ -875,17 +755,6 @@ class Converter {
875
755
  });
876
756
  }
877
757
  case SyntaxKind.ShorthandPropertyAssignment: {
878
- // eslint-disable-next-line @typescript-eslint/no-deprecated
879
- const { exclamationToken, modifiers, questionToken } = node;
880
- if (modifiers) {
881
- this.#throwError(modifiers[0], 'A shorthand property assignment cannot have modifiers.');
882
- }
883
- if (questionToken) {
884
- this.#throwError(questionToken, 'A shorthand property assignment cannot have a question token.');
885
- }
886
- if (exclamationToken) {
887
- this.#throwError(exclamationToken, 'A shorthand property assignment cannot have an exclamation token.');
888
- }
889
758
  if (node.objectAssignmentInitializer) {
890
759
  return this.createNode(node, {
891
760
  type: ts_estree_1.AST_NODE_TYPES.Property,
@@ -920,13 +789,6 @@ class Converter {
920
789
  return this.convertChild(node.expression);
921
790
  case SyntaxKind.PropertyDeclaration: {
922
791
  const isAbstract = (0, node_utils_1.hasModifier)(SyntaxKind.AbstractKeyword, node);
923
- if (isAbstract && node.initializer) {
924
- this.#throwError(node.initializer, `Abstract property cannot have an initializer.`);
925
- }
926
- if (node.name.kind === SyntaxKind.StringLiteral &&
927
- node.name.text === 'constructor') {
928
- this.#throwError(node.name, "Classes may not have a field named 'constructor'.");
929
- }
930
792
  const isAccessor = (0, node_utils_1.hasModifier)(SyntaxKind.AccessorKeyword, node);
931
793
  const type = (() => {
932
794
  if (isAccessor) {
@@ -1259,15 +1121,11 @@ class Converter {
1259
1121
  return result;
1260
1122
  }
1261
1123
  case SyntaxKind.TaggedTemplateExpression: {
1262
- if (node.tag.flags & ts.NodeFlags.OptionalChain) {
1263
- this.#throwError(node, 'Tagged template expressions are not permitted in an optional chain.');
1264
- }
1265
1124
  return this.createNode(node, {
1266
1125
  type: ts_estree_1.AST_NODE_TYPES.TaggedTemplateExpression,
1267
1126
  quasi: this.convertChild(node.template),
1268
1127
  tag: this.convertChild(node.tag),
1269
- typeArguments: node.typeArguments &&
1270
- this.convertTypeArgumentsToTypeParameterInstantiation(node.typeArguments, node),
1128
+ typeArguments: this.convertTypeArguments(node),
1271
1129
  });
1272
1130
  }
1273
1131
  case SyntaxKind.TemplateHead:
@@ -1362,12 +1220,6 @@ class Converter {
1362
1220
  }
1363
1221
  // Classes
1364
1222
  case SyntaxKind.ClassDeclaration:
1365
- if (!node.name &&
1366
- (!(0, node_utils_1.hasModifier)(ts.SyntaxKind.ExportKeyword, node) ||
1367
- !(0, node_utils_1.hasModifier)(ts.SyntaxKind.DefaultKeyword, node))) {
1368
- this.#throwError(node, "A class declaration without the 'default' modifier must have a name.");
1369
- }
1370
- /* intentional fallthrough */
1371
1223
  case SyntaxKind.ClassExpression: {
1372
1224
  const heritageClauses = node.heritageClauses ?? [];
1373
1225
  const classNodeType = node.kind === SyntaxKind.ClassDeclaration
@@ -1419,8 +1271,7 @@ class Converter {
1419
1271
  this.convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters),
1420
1272
  });
1421
1273
  if (extendsClause?.types[0]?.typeArguments) {
1422
- result.superTypeArguments =
1423
- this.convertTypeArgumentsToTypeParameterInstantiation(extendsClause.types[0].typeArguments, extendsClause.types[0]);
1274
+ result.superTypeArguments = this.convertTypeArguments(extendsClause.types[0]);
1424
1275
  }
1425
1276
  return this.fixExports(node, result);
1426
1277
  }
@@ -1431,7 +1282,6 @@ class Converter {
1431
1282
  body: this.convertBodyExpressions(node.statements, node),
1432
1283
  });
1433
1284
  case SyntaxKind.ImportDeclaration: {
1434
- this.assertModuleSpecifier(node, false);
1435
1285
  const result = this.createNode(node, this.#withDeprecatedAliasGetter({
1436
1286
  type: ts_estree_1.AST_NODE_TYPES.ImportDeclaration,
1437
1287
  attributes: this.convertImportAttributes(node),
@@ -1484,7 +1334,6 @@ class Converter {
1484
1334
  }
1485
1335
  case SyntaxKind.ExportDeclaration: {
1486
1336
  if (node.exportClause?.kind === SyntaxKind.NamedExports) {
1487
- this.assertModuleSpecifier(node, true);
1488
1337
  return this.createNode(node, this.#withDeprecatedAliasGetter({
1489
1338
  type: ts_estree_1.AST_NODE_TYPES.ExportNamedDeclaration,
1490
1339
  attributes: this.convertImportAttributes(node),
@@ -1494,7 +1343,6 @@ class Converter {
1494
1343
  specifiers: this.convertChildren(node.exportClause.elements, node),
1495
1344
  }, 'assertions', 'attributes', true));
1496
1345
  }
1497
- this.assertModuleSpecifier(node, false);
1498
1346
  return this.createNode(node, this.#withDeprecatedAliasGetter({
1499
1347
  type: ts_estree_1.AST_NODE_TYPES.ExportAllDeclaration,
1500
1348
  attributes: this.convertImportAttributes(node),
@@ -1539,9 +1387,6 @@ class Converter {
1539
1387
  * ESTree uses UpdateExpression for ++/--
1540
1388
  */
1541
1389
  if (operator === '++' || operator === '--') {
1542
- if (!(0, node_utils_1.isValidAssignmentTarget)(node.operand)) {
1543
- this.#throwError(node.operand, 'Invalid left-hand side expression in unary operation');
1544
- }
1545
1390
  return this.createNode(node, {
1546
1391
  type: ts_estree_1.AST_NODE_TYPES.UpdateExpression,
1547
1392
  argument: this.convertChild(node.operand),
@@ -1585,13 +1430,6 @@ class Converter {
1585
1430
  });
1586
1431
  // Binary Operations
1587
1432
  case SyntaxKind.BinaryExpression: {
1588
- if (node.operatorToken.kind !== SyntaxKind.InKeyword &&
1589
- node.left.kind === SyntaxKind.PrivateIdentifier) {
1590
- this.#throwError(node.left, "Private identifiers cannot appear on the right-hand-side of an 'in' expression.");
1591
- }
1592
- else if (node.right.kind === SyntaxKind.PrivateIdentifier) {
1593
- this.#throwError(node.right, "Private identifiers are only allowed on the left-hand-side of an 'in' expression.");
1594
- }
1595
1433
  // TypeScript uses BinaryExpression for sequences as well
1596
1434
  if ((0, node_utils_1.isComma)(node.operatorToken)) {
1597
1435
  const result = this.createNode(node, {
@@ -1655,9 +1493,6 @@ class Converter {
1655
1493
  }
1656
1494
  case SyntaxKind.CallExpression: {
1657
1495
  if (node.expression.kind === SyntaxKind.ImportKeyword) {
1658
- if (node.arguments.length !== 1 && node.arguments.length !== 2) {
1659
- this.#throwError(node.arguments[2] ?? node, 'Dynamic import requires exactly one or two arguments.');
1660
- }
1661
1496
  return this.createNode(node, this.#withDeprecatedAliasGetter({
1662
1497
  type: ts_estree_1.AST_NODE_TYPES.ImportExpression,
1663
1498
  options: node.arguments[1]
@@ -1668,8 +1503,7 @@ class Converter {
1668
1503
  }
1669
1504
  const callee = this.convertChild(node.expression);
1670
1505
  const args = this.convertChildren(node.arguments);
1671
- const typeArguments = node.typeArguments &&
1672
- this.convertTypeArgumentsToTypeParameterInstantiation(node.typeArguments, node);
1506
+ const typeArguments = this.convertTypeArguments(node);
1673
1507
  const result = this.createNode(node, {
1674
1508
  type: ts_estree_1.AST_NODE_TYPES.CallExpression,
1675
1509
  arguments: args,
@@ -1680,8 +1514,7 @@ class Converter {
1680
1514
  return this.convertChainExpression(result, node);
1681
1515
  }
1682
1516
  case SyntaxKind.NewExpression: {
1683
- const typeArguments = node.typeArguments &&
1684
- this.convertTypeArgumentsToTypeParameterInstantiation(node.typeArguments, node);
1517
+ const typeArguments = this.convertTypeArguments(node);
1685
1518
  // NOTE - NewExpression cannot have an optional chain in it
1686
1519
  return this.createNode(node, {
1687
1520
  type: ts_estree_1.AST_NODE_TYPES.NewExpression,
@@ -1830,9 +1663,7 @@ class Converter {
1830
1663
  attributes: this.convertChildren(node.attributes.properties),
1831
1664
  name: this.convertJSXTagName(node.tagName, node),
1832
1665
  selfClosing: true,
1833
- typeArguments: node.typeArguments
1834
- ? this.convertTypeArgumentsToTypeParameterInstantiation(node.typeArguments, node)
1835
- : undefined,
1666
+ typeArguments: this.convertTypeArguments(node),
1836
1667
  }),
1837
1668
  });
1838
1669
  }
@@ -1842,8 +1673,7 @@ class Converter {
1842
1673
  attributes: this.convertChildren(node.attributes.properties),
1843
1674
  name: this.convertJSXTagName(node.tagName, node),
1844
1675
  selfClosing: false,
1845
- typeArguments: node.typeArguments &&
1846
- this.convertTypeArgumentsToTypeParameterInstantiation(node.typeArguments, node),
1676
+ typeArguments: this.convertTypeArguments(node),
1847
1677
  });
1848
1678
  }
1849
1679
  case SyntaxKind.JsxClosingElement:
@@ -1911,8 +1741,7 @@ class Converter {
1911
1741
  case SyntaxKind.TypeReference:
1912
1742
  return this.createNode(node, {
1913
1743
  type: ts_estree_1.AST_NODE_TYPES.TSTypeReference,
1914
- typeArguments: node.typeArguments &&
1915
- this.convertTypeArgumentsToTypeParameterInstantiation(node.typeArguments, node),
1744
+ typeArguments: this.convertTypeArguments(node),
1916
1745
  typeName: this.convertChild(node.typeName),
1917
1746
  });
1918
1747
  case SyntaxKind.TypeParameter: {
@@ -1985,13 +1814,9 @@ class Converter {
1985
1814
  return this.createNode(node, {
1986
1815
  type: ts_estree_1.AST_NODE_TYPES.TSTypeQuery,
1987
1816
  exprName: this.convertChild(node.exprName),
1988
- typeArguments: node.typeArguments &&
1989
- this.convertTypeArgumentsToTypeParameterInstantiation(node.typeArguments, node),
1817
+ typeArguments: this.convertTypeArguments(node),
1990
1818
  });
1991
1819
  case SyntaxKind.MappedType: {
1992
- if (node.members && node.members.length > 0) {
1993
- this.#throwError(node.members[0], 'A mapped type may not declare properties or methods.');
1994
- }
1995
1820
  return this.createNode(node, this.#withDeprecatedGetter({
1996
1821
  type: ts_estree_1.AST_NODE_TYPES.TSMappedType,
1997
1822
  constraint: this.convertChild(node.typeParameter.constraint),
@@ -2025,11 +1850,6 @@ class Converter {
2025
1850
  return this.convertMethodSignature(node);
2026
1851
  }
2027
1852
  case SyntaxKind.PropertySignature: {
2028
- // eslint-disable-next-line @typescript-eslint/no-deprecated
2029
- const { initializer } = node;
2030
- if (initializer) {
2031
- this.#throwError(initializer, 'A property signature cannot have an initializer.');
2032
- }
2033
1853
  return this.createNode(node, {
2034
1854
  type: ts_estree_1.AST_NODE_TYPES.TSPropertySignature,
2035
1855
  accessibility: (0, node_utils_1.getTSNodeAccessibility)(node),
@@ -2061,14 +1881,7 @@ class Converter {
2061
1881
  this.convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters),
2062
1882
  });
2063
1883
  }
2064
- case SyntaxKind.FunctionType: {
2065
- // eslint-disable-next-line @typescript-eslint/no-deprecated
2066
- const { modifiers } = node;
2067
- if (modifiers) {
2068
- this.#throwError(modifiers[0], 'A function type cannot have modifiers.');
2069
- }
2070
- }
2071
- // intentional fallthrough
1884
+ case SyntaxKind.FunctionType:
2072
1885
  case SyntaxKind.ConstructSignature:
2073
1886
  case SyntaxKind.CallSignature: {
2074
1887
  const type = node.kind === SyntaxKind.ConstructSignature
@@ -2094,8 +1907,7 @@ class Converter {
2094
1907
  return this.createNode(node, {
2095
1908
  type,
2096
1909
  expression: this.convertChild(node.expression),
2097
- typeArguments: node.typeArguments &&
2098
- this.convertTypeArgumentsToTypeParameterInstantiation(node.typeArguments, node),
1910
+ typeArguments: this.convertTypeArguments(node),
2099
1911
  });
2100
1912
  }
2101
1913
  case SyntaxKind.InterfaceDeclaration: {
@@ -2219,9 +2031,7 @@ class Converter {
2219
2031
  options,
2220
2032
  qualifier: this.convertChild(node.qualifier),
2221
2033
  source,
2222
- typeArguments: node.typeArguments
2223
- ? this.convertTypeArgumentsToTypeParameterInstantiation(node.typeArguments, node)
2224
- : null,
2034
+ typeArguments: this.convertTypeArguments(node) ?? null,
2225
2035
  }, 'argument', 'source', argument));
2226
2036
  if (node.isTypeOf) {
2227
2037
  return this.createNode(node, {
@@ -2249,13 +2059,6 @@ class Converter {
2249
2059
  }
2250
2060
  case SyntaxKind.EnumMember: {
2251
2061
  const computed = node.name.kind === ts.SyntaxKind.ComputedPropertyName;
2252
- if (computed) {
2253
- this.#throwError(node.name, 'Computed property names are not allowed in enums.');
2254
- }
2255
- if (node.name.kind === SyntaxKind.NumericLiteral ||
2256
- node.name.kind === SyntaxKind.BigIntLiteral) {
2257
- this.#throwError(node.name, 'An enum member cannot have a numeric name.');
2258
- }
2259
2062
  return this.createNode(node, this.#withDeprecatedGetter({
2260
2063
  type: ts_estree_1.AST_NODE_TYPES.TSEnumMember,
2261
2064
  id: this.convertChild(node.name),
@@ -2409,9 +2212,6 @@ class Converter {
2409
2212
  }));
2410
2213
  }
2411
2214
  case SyntaxKind.ExternalModuleReference: {
2412
- if (node.expression.kind !== SyntaxKind.StringLiteral) {
2413
- this.#throwError(node.expression, 'String literal expected.');
2414
- }
2415
2215
  return this.createNode(node, {
2416
2216
  type: ts_estree_1.AST_NODE_TYPES.TSExternalModuleReference,
2417
2217
  expression: this.convertChild(node.expression),
@@ -2546,7 +2346,7 @@ class Converter {
2546
2346
  if ('typeArguments' in node) {
2547
2347
  result.typeArguments =
2548
2348
  node.typeArguments && 'pos' in node.typeArguments
2549
- ? this.convertTypeArgumentsToTypeParameterInstantiation(node.typeArguments, node)
2349
+ ? this.convertTypeArguments(node)
2550
2350
  : null;
2551
2351
  }
2552
2352
  if ('typeParameters' in node) {
@@ -29,7 +29,7 @@ function getErrorDetails(describedFilePath, parseSettings, programsForProjects)
29
29
  `Either:`,
30
30
  `- Switch to \`parserOptions.projectService\``,
31
31
  `- Use an ESLint-specific TSConfig`,
32
- `See the typescript-eslint docs for more info: https://typescript-eslint.io/troubleshooting/typed-linting#are-typescript-project-references-supported`,
32
+ `See the typescript-eslint docs for more info: https://tseslint.com/are-project-references-supported`,
33
33
  ];
34
34
  }
35
35
  const { extraFileExtensions } = parseSettings;
@@ -69,6 +69,6 @@ function getErrorDetails(describedFilePath, parseSettings, programsForProjects)
69
69
  `- Change ESLint's list of included files to not include this file`,
70
70
  `- Change ${describedSpecifiers} to include this file`,
71
71
  `- Create a new TSConfig that includes this file and include it in your parserOptions.project`,
72
- `See the typescript-eslint docs for more info: https://typescript-eslint.io/troubleshooting/typed-linting#i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-file`,
72
+ `See the typescript-eslint docs for more info: https://tseslint.com/none-of-those-tsconfigs-include-this-file`,
73
73
  ];
74
74
  }
@@ -1,2 +1,2 @@
1
- export declare const DEFAULT_PROJECT_FILES_ERROR_EXPLANATION = "\n\nHaving many files run with the default project is known to cause performance issues and slow down linting.\n\nSee https://typescript-eslint.io/troubleshooting/typed-linting#allowdefaultproject-glob-too-wide\n";
1
+ export declare const DEFAULT_PROJECT_FILES_ERROR_EXPLANATION = "\n\nHaving many files run with the default project is known to cause performance issues and slow down linting.\n\nSee https://tseslint.com/allowdefaultproject-glob-too-wide\n";
2
2
  export declare function validateDefaultProjectForFilesGlob(allowDefaultProject: string[] | undefined): void;
@@ -6,7 +6,7 @@ exports.DEFAULT_PROJECT_FILES_ERROR_EXPLANATION = `
6
6
 
7
7
  Having many files run with the default project is known to cause performance issues and slow down linting.
8
8
 
9
- See https://typescript-eslint.io/troubleshooting/typed-linting#allowdefaultproject-glob-too-wide
9
+ See https://tseslint.com/allowdefaultproject-glob-too-wide
10
10
  `;
11
11
  function validateDefaultProjectForFilesGlob(allowDefaultProject) {
12
12
  if (!allowDefaultProject?.length) {
@@ -22,7 +22,7 @@ function getInferredTSConfigRootDir() {
22
22
  'No tsconfigRootDir was set, and multiple candidate TSConfigRootDirs are present:',
23
23
  ...entries.map(candidate => ` - ${candidate}`),
24
24
  "You'll need to explicitly set tsconfigRootDir in your parser options.",
25
- 'See: https://typescript-eslint.io/packages/parser/#tsconfigrootdir',
25
+ 'See: https://tseslint.com/parser-tsconfigrootdir',
26
26
  ].join('\n'));
27
27
  }
28
28
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typescript-eslint/typescript-estree",
3
- "version": "8.51.1-alpha.1",
3
+ "version": "8.51.1-alpha.11",
4
4
  "description": "A parser that converts TypeScript source code into an ESTree compatible form",
5
5
  "files": [
6
6
  "dist",
@@ -52,23 +52,23 @@
52
52
  "typecheck": "yarn run -BT nx typecheck"
53
53
  },
54
54
  "dependencies": {
55
- "@typescript-eslint/project-service": "8.51.1-alpha.1",
56
- "@typescript-eslint/tsconfig-utils": "8.51.1-alpha.1",
57
- "@typescript-eslint/types": "8.51.1-alpha.1",
58
- "@typescript-eslint/visitor-keys": "8.51.1-alpha.1",
59
- "debug": "^4.3.4",
60
- "minimatch": "^9.0.4",
61
- "semver": "^7.6.0",
55
+ "@typescript-eslint/project-service": "8.51.1-alpha.11",
56
+ "@typescript-eslint/tsconfig-utils": "8.51.1-alpha.11",
57
+ "@typescript-eslint/types": "8.51.1-alpha.11",
58
+ "@typescript-eslint/visitor-keys": "8.51.1-alpha.11",
59
+ "debug": "^4.4.3",
60
+ "minimatch": "^9.0.5",
61
+ "semver": "^7.7.3",
62
62
  "tinyglobby": "^0.2.15",
63
- "ts-api-utils": "^2.2.0"
63
+ "ts-api-utils": "^2.4.0"
64
64
  },
65
65
  "devDependencies": {
66
- "@vitest/coverage-v8": "^3.1.3",
66
+ "@vitest/coverage-v8": "^3.2.4",
67
67
  "eslint": "*",
68
68
  "glob": "*",
69
69
  "rimraf": "*",
70
70
  "typescript": "*",
71
- "vitest": "^3.1.3"
71
+ "vitest": "^3.2.4"
72
72
  },
73
73
  "peerDependencies": {
74
74
  "typescript": ">=4.8.4 <6.0.0"