8000 refactor(ts-estree): simply convertToken and remove dead code by armano2 · Pull Request #273 · typescript-eslint/typescript-eslint · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 5 additions & 12 deletions packages/typescript-estree/src/node-utils.ts
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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