@typescript-eslint/typescript-estree 8.51.1-alpha.0 → 8.51.1-alpha.10
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.
- package/dist/ast-converter.js +1 -1
- package/dist/check-syntax-errors.d.ts +2 -0
- package/dist/check-syntax-errors.js +269 -0
- package/dist/convert-comments.d.ts +1 -2
- package/dist/convert-comments.js +8 -18
- package/dist/convert.js +7 -181
- package/dist/create-program/createProjectProgramError.js +2 -2
- package/dist/create-program/validateDefaultProjectForFilesGlob.d.ts +1 -1
- package/dist/create-program/validateDefaultProjectForFilesGlob.js +1 -1
- package/dist/parseSettings/candidateTSConfigRootDirs.js +1 -1
- package/package.json +11 -11
package/dist/ast-converter.js
CHANGED
|
@@ -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
|
|
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,269 @@
|
|
|
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.ForInStatement:
|
|
238
|
+
case SyntaxKind.ForOfStatement: {
|
|
239
|
+
checkForStatementDeclaration(node);
|
|
240
|
+
break;
|
|
241
|
+
}
|
|
242
|
+
// No default
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
function checkForStatementDeclaration(node) {
|
|
246
|
+
const { initializer, kind } = node;
|
|
247
|
+
const loop = kind === SyntaxKind.ForInStatement ? 'for...in' : 'for...of';
|
|
248
|
+
if (ts.isVariableDeclarationList(initializer)) {
|
|
249
|
+
if (initializer.declarations.length !== 1) {
|
|
250
|
+
throw (0, node_utils_1.createError)(initializer, `Only a single variable declaration is allowed in a '${loop}' statement.`);
|
|
251
|
+
}
|
|
252
|
+
const declaration = initializer.declarations[0];
|
|
253
|
+
if (declaration.initializer) {
|
|
254
|
+
throw (0, node_utils_1.createError)(declaration, `The variable declaration of a '${loop}' statement cannot have an initializer.`);
|
|
255
|
+
}
|
|
256
|
+
else if (declaration.type) {
|
|
257
|
+
throw (0, node_utils_1.createError)(declaration, `The variable declaration of a '${loop}' statement cannot have a type annotation.`);
|
|
258
|
+
}
|
|
259
|
+
if (kind === SyntaxKind.ForInStatement &&
|
|
260
|
+
initializer.flags & ts.NodeFlags.Using) {
|
|
261
|
+
throw (0, node_utils_1.createError)(initializer, "The left-hand side of a 'for...in' statement cannot be a 'using' declaration.");
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
else if (!(0, node_utils_1.isValidAssignmentTarget)(initializer) &&
|
|
265
|
+
initializer.kind !== SyntaxKind.ObjectLiteralExpression &&
|
|
266
|
+
initializer.kind !== SyntaxKind.ArrayLiteralExpression) {
|
|
267
|
+
throw (0, node_utils_1.createError)(initializer, `The left-hand side of a '${loop}' statement must be a variable or a property access.`);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
@@ -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
|
|
9
|
+
export declare function convertComments(ast: ts.SourceFile): TSESTree.Comment[];
|
package/dist/convert-comments.js
CHANGED
|
@@ -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
|
|
49
|
-
|
|
50
|
-
|
|
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 = [
|
|
52
|
+
const range = [pos, end];
|
|
55
53
|
const loc = (0, node_utils_1.getLocFor)(range, ast);
|
|
56
|
-
|
|
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
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
return comments;
|
|
58
|
+
value,
|
|
59
|
+
};
|
|
60
|
+
});
|
|
71
61
|
}
|
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
|
|
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
|
-
#
|
|
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,
|
|
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://
|
|
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
|
}
|
|
@@ -364,7 +339,7 @@ class Converter {
|
|
|
364
339
|
if (!node) {
|
|
365
340
|
return null;
|
|
366
341
|
}
|
|
367
|
-
this.#
|
|
342
|
+
this.#checkSyntaxError(node);
|
|
368
343
|
const pattern = this.allowPattern;
|
|
369
344
|
if (allowPattern != null) {
|
|
370
345
|
this.allowPattern = allowPattern;
|
|
@@ -582,9 +557,6 @@ class Converter {
|
|
|
582
557
|
test: this.convertChild(node.expression),
|
|
583
558
|
});
|
|
584
559
|
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
560
|
return this.createNode(node, {
|
|
589
561
|
type: ts_estree_1.AST_NODE_TYPES.SwitchStatement,
|
|
590
562
|
cases: this.convertChildren(node.caseBlock.clauses),
|
|
@@ -602,9 +574,6 @@ class Converter {
|
|
|
602
574
|
});
|
|
603
575
|
// Exceptions
|
|
604
576
|
case SyntaxKind.ThrowStatement:
|
|
605
|
-
if (node.expression.end === node.expression.pos) {
|
|
606
|
-
this.#throwError(node, 'A throw statement must throw an expression.');
|
|
607
|
-
}
|
|
608
577
|
return this.createNode(node, {
|
|
609
578
|
type: ts_estree_1.AST_NODE_TYPES.ThrowStatement,
|
|
610
579
|
argument: this.convertChild(node.expression),
|
|
@@ -617,9 +586,6 @@ class Converter {
|
|
|
617
586
|
handler: this.convertChild(node.catchClause),
|
|
618
587
|
});
|
|
619
588
|
case SyntaxKind.CatchClause:
|
|
620
|
-
if (node.variableDeclaration?.initializer) {
|
|
621
|
-
this.#throwError(node.variableDeclaration.initializer, 'Catch clause variable cannot have an initializer.');
|
|
622
|
-
}
|
|
623
589
|
return this.createNode(node, {
|
|
624
590
|
type: ts_estree_1.AST_NODE_TYPES.CatchClause,
|
|
625
591
|
body: this.convertChild(node.block),
|
|
@@ -653,7 +619,6 @@ class Converter {
|
|
|
653
619
|
update: this.convertChild(node.incrementor),
|
|
654
620
|
});
|
|
655
621
|
case SyntaxKind.ForInStatement:
|
|
656
|
-
this.#checkForStatementDeclaration(node.initializer, node.kind);
|
|
657
622
|
return this.createNode(node, {
|
|
658
623
|
type: ts_estree_1.AST_NODE_TYPES.ForInStatement,
|
|
659
624
|
body: this.convertChild(node.statement),
|
|
@@ -661,7 +626,6 @@ class Converter {
|
|
|
661
626
|
right: this.convertChild(node.expression),
|
|
662
627
|
});
|
|
663
628
|
case SyntaxKind.ForOfStatement: {
|
|
664
|
-
this.#checkForStatementDeclaration(node.initializer, node.kind);
|
|
665
629
|
return this.createNode(node, {
|
|
666
630
|
type: ts_estree_1.AST_NODE_TYPES.ForOfStatement,
|
|
667
631
|
await: node.awaitModifier?.kind === SyntaxKind.AwaitKeyword,
|
|
@@ -675,20 +639,6 @@ class Converter {
|
|
|
675
639
|
const isDeclare = (0, node_utils_1.hasModifier)(SyntaxKind.DeclareKeyword, node);
|
|
676
640
|
const isAsync = (0, node_utils_1.hasModifier)(SyntaxKind.AsyncKeyword, node);
|
|
677
641
|
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
642
|
const result = this.createNode(node, {
|
|
693
643
|
// declare implies no body due to the invariant above
|
|
694
644
|
type: !node.body
|
|
@@ -709,60 +659,6 @@ class Converter {
|
|
|
709
659
|
}
|
|
710
660
|
case SyntaxKind.VariableDeclaration: {
|
|
711
661
|
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
662
|
const init = this.convertChild(node.initializer);
|
|
767
663
|
const id = this.convertBindingNameWithTypeAnnotation(node.name, node.type, node);
|
|
768
664
|
return this.createNode(node, {
|
|
@@ -774,9 +670,6 @@ class Converter {
|
|
|
774
670
|
}
|
|
775
671
|
case SyntaxKind.VariableStatement: {
|
|
776
672
|
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
673
|
const result = this.createNode(node, {
|
|
781
674
|
type: ts_estree_1.AST_NODE_TYPES.VariableDeclaration,
|
|
782
675
|
declarations: this.convertChildren(declarations),
|
|
@@ -855,14 +748,6 @@ class Converter {
|
|
|
855
748
|
});
|
|
856
749
|
}
|
|
857
750
|
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
751
|
return this.createNode(node, {
|
|
867
752
|
type: ts_estree_1.AST_NODE_TYPES.Property,
|
|
868
753
|
computed: (0, node_utils_1.isComputedProperty)(node.name),
|
|
@@ -875,17 +760,6 @@ class Converter {
|
|
|
875
760
|
});
|
|
876
761
|
}
|
|
877
762
|
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
763
|
if (node.objectAssignmentInitializer) {
|
|
890
764
|
return this.createNode(node, {
|
|
891
765
|
type: ts_estree_1.AST_NODE_TYPES.Property,
|
|
@@ -920,13 +794,6 @@ class Converter {
|
|
|
920
794
|
return this.convertChild(node.expression);
|
|
921
795
|
case SyntaxKind.PropertyDeclaration: {
|
|
922
796
|
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
797
|
const isAccessor = (0, node_utils_1.hasModifier)(SyntaxKind.AccessorKeyword, node);
|
|
931
798
|
const type = (() => {
|
|
932
799
|
if (isAccessor) {
|
|
@@ -1259,9 +1126,6 @@ class Converter {
|
|
|
1259
1126
|
return result;
|
|
1260
1127
|
}
|
|
1261
1128
|
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
1129
|
return this.createNode(node, {
|
|
1266
1130
|
type: ts_estree_1.AST_NODE_TYPES.TaggedTemplateExpression,
|
|
1267
1131
|
quasi: this.convertChild(node.template),
|
|
@@ -1362,12 +1226,6 @@ class Converter {
|
|
|
1362
1226
|
}
|
|
1363
1227
|
// Classes
|
|
1364
1228
|
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
1229
|
case SyntaxKind.ClassExpression: {
|
|
1372
1230
|
const heritageClauses = node.heritageClauses ?? [];
|
|
1373
1231
|
const classNodeType = node.kind === SyntaxKind.ClassDeclaration
|
|
@@ -1585,13 +1443,6 @@ class Converter {
|
|
|
1585
1443
|
});
|
|
1586
1444
|
// Binary Operations
|
|
1587
1445
|
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
1446
|
// TypeScript uses BinaryExpression for sequences as well
|
|
1596
1447
|
if ((0, node_utils_1.isComma)(node.operatorToken)) {
|
|
1597
1448
|
const result = this.createNode(node, {
|
|
@@ -1989,9 +1840,6 @@ class Converter {
|
|
|
1989
1840
|
this.convertTypeArgumentsToTypeParameterInstantiation(node.typeArguments, node),
|
|
1990
1841
|
});
|
|
1991
1842
|
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
1843
|
return this.createNode(node, this.#withDeprecatedGetter({
|
|
1996
1844
|
type: ts_estree_1.AST_NODE_TYPES.TSMappedType,
|
|
1997
1845
|
constraint: this.convertChild(node.typeParameter.constraint),
|
|
@@ -2025,11 +1873,6 @@ class Converter {
|
|
|
2025
1873
|
return this.convertMethodSignature(node);
|
|
2026
1874
|
}
|
|
2027
1875
|
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
1876
|
return this.createNode(node, {
|
|
2034
1877
|
type: ts_estree_1.AST_NODE_TYPES.TSPropertySignature,
|
|
2035
1878
|
accessibility: (0, node_utils_1.getTSNodeAccessibility)(node),
|
|
@@ -2061,14 +1904,7 @@ class Converter {
|
|
|
2061
1904
|
this.convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters),
|
|
2062
1905
|
});
|
|
2063
1906
|
}
|
|
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
|
|
1907
|
+
case SyntaxKind.FunctionType:
|
|
2072
1908
|
case SyntaxKind.ConstructSignature:
|
|
2073
1909
|
case SyntaxKind.CallSignature: {
|
|
2074
1910
|
const type = node.kind === SyntaxKind.ConstructSignature
|
|
@@ -2249,13 +2085,6 @@ class Converter {
|
|
|
2249
2085
|
}
|
|
2250
2086
|
case SyntaxKind.EnumMember: {
|
|
2251
2087
|
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
2088
|
return this.createNode(node, this.#withDeprecatedGetter({
|
|
2260
2089
|
type: ts_estree_1.AST_NODE_TYPES.TSEnumMember,
|
|
2261
2090
|
id: this.convertChild(node.name),
|
|
@@ -2409,9 +2238,6 @@ class Converter {
|
|
|
2409
2238
|
}));
|
|
2410
2239
|
}
|
|
2411
2240
|
case SyntaxKind.ExternalModuleReference: {
|
|
2412
|
-
if (node.expression.kind !== SyntaxKind.StringLiteral) {
|
|
2413
|
-
this.#throwError(node.expression, 'String literal expected.');
|
|
2414
|
-
}
|
|
2415
2241
|
return this.createNode(node, {
|
|
2416
2242
|
type: ts_estree_1.AST_NODE_TYPES.TSExternalModuleReference,
|
|
2417
2243
|
expression: this.convertChild(node.expression),
|
|
@@ -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://
|
|
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://
|
|
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://
|
|
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://
|
|
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://
|
|
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.
|
|
3
|
+
"version": "8.51.1-alpha.10",
|
|
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.
|
|
56
|
-
"@typescript-eslint/tsconfig-utils": "8.51.1-alpha.
|
|
57
|
-
"@typescript-eslint/types": "8.51.1-alpha.
|
|
58
|
-
"@typescript-eslint/visitor-keys": "8.51.1-alpha.
|
|
59
|
-
"debug": "^4.3
|
|
60
|
-
"minimatch": "^9.0.
|
|
61
|
-
"semver": "^7.
|
|
55
|
+
"@typescript-eslint/project-service": "8.51.1-alpha.10",
|
|
56
|
+
"@typescript-eslint/tsconfig-utils": "8.51.1-alpha.10",
|
|
57
|
+
"@typescript-eslint/types": "8.51.1-alpha.10",
|
|
58
|
+
"@typescript-eslint/visitor-keys": "8.51.1-alpha.10",
|
|
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.
|
|
63
|
+
"ts-api-utils": "^2.4.0"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
|
-
"@vitest/coverage-v8": "^3.
|
|
66
|
+
"@vitest/coverage-v8": "^3.2.4",
|
|
67
67
|
"eslint": "*",
|
|
68
68
|
"glob": "*",
|
|
69
69
|
"rimraf": "*",
|
|
70
70
|
"typescript": "*",
|
|
71
|
-
"vitest": "^3.
|
|
71
|
+
"vitest": "^3.2.4"
|
|
72
72
|
},
|
|
73
73
|
"peerDependencies": {
|
|
74
74
|
"typescript": ">=4.8.4 <6.0.0"
|