Skip to content

Commit 1464696

Browse files
authored
refactor(ts-estree): simply convertToken and remove dead code (typescript-eslint#273)
1 parent 859ab29 commit 1464696

File tree

2 files changed

+5
-13
lines changed

2 files changed

+5
-13
lines changed

packages/typescript-estree/src/node-utils.ts

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -579,24 +579,17 @@ export function getTokenType(token: any): AST_TOKEN_TYPES {
579579
}
580580

581581
// Some JSX tokens have to be determined based on their parent
582-
if (token.parent) {
582+
if (token.parent && token.kind === SyntaxKind.Identifier) {
583+
if (isJSXToken(token.parent)) {
584+
return AST_TOKEN_TYPES.JSXIdentifier;
585+
}
586+
583587
if (
584-
token.kind === SyntaxKind.Identifier &&
585588
token.parent.kind === SyntaxKind.PropertyAccessExpression &&
586589
hasJSXAncestor(token)
587590
) {
588591
return AST_TOKEN_TYPES.JSXIdentifier;
589592
}
590-
591-
if (isJSXToken(token.parent)) {
592-
if (token.kind === SyntaxKind.PropertyAccessExpression) {
593-
return AST_TOKEN_TYPES.JSXMemberExpression;
594-
}
595-
596-
if (token.kind === SyntaxKind.Identifier) {
597-
return AST_TOKEN_TYPES.JSXIdentifier;
598-
}
599-
}
600593
}
601594

602595
return AST_TOKEN_TYPES.Identifier;

packages/typescript-estree/src/ts-estree/ast-node-types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@ export enum AST_TOKEN_TYPES {
174174
Boolean = 'Boolean',
175175
Identifier = 'Identifier',
176176
JSXIdentifier = 'JSXIdentifier',
177-
JSXMemberExpression = 'JSXMemberExpression',
178177
JSXText = 'JSXText',
179178
Keyword = 'Keyword',
180179
Null = 'Null',

0 commit comments

Comments
 (0)