Skip to content

Commit

Permalink
refactor(ts-estree): simply convertToken and remove dead code (#273)
Browse files Browse the repository at this point in the history
  • Loading branch information
armano2 committed Feb 14, 2019
1 parent 859ab29 commit 1464696
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
17 changes: 5 additions & 12 deletions packages/typescript-estree/src/node-utils.ts
Expand Up @@ -579,24 +579,17 @@ export function getTokenType(token: any): AST_TOKEN_TYPES {
}

// Some JSX tokens have to be determined based on their parent
if (token.parent) {
if (token.parent && token.kind === SyntaxKind.Identifier) {
if (isJSXToken(token.parent)) {
return AST_TOKEN_TYPES.JSXIdentifier;
}

if (
token.kind === SyntaxKind.Identifier &&
token.parent.kind === SyntaxKind.PropertyAccessExpression &&
hasJSXAncestor(token)
) {
return AST_TOKEN_TYPES.JSXIdentifier;
}

if (isJSXToken(token.parent)) {
if (token.kind === SyntaxKind.PropertyAccessExpression) {
return AST_TOKEN_TYPES.JSXMemberExpression;
}

if (token.kind === SyntaxKind.Identifier) {
return AST_TOKEN_TYPES.JSXIdentifier;
}
}
}

return AST_TOKEN_TYPES.Identifier;
Expand Down
1 change: 0 additions & 1 deletion packages/typescript-estree/src/ts-estree/ast-node-types.ts
Expand Up @@ -174,7 +174,6 @@ export enum AST_TOKEN_TYPES {
Boolean = 'Boolean',
Identifier = 'Identifier',
JSXIdentifier = 'JSXIdentifier',
JSXMemberExpression = 'JSXMemberExpression',
JSXText = 'JSXText',
Keyword = 'Keyword',
Null = 'Null',
Expand Down

0 comments on commit 1464696

Please sign in to comment.