Skip to content

Commit 8549146

Browse files
committed
more claude code fixes and tests
1 parent 0a181cf commit 8549146

File tree

5 files changed

+348
-1
lines changed

5 files changed

+348
-1
lines changed

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ export function tsPlugin(options?: {
430430
return (
431431
base.type === 'Identifier' &&
432432
base.name === 'async' &&
433-
this.lastTokEndLoc.column === base.end &&
433+
this.lastTokEnd === base.end &&
434434
!this.canInsertSemicolon() &&
435435
base.end - base.start === 5 &&
436436
base.start === this.potentialArrowAt
Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
{
2+
"type": "Program",
3+
"start": 0,
4+
"end": 73,
5+
"loc": {
6+
"start": {
7+
"line": 1,
8+
"column": 0
9+
},
10+
"end": {
11+
"line": 3,
12+
"column": 46
13+
}
14+
},
15+
"body": [
16+
{
17+
"type": "ImportDeclaration",
18+
"start": 0,
19+
"end": 25,
20+
"loc": {
21+
"start": {
22+
"line": 1,
23+
"column": 0
24+
},
25+
"end": {
26+
"line": 1,
27+
"column": 25
28+
}
29+
},
30+
"importKind": "value",
31+
"specifiers": [],
32+
"source": {
33+
"type": "Literal",
34+
"start": 15,
35+
"end": 25,
36+
"loc": {
37+
"start": {
38+
"line": 1,
39+
"column": 15
40+
},
41+
"end": {
42+
"line": 1,
43+
"column": 25
44+
}
45+
},
46+
"value": "./config",
47+
"raw": "'./config'"
48+
}
49+
},
50+
{
51+
"type": "VariableDeclaration",
52+
"start": 27,
53+
"end": 73,
54+
"loc": {
55+
"start": {
56+
"line": 3,
57+
"column": 0
58+
},
59+
"end": {
60+
"line": 3,
61+
"column": 46
62+
}
63+
},
64+
"declarations": [
65+
{
66+
"type": "VariableDeclarator",
67+
"start": 33,
68+
"end": 72,
69+
"loc": {
70+
"start": {
71+
"line": 3,
72+
"column": 6
73+
},
74+
"end": {
75+
"line": 3,
76+
"column": 45
77+
}
78+
},
79+
"id": {
80+
"type": "Identifier",
81+
"start": 33,
82+
"end": 52,
83+
"loc": {
84+
"start": {
85+
"line": 3,
86+
"column": 6
87+
},
88+
"end": {
89+
"line": 3,
90+
"column": 25
91+
}
92+
},
93+
"name": "loadDataWithGeneric"
94+
},
95+
"init": {
96+
"type": "ArrowFunctionExpression",
97+
"start": 55,
98+
"end": 72,
99+
"loc": {
100+
"start": {
101+
"line": 3,
102+
"column": 28
103+
},
104+
"end": {
105+
"line": 3,
106+
"column": 45
107+
}
108+
},
109+
"typeParameters": {
110+
"type": "TSTypeParameterDeclaration",
111+
"start": 61,
112+
"end": 64,
113+
"loc": {
114+
"start": {
115+
"line": 3,
116+
"column": 34
117+
},
118+
"end": {
119+
"line": 3,
120+
"column": 37
121+
}
122+
},
123+
"params": [
124+
{
125+
"type": "TSTypeParameter",
126+
"start": 62,
127+
"end": 63,
128+
"loc": {
129+
"start": {
130+
"line": 3,
131+
"column": 35
132+
},
133+
"end": {
134+
"line": 3,
135+
"column": 36
136+
}
137+
},
138+
"name": "T"
139+
}
140+
]
141+
},
142+
"params": [],
143+
"id": null,
144+
"expression": false,
145+
"generator": false,
146+
"async": true,
147+
"body": {
148+
"type": "BlockStatement",
149+
"start": 70,
150+
"end": 72,
151+
"loc": {
152+
"start": {
153+
"line": 3,
154+
"column": 43
155+
},
156+
"end": {
157+
"line": 3,
158+
"column": 45
159+
}
160+
},
161+
"body": []
162+
}
163+
}
164+
}
165+
],
166+
"kind": "const"
167+
}
168+
],
169+
"sourceType": "module"
170+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import {} from './config'
2+
3+
const loadDataWithGeneric = async <T>() => {};
Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
{
2+
"type": "Program",
3+
"start": 0,
4+
"end": 128,
5+
"loc": {
6+
"start": {
7+
"line": 1,
8+
"column": 0
9+
},
10+
"end": {
11+
"line": 4,
12+
"column": 46
13+
}
14+
},
15+
"body": [
16+
{
17+
"type": "ImportDeclaration",
18+
"start": 55,
19+
"end": 80,
20+
"loc": {
21+
"start": {
22+
"line": 2,
23+
"column": 0
24+
},
25+
"end": {
26+
"line": 2,
27+
"column": 25
28+
}
29+
},
30+
"importKind": "value",
31+
"specifiers": [],
32+
"source": {
33+
"type": "Literal",
34+
"start": 70,
35+
"end": 80,
36+
"loc": {
37+
"start": {
38+
"line": 2,
39+
"column": 15
40+
},
41+
"end": {
42+
"line": 2,
43+
"column": 25
44+
}
45+
},
46+
"value": "./config",
47+
"raw": "'./config'"
48+
}
49+
},
50+
{
51+
"type": "VariableDeclaration",
52+
"start": 82,
53+
"end": 128,
54+
"loc": {
55+
"start": {
56+
"line": 4,
57+
"column": 0
58+
},
59+
"end": {
60+
"line": 4,
61+
"column": 46
62+
}
63+
},
64+
"declarations": [
65+
{
66+
"type": "VariableDeclarator",
67+
"start": 88,
68+
"end": 127,
69+
"loc": {
70+
"start": {
71+
"line": 4,
72+
"column": 6
73+
},
74+
"end": {
75+
"line": 4,
76+
"column": 45
77+
}
78+
},
79+
"id": {
80+
"type": "Identifier",
81+
"start": 88,
82+
"end": 107,
83+
"loc": {
84+
"start": {
85+
"line": 4,
86+
"column": 6
87+
},
88+
"end": {
89+
"line": 4,
90+
"column": 25
91+
}
92+
},
93+
"name": "loadDataWithGeneric"
94+
},
95+
"init": {
96+
"type": "ArrowFunctionExpression",
97+
"start": 110,
98+
"end": 127,
99+
"loc": {
100+
"start": {
101+
"line": 4,
102+
"column": 28
103+
},
104+
"end": {
105+
"line": 4,
106+
"column": 45
107+
}
108+
},
109+
"typeParameters": {
110+
"type": "TSTypeParameterDeclaration",
111+
"start": 116,
112+
"end": 119,
113+
"loc": {
114+
"start": {
115+
"line": 4,
116+
"column": 34
117+
},
118+
"end": {
119+
"line": 4,
120+
"column": 37
121+
}
122+
},
123+
"params": [
124+
{
125+
"type": "TSTypeParameter",
126+
"start": 117,
127+
"end": 118,
128+
"loc": {
129+
"start": {
130+
"line": 4,
131+
"column": 35
132+
},
133+
"end": {
134+
"line": 4,
135+
"column": 36
136+
}
137+
},
138+
"name": "T"
139+
}
140+
]
141+
},
142+
"params": [],
143+
"id": null,
144+
"expression": false,
145+
"generator": false,
146+
"async": true,
147+
"body": {
148+
"type": "BlockStatement",
149+
"start": 125,
150+
"end": 127,
151+
"loc": {
152+
"start": {
153+
"line": 4,
154+
"column": 43
155+
},
156+
"end": {
157+
"line": 4,
158+
"column": 45
159+
}
160+
},
161+
"body": []
162+
}
163+
}
164+
}
165+
],
166+
"kind": "const"
167+
}
168+
],
169+
"sourceType": "module"
170+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// removing the comment below yields a different error
2+
import {} from './config'
3+
4+
const loadDataWithGeneric = async <T>() => {};

0 commit comments

Comments
 (0)