@typescript-eslint/typescript-estree 8.51.1-alpha.6 → 8.51.1-alpha.8

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.
@@ -42,14 +42,204 @@ function checkSyntaxError(tsNode) {
42
42
  (0, check_modifiers_1.checkModifiers)(tsNode);
43
43
  const node = tsNode;
44
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;
45
237
  case SyntaxKind.ForInStatement:
46
238
  case SyntaxKind.ForOfStatement: {
47
239
  checkForStatementDeclaration(node);
48
240
  break;
49
241
  }
50
- default: {
51
- break;
52
- }
242
+ // No default
53
243
  }
54
244
  }
55
245
  function checkForStatementDeclaration(node) {
package/dist/convert.js CHANGED
@@ -557,9 +557,6 @@ class Converter {
557
557
  test: this.convertChild(node.expression),
558
558
  });
559
559
  case SyntaxKind.SwitchStatement:
560
- if (node.caseBlock.clauses.filter(switchCase => switchCase.kind === SyntaxKind.DefaultClause).length > 1) {
561
- this.#throwError(node, "A 'default' clause cannot appear more than once in a 'switch' statement.");
562
- }
563
560
  return this.createNode(node, {
564
561
  type: ts_estree_1.AST_NODE_TYPES.SwitchStatement,
565
562
  cases: this.convertChildren(node.caseBlock.clauses),
@@ -577,9 +574,6 @@ class Converter {
577
574
  });
578
575
  // Exceptions
579
576
  case SyntaxKind.ThrowStatement:
580
- if (node.expression.end === node.expression.pos) {
581
- this.#throwError(node, 'A throw statement must throw an expression.');
582
- }
583
577
  return this.createNode(node, {
584
578
  type: ts_estree_1.AST_NODE_TYPES.ThrowStatement,
585
579
  argument: this.convertChild(node.expression),
@@ -592,9 +586,6 @@ class Converter {
592
586
  handler: this.convertChild(node.catchClause),
593
587
  });
594
588
  case SyntaxKind.CatchClause:
595
- if (node.variableDeclaration?.initializer) {
596
- this.#throwError(node.variableDeclaration.initializer, 'Catch clause variable cannot have an initializer.');
597
- }
598
589
  return this.createNode(node, {
599
590
  type: ts_estree_1.AST_NODE_TYPES.CatchClause,
600
591
  body: this.convertChild(node.block),
@@ -648,20 +639,6 @@ class Converter {
648
639
  const isDeclare = (0, node_utils_1.hasModifier)(SyntaxKind.DeclareKeyword, node);
649
640
  const isAsync = (0, node_utils_1.hasModifier)(SyntaxKind.AsyncKeyword, node);
650
641
  const isGenerator = !!node.asteriskToken;
651
- if (isDeclare) {
652
- if (node.body) {
653
- this.#throwError(node, 'An implementation cannot be declared in ambient contexts.');
654
- }
655
- else if (isAsync) {
656
- this.#throwError(node, "'async' modifier cannot be used in an ambient context.");
657
- }
658
- else if (isGenerator) {
659
- this.#throwError(node, 'Generators are not allowed in an ambient context.');
660
- }
661
- }
662
- else if (!node.body && isGenerator) {
663
- this.#throwError(node, 'A function signature cannot be declared as a generator.');
664
- }
665
642
  const result = this.createNode(node, {
666
643
  // declare implies no body due to the invariant above
667
644
  type: !node.body
@@ -682,60 +659,6 @@ class Converter {
682
659
  }
683
660
  case SyntaxKind.VariableDeclaration: {
684
661
  const hasExclamationToken = !!node.exclamationToken;
685
- if (hasExclamationToken) {
686
- if (node.initializer) {
687
- this.#throwError(node, 'Declarations with initializers cannot also have definite assignment assertions.');
688
- }
689
- else if (node.name.kind !== SyntaxKind.Identifier || !node.type) {
690
- this.#throwError(node, 'Declarations with definite assignment assertions must also have type annotations.');
691
- }
692
- }
693
- if (node.parent.kind === SyntaxKind.VariableDeclarationList) {
694
- const variableDeclarationList = node.parent;
695
- const kind = (0, node_utils_1.getDeclarationKind)(variableDeclarationList);
696
- if ((variableDeclarationList.parent.kind ===
697
- SyntaxKind.ForInStatement ||
698
- variableDeclarationList.parent.kind ===
699
- SyntaxKind.ForStatement) &&
700
- (kind === 'using' || kind === 'await using')) {
701
- if (!node.initializer) {
702
- this.#throwError(node, `'${kind}' declarations may not be initialized in for statement.`);
703
- }
704
- if (node.name.kind !== SyntaxKind.Identifier) {
705
- this.#throwError(node.name, `'${kind}' declarations may not have binding patterns.`);
706
- }
707
- }
708
- if (variableDeclarationList.parent.kind === SyntaxKind.VariableStatement) {
709
- const variableStatement = variableDeclarationList.parent;
710
- if (kind === 'using' || kind === 'await using') {
711
- if (!node.initializer) {
712
- this.#throwError(node, `'${kind}' declarations must be initialized.`);
713
- }
714
- if (node.name.kind !== SyntaxKind.Identifier) {
715
- this.#throwError(node.name, `'${kind}' declarations may not have binding patterns.`);
716
- }
717
- }
718
- const hasDeclareKeyword = (0, node_utils_1.hasModifier)(SyntaxKind.DeclareKeyword, variableStatement);
719
- // Definite assignment only allowed for non-declare let and var
720
- if ((hasDeclareKeyword ||
721
- ['await using', 'const', 'using'].includes(kind)) &&
722
- hasExclamationToken) {
723
- this.#throwError(node, `A definite assignment assertion '!' is not permitted in this context.`);
724
- }
725
- if (hasDeclareKeyword &&
726
- node.initializer &&
727
- (['let', 'var'].includes(kind) || node.type)) {
728
- this.#throwError(node, `Initializers are not permitted in ambient contexts.`);
729
- }
730
- // Theoretically, only certain initializers are allowed for declare const,
731
- // (TS1254: A 'const' initializer in an ambient context must be a string
732
- // or numeric literal or literal enum reference.) but we just allow
733
- // all expressions
734
- // Note! No-declare does not mean the variable is not ambient, because
735
- // it can be further nested in other declare contexts. Therefore we cannot
736
- // check for const initializers.
737
- }
738
- }
739
662
  const init = this.convertChild(node.initializer);
740
663
  const id = this.convertBindingNameWithTypeAnnotation(node.name, node.type, node);
741
664
  return this.createNode(node, {
@@ -747,9 +670,6 @@ class Converter {
747
670
  }
748
671
  case SyntaxKind.VariableStatement: {
749
672
  const declarations = node.declarationList.declarations;
750
- if (!declarations.length) {
751
- this.#throwError(node, 'A variable declaration list must have at least one variable declarator.');
752
- }
753
673
  const result = this.createNode(node, {
754
674
  type: ts_estree_1.AST_NODE_TYPES.VariableDeclaration,
755
675
  declarations: this.convertChildren(declarations),
@@ -828,14 +748,6 @@ class Converter {
828
748
  });
829
749
  }
830
750
  case SyntaxKind.PropertyAssignment: {
831
- // eslint-disable-next-line @typescript-eslint/no-deprecated
832
- const { exclamationToken, questionToken } = node;
833
- if (questionToken) {
834
- this.#throwError(questionToken, 'A property assignment cannot have a question token.');
835
- }
836
- if (exclamationToken) {
837
- this.#throwError(exclamationToken, 'A property assignment cannot have an exclamation token.');
838
- }
839
751
  return this.createNode(node, {
840
752
  type: ts_estree_1.AST_NODE_TYPES.Property,
841
753
  computed: (0, node_utils_1.isComputedProperty)(node.name),
@@ -848,17 +760,6 @@ class Converter {
848
760
  });
849
761
  }
850
762
  case SyntaxKind.ShorthandPropertyAssignment: {
851
- // eslint-disable-next-line @typescript-eslint/no-deprecated
852
- const { exclamationToken, modifiers, questionToken } = node;
853
- if (modifiers) {
854
- this.#throwError(modifiers[0], 'A shorthand property assignment cannot have modifiers.');
855
- }
856
- if (questionToken) {
857
- this.#throwError(questionToken, 'A shorthand property assignment cannot have a question token.');
858
- }
859
- if (exclamationToken) {
860
- this.#throwError(exclamationToken, 'A shorthand property assignment cannot have an exclamation token.');
861
- }
862
763
  if (node.objectAssignmentInitializer) {
863
764
  return this.createNode(node, {
864
765
  type: ts_estree_1.AST_NODE_TYPES.Property,
@@ -893,13 +794,6 @@ class Converter {
893
794
  return this.convertChild(node.expression);
894
795
  case SyntaxKind.PropertyDeclaration: {
895
796
  const isAbstract = (0, node_utils_1.hasModifier)(SyntaxKind.AbstractKeyword, node);
896
- if (isAbstract && node.initializer) {
897
- this.#throwError(node.initializer, `Abstract property cannot have an initializer.`);
898
- }
899
- if (node.name.kind === SyntaxKind.StringLiteral &&
900
- node.name.text === 'constructor') {
901
- this.#throwError(node.name, "Classes may not have a field named 'constructor'.");
902
- }
903
797
  const isAccessor = (0, node_utils_1.hasModifier)(SyntaxKind.AccessorKeyword, node);
904
798
  const type = (() => {
905
799
  if (isAccessor) {
@@ -1232,9 +1126,6 @@ class Converter {
1232
1126
  return result;
1233
1127
  }
1234
1128
  case SyntaxKind.TaggedTemplateExpression: {
1235
- if (node.tag.flags & ts.NodeFlags.OptionalChain) {
1236
- this.#throwError(node, 'Tagged template expressions are not permitted in an optional chain.');
1237
- }
1238
1129
  return this.createNode(node, {
1239
1130
  type: ts_estree_1.AST_NODE_TYPES.TaggedTemplateExpression,
1240
1131
  quasi: this.convertChild(node.template),
@@ -1335,12 +1226,6 @@ class Converter {
1335
1226
  }
1336
1227
  // Classes
1337
1228
  case SyntaxKind.ClassDeclaration:
1338
- if (!node.name &&
1339
- (!(0, node_utils_1.hasModifier)(ts.SyntaxKind.ExportKeyword, node) ||
1340
- !(0, node_utils_1.hasModifier)(ts.SyntaxKind.DefaultKeyword, node))) {
1341
- this.#throwError(node, "A class declaration without the 'default' modifier must have a name.");
1342
- }
1343
- /* intentional fallthrough */
1344
1229
  case SyntaxKind.ClassExpression: {
1345
1230
  const heritageClauses = node.heritageClauses ?? [];
1346
1231
  const classNodeType = node.kind === SyntaxKind.ClassDeclaration
@@ -1558,13 +1443,6 @@ class Converter {
1558
1443
  });
1559
1444
  // Binary Operations
1560
1445
  case SyntaxKind.BinaryExpression: {
1561
- if (node.operatorToken.kind !== SyntaxKind.InKeyword &&
1562
- node.left.kind === SyntaxKind.PrivateIdentifier) {
1563
- this.#throwError(node.left, "Private identifiers cannot appear on the right-hand-side of an 'in' expression.");
1564
- }
1565
- else if (node.right.kind === SyntaxKind.PrivateIdentifier) {
1566
- this.#throwError(node.right, "Private identifiers are only allowed on the left-hand-side of an 'in' expression.");
1567
- }
1568
1446
  // TypeScript uses BinaryExpression for sequences as well
1569
1447
  if ((0, node_utils_1.isComma)(node.operatorToken)) {
1570
1448
  const result = this.createNode(node, {
@@ -1962,9 +1840,6 @@ class Converter {
1962
1840
  this.convertTypeArgumentsToTypeParameterInstantiation(node.typeArguments, node),
1963
1841
  });
1964
1842
  case SyntaxKind.MappedType: {
1965
- if (node.members && node.members.length > 0) {
1966
- this.#throwError(node.members[0], 'A mapped type may not declare properties or methods.');
1967
- }
1968
1843
  return this.createNode(node, this.#withDeprecatedGetter({
1969
1844
  type: ts_estree_1.AST_NODE_TYPES.TSMappedType,
1970
1845
  constraint: this.convertChild(node.typeParameter.constraint),
@@ -1998,11 +1873,6 @@ class Converter {
1998
1873
  return this.convertMethodSignature(node);
1999
1874
  }
2000
1875
  case SyntaxKind.PropertySignature: {
2001
- // eslint-disable-next-line @typescript-eslint/no-deprecated
2002
- const { initializer } = node;
2003
- if (initializer) {
2004
- this.#throwError(initializer, 'A property signature cannot have an initializer.');
2005
- }
2006
1876
  return this.createNode(node, {
2007
1877
  type: ts_estree_1.AST_NODE_TYPES.TSPropertySignature,
2008
1878
  accessibility: (0, node_utils_1.getTSNodeAccessibility)(node),
@@ -2034,14 +1904,7 @@ class Converter {
2034
1904
  this.convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters),
2035
1905
  });
2036
1906
  }
2037
- case SyntaxKind.FunctionType: {
2038
- // eslint-disable-next-line @typescript-eslint/no-deprecated
2039
- const { modifiers } = node;
2040
- if (modifiers) {
2041
- this.#throwError(modifiers[0], 'A function type cannot have modifiers.');
2042
- }
2043
- }
2044
- // intentional fallthrough
1907
+ case SyntaxKind.FunctionType:
2045
1908
  case SyntaxKind.ConstructSignature:
2046
1909
  case SyntaxKind.CallSignature: {
2047
1910
  const type = node.kind === SyntaxKind.ConstructSignature
@@ -2222,13 +2085,6 @@ class Converter {
2222
2085
  }
2223
2086
  case SyntaxKind.EnumMember: {
2224
2087
  const computed = node.name.kind === ts.SyntaxKind.ComputedPropertyName;
2225
- if (computed) {
2226
- this.#throwError(node.name, 'Computed property names are not allowed in enums.');
2227
- }
2228
- if (node.name.kind === SyntaxKind.NumericLiteral ||
2229
- node.name.kind === SyntaxKind.BigIntLiteral) {
2230
- this.#throwError(node.name, 'An enum member cannot have a numeric name.');
2231
- }
2232
2088
  return this.createNode(node, this.#withDeprecatedGetter({
2233
2089
  type: ts_estree_1.AST_NODE_TYPES.TSEnumMember,
2234
2090
  id: this.convertChild(node.name),
@@ -2382,9 +2238,6 @@ class Converter {
2382
2238
  }));
2383
2239
  }
2384
2240
  case SyntaxKind.ExternalModuleReference: {
2385
- if (node.expression.kind !== SyntaxKind.StringLiteral) {
2386
- this.#throwError(node.expression, 'String literal expected.');
2387
- }
2388
2241
  return this.createNode(node, {
2389
2242
  type: ts_estree_1.AST_NODE_TYPES.TSExternalModuleReference,
2390
2243
  expression: this.convertChild(node.expression),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typescript-eslint/typescript-estree",
3
- "version": "8.51.1-alpha.6",
3
+ "version": "8.51.1-alpha.8",
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.51.1-alpha.6",
56
- "@typescript-eslint/tsconfig-utils": "8.51.1-alpha.6",
57
- "@typescript-eslint/types": "8.51.1-alpha.6",
58
- "@typescript-eslint/visitor-keys": "8.51.1-alpha.6",
55
+ "@typescript-eslint/project-service": "8.51.1-alpha.8",
56
+ "@typescript-eslint/tsconfig-utils": "8.51.1-alpha.8",
57
+ "@typescript-eslint/types": "8.51.1-alpha.8",
58
+ "@typescript-eslint/visitor-keys": "8.51.1-alpha.8",
59
59
  "debug": "^4.4.3",
60
60
  "minimatch": "^9.0.5",
61
61
  "semver": "^7.7.3",