@typescript-eslint/typescript-estree 8.52.1-alpha.1 → 8.52.1-alpha.3
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/check-syntax-errors.js +8 -16
- package/package.json +5 -5
|
@@ -90,19 +90,12 @@ function checkSyntaxError(tsNode, parent, allowPattern) {
|
|
|
90
90
|
if (node.parent.kind === SyntaxKind.VariableDeclarationList) {
|
|
91
91
|
const variableDeclarationList = node.parent;
|
|
92
92
|
const kind = (0, node_utils_1.getDeclarationKind)(variableDeclarationList);
|
|
93
|
-
if (
|
|
94
|
-
variableDeclarationList.parent.kind === SyntaxKind.
|
|
95
|
-
|
|
96
|
-
if (!node.initializer) {
|
|
97
|
-
throw (0, node_utils_1.createError)(node, `'${kind}' declarations may not be initialized in for statement.`);
|
|
93
|
+
if (kind === 'using' || kind === 'await using') {
|
|
94
|
+
if (variableDeclarationList.parent.kind === SyntaxKind.ForInStatement) {
|
|
95
|
+
throw (0, node_utils_1.createError)(variableDeclarationList, `The left-hand side of a 'for...in' statement cannot be a '${kind}' declaration.`);
|
|
98
96
|
}
|
|
99
|
-
if (
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
if (variableDeclarationList.parent.kind === SyntaxKind.VariableStatement) {
|
|
104
|
-
const variableStatement = variableDeclarationList.parent;
|
|
105
|
-
if (kind === 'using' || kind === 'await using') {
|
|
97
|
+
if (variableDeclarationList.parent.kind === SyntaxKind.ForStatement ||
|
|
98
|
+
variableDeclarationList.parent.kind === SyntaxKind.VariableStatement) {
|
|
106
99
|
if (!node.initializer) {
|
|
107
100
|
throw (0, node_utils_1.createError)(node, `'${kind}' declarations must be initialized.`);
|
|
108
101
|
}
|
|
@@ -110,6 +103,9 @@ function checkSyntaxError(tsNode, parent, allowPattern) {
|
|
|
110
103
|
throw (0, node_utils_1.createError)(node.name, `'${kind}' declarations may not have binding patterns.`);
|
|
111
104
|
}
|
|
112
105
|
}
|
|
106
|
+
}
|
|
107
|
+
if (variableDeclarationList.parent.kind === SyntaxKind.VariableStatement) {
|
|
108
|
+
const variableStatement = variableDeclarationList.parent;
|
|
113
109
|
const hasDeclareKeyword = (0, node_utils_1.hasModifier)(SyntaxKind.DeclareKeyword, variableStatement);
|
|
114
110
|
// Definite assignment only allowed for non-declare let and var
|
|
115
111
|
if ((hasDeclareKeyword ||
|
|
@@ -386,10 +382,6 @@ function checkForStatementDeclaration(node) {
|
|
|
386
382
|
else if (declaration.type) {
|
|
387
383
|
throw (0, node_utils_1.createError)(declaration, `The variable declaration of a '${loop}' statement cannot have a type annotation.`);
|
|
388
384
|
}
|
|
389
|
-
if (kind === SyntaxKind.ForInStatement &&
|
|
390
|
-
initializer.flags & ts.NodeFlags.Using) {
|
|
391
|
-
throw (0, node_utils_1.createError)(initializer, "The left-hand side of a 'for...in' statement cannot be a 'using' declaration.");
|
|
392
|
-
}
|
|
393
385
|
}
|
|
394
386
|
else if (!(0, node_utils_1.isValidAssignmentTarget)(initializer) &&
|
|
395
387
|
initializer.kind !== SyntaxKind.ObjectLiteralExpression &&
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@typescript-eslint/typescript-estree",
|
|
3
|
-
"version": "8.52.1-alpha.
|
|
3
|
+
"version": "8.52.1-alpha.3",
|
|
4
4
|
"description": "A parser that converts TypeScript source code into an ESTree compatible form",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist",
|
|
@@ -52,10 +52,10 @@
|
|
|
52
52
|
"typecheck": "yarn run -BT nx typecheck"
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@typescript-eslint/project-service": "8.52.1-alpha.
|
|
56
|
-
"@typescript-eslint/tsconfig-utils": "8.52.1-alpha.
|
|
57
|
-
"@typescript-eslint/types": "8.52.1-alpha.
|
|
58
|
-
"@typescript-eslint/visitor-keys": "8.52.1-alpha.
|
|
55
|
+
"@typescript-eslint/project-service": "8.52.1-alpha.3",
|
|
56
|
+
"@typescript-eslint/tsconfig-utils": "8.52.1-alpha.3",
|
|
57
|
+
"@typescript-eslint/types": "8.52.1-alpha.3",
|
|
58
|
+
"@typescript-eslint/visitor-keys": "8.52.1-alpha.3",
|
|
59
59
|
"debug": "^4.4.3",
|
|
60
60
|
"minimatch": "^9.0.5",
|
|
61
61
|
"semver": "^7.7.3",
|