Skip to content
This repository was archived by the owner on Jan 19, 2019. It is now read-only.

Commit 59a37f4

Browse files
authored
Breaking: Updates to AST node types of some TSNodes (fixes #386) (#388)
1 parent 627355e commit 59a37f4

File tree

7 files changed

+3414
-228
lines changed

7 files changed

+3414
-228
lines changed

README.md

-1
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,3 @@ Issues and pull requests will be triaged and responded to as quickly as possible
7575
## License
7676

7777
TypeScript ESLint Parser is licensed under a permissive BSD 2-clause license.
78-

lib/ast-node-types.js

+4-6
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ module.exports = {
9797
ThisExpression: "ThisExpression",
9898
ThrowStatement: "ThrowStatement",
9999
TryStatement: "TryStatement",
100-
101100
/**
102101
* TS-prefixed nodes
103102
*/
@@ -140,17 +139,16 @@ module.exports = {
140139
TSStaticKeyword: "TSStaticKeyword",
141140
TSStringKeyword: "TSStringKeyword",
142141
TSSymbolKeyword: "TSSymbolKeyword",
142+
TSTypeAnnotation: "TSTypeAnnotation",
143143
TSTypeLiteral: "TSTypeLiteral",
144+
TSTypeParameter: "TSTypeParameter",
145+
TSTypeParameterDeclaration: "TSTypeParameterDeclaration",
146+
TSTypeParameterInstantiation: "TSTypeParameterInstantiation",
144147
TSTypePredicate: "TSTypePredicate",
145148
TSTypeReference: "TSTypeReference",
146149
TSUnionType: "TSUnionType",
147150
TSUndefinedKeyword: "TSUndefinedKeyword",
148151
TSVoidKeyword: "TSVoidKeyword",
149-
150-
TypeAnnotation: "TypeAnnotation",
151-
TypeParameter: "TypeParameter",
152-
TypeParameterDeclaration: "TypeParameterDeclaration",
153-
TypeParameterInstantiation: "TypeParameterInstantiation",
154152
UnaryExpression: "UnaryExpression",
155153
UpdateExpression: "UpdateExpression",
156154
VariableDeclaration: "VariableDeclaration",

lib/convert.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ module.exports = function convert(config) {
8989
const annotationStartCol = child.getFullStart() - 1;
9090
const loc = nodeUtils.getLocFor(annotationStartCol, child.end, ast);
9191
return {
92-
type: AST_NODE_TYPES.TypeAnnotation,
92+
type: AST_NODE_TYPES.TSTypeAnnotation,
9393
loc,
9494
range: [annotationStartCol, child.end],
9595
typeAnnotation: annotation
@@ -122,7 +122,7 @@ module.exports = function convert(config) {
122122
}
123123
}
124124
return {
125-
type: AST_NODE_TYPES.TypeParameterInstantiation,
125+
type: AST_NODE_TYPES.TSTypeParameterInstantiation,
126126
range: [
127127
start,
128128
end
@@ -167,7 +167,7 @@ module.exports = function convert(config) {
167167
const greaterThanToken = nodeUtils.findNextToken(lastTypeParameter, ast);
168168

169169
return {
170-
type: AST_NODE_TYPES.TypeParameterDeclaration,
170+
type: AST_NODE_TYPES.TSTypeParameterDeclaration,
171171
range: [
172172
firstTypeParameter.pos - 1,
173173
greaterThanToken.end
@@ -185,7 +185,7 @@ module.exports = function convert(config) {
185185
: typeParameter.default;
186186

187187
return {
188-
type: AST_NODE_TYPES.TypeParameter,
188+
type: AST_NODE_TYPES.TSTypeParameter,
189189
range: [
190190
typeParameter.getStart(),
191191
typeParameter.getEnd()

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
"license": "BSD-2-Clause",
2020
"devDependencies": {
2121
"babel-code-frame": "6.26.0",
22-
"babylon": "7.0.0-beta.24",
23-
"dedent": "^0.7.0",
24-
"eslint": "4.10.0",
22+
"babylon": "7.0.0-beta.34",
23+
"dedent": "0.7.0",
24+
"eslint": "4.13.0",
2525
"eslint-config-eslint": "4.0.0",
2626
"eslint-plugin-node": "5.2.1",
2727
"eslint-release": "0.10.3",

tests/lib/__snapshots__/tsx.js.snap

+2-2
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ Object {
159159
53,
160160
61,
161161
],
162-
"type": "TypeAnnotation",
162+
"type": "TSTypeAnnotation",
163163
"typeAnnotation": Object {
164164
"loc": Object {
165165
"end": Object {
@@ -526,7 +526,7 @@ Object {
526526
98,
527527
105,
528528
],
529-
"type": "TypeAnnotation",
529+
"type": "TSTypeAnnotation",
530530
"typeAnnotation": Object {
531531
"loc": Object {
532532
"end": Object {

0 commit comments

Comments
 (0)