Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3491b4b

Browse filesBrowse files
azzJamesHenry
authored andcommitted
Fix: Replace JSXMemberExpression with TSQualifiedName (fixes eslint#257) (eslint#258)
1 parent b4eb0b5 commit 3491b4b
Copy full SHA for 3491b4b

File tree

Expand file treeCollapse file tree

4 files changed

+367
-11
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+367
-11
lines changed

‎lib/ast-node-types.js

Copy file name to clipboardExpand all lines: lib/ast-node-types.js
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ module.exports = {
118118
TSNumberKeyword: "TSNumberKeyword",
119119
TSParameterProperty: "TSParameterProperty",
120120
TSPropertySignature: "TSPropertySignature",
121+
TSQualifiedName: "TSQualifiedName",
121122
TSQuestionToken: "TSQuestionToken",
122123
TSStringKeyword: "TSStringKeyword",
123124
TSTypeLiteral: "TSTypeLiteral",

‎lib/convert.js

Copy file name to clipboardExpand all lines: lib/convert.js
+3-11Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1638,18 +1638,10 @@ module.exports = function convert(config) {
16381638
break;
16391639

16401640
case SyntaxKind.FirstNode: {
1641-
const jsxMemberExpressionObject = convertChild(node.left);
1642-
jsxMemberExpressionObject.type = AST_NODE_TYPES.JSXIdentifier;
1643-
delete jsxMemberExpressionObject.value;
1644-
1645-
const jsxMemberExpressionProperty = convertChild(node.right);
1646-
jsxMemberExpressionProperty.type = AST_NODE_TYPES.JSXIdentifier;
1647-
delete jsxMemberExpressionObject.value;
1648-
16491641
Object.assign(result, {
1650-
type: AST_NODE_TYPES.JSXMemberExpression,
1651-
object: jsxMemberExpressionObject,
1652-
property: jsxMemberExpressionProperty
1642+
type: AST_NODE_TYPES.TSQualifiedName,
1643+
left: convertChild(node.left),
1644+
right: convertChild(node.right)
16531645
});
16541646

16551647
break;
+362Lines changed: 362 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,362 @@
1+
module.exports = {
2+
"type": "Program",
3+
"range": [
4+
0,
5+
15
6+
],
7+
"loc": {
8+
"start": {
9+
"line": 1,
10+
"column": 0
11+
},
12+
"end": {
13+
"line": 1,
14+
"column": 15
15+
}
16+
},
17+
"body": [
18+
{
19+
"type": "VariableDeclaration",
20+
"range": [
21+
0,
22+
15
23+
],
24+
"loc": {
25+
"start": {
26+
"line": 1,
27+
"column": 0
28+
},
29+
"end": {
30+
"line": 1,
31+
"column": 15
32+
}
33+
},
34+
"declarations": [
35+
{
36+
"type": "VariableDeclarator",
37+
"range": [
38+
4,
39+
14
40+
],
41+
"loc": {
42+
"start": {
43+
"line": 1,
44+
"column": 4
45+
},
46+
"end": {
47+
"line": 1,
48+
"column": 14
49+
}
50+
},
51+
"id": {
52+
"type": "Identifier",
53+
"range": [
54+
4,
55+
7
56+
],
57+
"loc": {
58+
"start": {
59+
"line": 1,
60+
"column": 4
61+
},
62+
"end": {
63+
"line": 1,
64+
"column": 7
65+
}
66+
},
67+
"name": "foo",
68+
"typeAnnotation": {
69+
"type": "TypeAnnotation",
70+
"loc": {
71+
"start": {
72+
"line": 1,
73+
"column": 9
74+
},
75+
"end": {
76+
"line": 1,
77+
"column": 14
78+
}
79+
},
80+
"range": [
81+
9,
82+
14
83+
],
84+
"typeAnnotation": {
85+
"type": "TSTypeReference",
86+
"range": [
87+
9,
88+
14
89+
],
90+
"loc": {
91+
"start": {
92+
"line": 1,
93+
"column": 9
94+
},
95+
"end": {
96+
"line": 1,
97+
"column": 14
98+
}
99+
},
100+
"typeName": {
101+
"type": "TSQualifiedName",
102+
"range": [
103+
9,
104+
14
105+
],
106+
"loc": {
107+
"start": {
108+
"line": 1,
109+
"column": 9
110+
},
111+
"end": {
112+
"line": 1,
113+
"column": 14
114+
}
115+
},
116+
"left": {
117+
"type": "TSQualifiedName",
118+
"range": [
119+
9,
120+
12
121+
],
122+
"loc": {
123+
"start": {
124+
"line": 1,
125+
"column": 9
126+
},
127+
"end": {
128+
"line": 1,
129+
"column": 12
130+
}
131+
},
132+
"left": {
133+
"type": "Identifier",
134+
"range": [
135+
9,
136+
10
137+
],
138+
"loc": {
139+
"start": {
140+
"line": 1,
141+
"column": 9
142+
},
143+
"end": {
144+
"line": 1,
145+
"column": 10
146+
}
147+
},
148+
"name": "A"
149+
},
150+
"right": {
151+
"type": "Identifier",
152+
"range": [
153+
11,
154+
12
155+
],
156+
"loc": {
157+
"start": {
158+
"line": 1,
159+
"column": 11
160+
},
161+
"end": {
162+
"line": 1,
163+
"column": 12
164+
}
165+
},
166+
"name": "B"
167+
}
168+
},
169+
"right": {
170+
"type": "Identifier",
171+
"range": [
172+
13,
173+
14
174+
],
175+
"loc": {
176+
"start": {
177+
"line": 1,
178+
"column": 13
179+
},
180+
"end": {
181+
"line": 1,
182+
"column": 14
183+
}
184+
},
185+
"name": "C"
186+
}
187+
}
188+
}
189+
}
190+
},
191+
"init": null
192+
}
193+
],
194+
"kind": "var"
195+
}
196+
],
197+
"sourceType": "script",
198+
"tokens": [
199+
{
200+
"type": "Keyword",
201+
"value": "var",
202+
"range": [
203+
0,
204+
3
205+
],
206+
"loc": {
207+
"start": {
208+
"line": 1,
209+
"column": 0
210+
},
211+
"end": {
212+
"line": 1,
213+
"column": 3
214+
}
215+
}
216+
},
217+
{
218+
"type": "Identifier",
219+
"value": "foo",
220+
"range": [
221+
4,
222+
7
223+
],
224+
"loc": {
225+
"start": {
226+
"line": 1,
227+
"column": 4
228+
},
229+
"end": {
230+
"line": 1,
231+
"column": 7
232+
}
233+
}
234+
},
235+
{
236+
"type": "Punctuator",
237+
"value": ":",
238+
"range": [
239+
7,
240+
8
241+
],
242+
"loc": {
243+
"start": {
244+
"line": 1,
245+
"column": 7
246+
},
247+
"end": {
248+
"line": 1,
249+
"column": 8
250+
}
251+
}
252+
},
253+
{
254+
"type": "Identifier",
255+
"value": "A",
256+
"range": [
257+
9,
258+
10
259+
],
260+
"loc": {
261+
"start": {
262+
"line": 1,
263+
"column": 9
264+
},
265+
"end": {
266+
"line": 1,
267+
"column": 10
268+
}
269+
}
270+
},
271+
{
272+
"type": "Punctuator",
273+
"value": ".",
274+
"range": [
275+
10,
276+
11
277+
],
278+
"loc": {
279+
"start": {
280+
"line": 1,
281+
"column": 10
282+
},
283+
"end": {
284+
"line": 1,
285+
"column": 11
286+
}
287+
}
288+
},
289+
{
290+
"type": "Identifier",
291+
"value": "B",
292+
"range": [
293+
11,
294+
12
295+
],
296+
"loc": {
297+
"start": {
298+
"line": 1,
299+
"column": 11
300+
},
301+
"end": {
302+
"line": 1,
303+
"column": 12
304+
}
305+
}
306+
},
307+
{
308+
"type": "Punctuator",
309+
"value": ".",
310+
"range": [
311+
12,
312+
13
313+
],
314+
"loc": {
315+
"start": {
316+
"line": 1,
317+
"column": 12
318+
},
319+
"end": {
320+
"line": 1,
321+
"column": 13
322+
}
323+
}
324+
},
325+
{
326+
"type": "Identifier",
327+
"value": "C",
328+
"range": [
329+
13,
330+
14
331+
],
332+
"loc": {
333+
"start": {
334+
"line": 1,
335+
"column": 13
336+
},
337+
"end": {
338+
"line": 1,
339+
"column": 14
340+
}
341+
}
342+
},
343+
{
344+
"type": "Punctuator",
345+
"value": ";",
346+
"range": [
347+
14,
348+
15
349+
],
350+
"loc": {
351+
"start": {
352+
"line": 1,
353+
"column": 14
354+
},
355+
"end": {
356+
"line": 1,
357+
"column": 15
358+
}
359+
}
360+
}
361+
]
362+
};
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
var foo: A.B.C;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.