@typescript-eslint/typescript-estree 8.45.1-alpha.11 → 8.45.1-alpha.12
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/convert.js +15 -1
- package/dist/node-utils.d.ts +1 -0
- package/dist/node-utils.js +6 -0
- package/package.json +5 -5
package/dist/convert.js
CHANGED
|
@@ -985,6 +985,13 @@ class Converter {
|
|
|
985
985
|
}
|
|
986
986
|
// otherwise, it is a non-type accessor - intentional fallthrough
|
|
987
987
|
case SyntaxKind.MethodDeclaration: {
|
|
988
|
+
const isAbstract = (0, node_utils_1.hasModifier)(SyntaxKind.AbstractKeyword, node);
|
|
989
|
+
if (isAbstract && node.body) {
|
|
990
|
+
this.#throwError(node.name, node.kind === SyntaxKind.GetAccessor ||
|
|
991
|
+
node.kind === SyntaxKind.SetAccessor
|
|
992
|
+
? 'An abstract accessor cannot have an implementation.'
|
|
993
|
+
: `Method '${(0, node_utils_1.declarationNameToString)(node.name, this.ast)}' cannot have an implementation because it is marked abstract.`);
|
|
994
|
+
}
|
|
988
995
|
const method = this.createNode(node, {
|
|
989
996
|
type: !node.body
|
|
990
997
|
? ts_estree_1.AST_NODE_TYPES.TSEmptyBodyFunctionExpression
|
|
@@ -1027,7 +1034,7 @@ class Converter {
|
|
|
1027
1034
|
/**
|
|
1028
1035
|
* TypeScript class methods can be defined as "abstract"
|
|
1029
1036
|
*/
|
|
1030
|
-
const methodDefinitionType =
|
|
1037
|
+
const methodDefinitionType = isAbstract
|
|
1031
1038
|
? ts_estree_1.AST_NODE_TYPES.TSAbstractMethodDefinition
|
|
1032
1039
|
: ts_estree_1.AST_NODE_TYPES.MethodDefinition;
|
|
1033
1040
|
result = this.createNode(node, {
|
|
@@ -1594,6 +1601,13 @@ class Converter {
|
|
|
1594
1601
|
});
|
|
1595
1602
|
// Binary Operations
|
|
1596
1603
|
case SyntaxKind.BinaryExpression: {
|
|
1604
|
+
if (node.operatorToken.kind !== SyntaxKind.InKeyword &&
|
|
1605
|
+
node.left.kind === SyntaxKind.PrivateIdentifier) {
|
|
1606
|
+
this.#throwError(node.left, "Private identifiers cannot appear on the right-hand-side of an 'in' expression.");
|
|
1607
|
+
}
|
|
1608
|
+
else if (node.right.kind === SyntaxKind.PrivateIdentifier) {
|
|
1609
|
+
this.#throwError(node.right, "Private identifiers are only allowed on the left-hand-side of an 'in' expression.");
|
|
1610
|
+
}
|
|
1597
1611
|
// TypeScript uses BinaryExpression for sequences as well
|
|
1598
1612
|
if ((0, node_utils_1.isComma)(node.operatorToken)) {
|
|
1599
1613
|
const result = this.createNode(node, {
|
package/dist/node-utils.d.ts
CHANGED
|
@@ -182,4 +182,5 @@ export declare function isThisIdentifier(node: ts.Node | undefined): node is ts.
|
|
|
182
182
|
export declare function isThisInTypeQuery(node: ts.Node): boolean;
|
|
183
183
|
export declare function isValidAssignmentTarget(node: ts.Node): boolean;
|
|
184
184
|
export declare function getNamespaceModifiers(node: ts.ModuleDeclaration): ts.Modifier[] | undefined;
|
|
185
|
+
export declare function declarationNameToString(name: ts.Node, ast: ts.SourceFile): string;
|
|
185
186
|
export {};
|
package/dist/node-utils.js
CHANGED
|
@@ -69,6 +69,7 @@ exports.isThisIdentifier = isThisIdentifier;
|
|
|
69
69
|
exports.isThisInTypeQuery = isThisInTypeQuery;
|
|
70
70
|
exports.isValidAssignmentTarget = isValidAssignmentTarget;
|
|
71
71
|
exports.getNamespaceModifiers = getNamespaceModifiers;
|
|
72
|
+
exports.declarationNameToString = declarationNameToString;
|
|
72
73
|
const ts = __importStar(require("typescript"));
|
|
73
74
|
const getModifiers_1 = require("./getModifiers");
|
|
74
75
|
const xhtml_entities_1 = require("./jsx/xhtml-entities");
|
|
@@ -643,3 +644,8 @@ function getNamespaceModifiers(node) {
|
|
|
643
644
|
}
|
|
644
645
|
return modifiers;
|
|
645
646
|
}
|
|
647
|
+
// `ts.declarationNameToString`
|
|
648
|
+
function declarationNameToString(name, ast) {
|
|
649
|
+
const text = ast.text.slice(name.pos, name.end).trimStart();
|
|
650
|
+
return text || '(Missing)';
|
|
651
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@typescript-eslint/typescript-estree",
|
|
3
|
-
"version": "8.45.1-alpha.
|
|
3
|
+
"version": "8.45.1-alpha.12",
|
|
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.45.1-alpha.
|
|
56
|
-
"@typescript-eslint/tsconfig-utils": "8.45.1-alpha.
|
|
57
|
-
"@typescript-eslint/types": "8.45.1-alpha.
|
|
58
|
-
"@typescript-eslint/visitor-keys": "8.45.1-alpha.
|
|
55
|
+
"@typescript-eslint/project-service": "8.45.1-alpha.12",
|
|
56
|
+
"@typescript-eslint/tsconfig-utils": "8.45.1-alpha.12",
|
|
57
|
+
"@typescript-eslint/types": "8.45.1-alpha.12",
|
|
58
|
+
"@typescript-eslint/visitor-keys": "8.45.1-alpha.12",
|
|
59
59
|
"debug": "^4.3.4",
|
|
60
60
|
"fast-glob": "^3.3.2",
|
|
61
61
|
"is-glob": "^4.0.3",
|