Skip to content

Commit ebacc3b

Browse files
committed
chore: fix linter warnings
1 parent 11b38ca commit ebacc3b

1 file changed

Lines changed: 53 additions & 58 deletions

File tree

types/acorn-types.ts

Lines changed: 53 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -3,161 +3,161 @@
33
* These extend the base acorn types with the properties we need to access.
44
*/
55

6-
import type { Node, SourceLocation } from "acorn";
6+
import type { Node, SourceLocation } from 'acorn';
77

88
export interface BaseNode extends Node {
99
loc: SourceLocation;
1010
}
1111

1212
export interface Identifier extends BaseNode {
13-
type: "Identifier";
13+
type: 'Identifier';
1414
name: string;
1515
}
1616

1717
export interface VariableDeclarator extends BaseNode {
18-
type: "VariableDeclarator";
18+
type: 'VariableDeclarator';
1919
id: Identifier | Pattern;
2020
init?: Expression;
2121
}
2222

2323
export interface VariableDeclaration extends BaseNode {
24-
type: "VariableDeclaration";
24+
type: 'VariableDeclaration';
2525
declarations: VariableDeclarator[];
26-
kind: "const" | "let" | "var";
26+
kind: 'const' | 'let' | 'var';
2727
}
2828

2929
export interface BlockStatement extends BaseNode {
30-
type: "BlockStatement";
30+
type: 'BlockStatement';
3131
body: Statement[];
3232
}
3333

3434
export interface FunctionDeclaration extends BaseNode {
35-
type: "FunctionDeclaration";
35+
type: 'FunctionDeclaration';
3636
id: Identifier | null;
3737
params: Pattern[];
3838
body: BlockStatement;
3939
}
4040

4141
export interface FunctionExpression extends BaseNode {
42-
type: "FunctionExpression";
42+
type: 'FunctionExpression';
4343
id?: Identifier | null;
4444
params: Pattern[];
4545
body: BlockStatement;
4646
}
4747

4848
export interface ArrowFunctionExpression extends BaseNode {
49-
type: "ArrowFunctionExpression";
49+
type: 'ArrowFunctionExpression';
5050
params: Pattern[];
5151
body: BlockStatement | Expression;
5252
}
5353

5454
export interface ClassDeclaration extends BaseNode {
55-
type: "ClassDeclaration";
55+
type: 'ClassDeclaration';
5656
id: Identifier | null;
5757
body: ClassBody;
5858
}
5959

6060
export interface ClassExpression extends BaseNode {
61-
type: "ClassExpression";
61+
type: 'ClassExpression';
6262
id?: Identifier | null;
6363
body: ClassBody;
6464
}
6565

6666
export interface ClassBody extends BaseNode {
67-
type: "ClassBody";
67+
type: 'ClassBody';
6868
body: MethodDefinition[];
6969
}
7070

7171
export interface MethodDefinition extends BaseNode {
72-
type: "MethodDefinition";
72+
type: 'MethodDefinition';
7373
key: Identifier | Expression;
7474
value: FunctionExpression;
75-
kind: "constructor" | "method" | "get" | "set";
75+
kind: 'constructor' | 'method' | 'get' | 'set';
7676
static: boolean;
7777
}
7878

7979
export interface IfStatement extends BaseNode {
80-
type: "IfStatement";
80+
type: 'IfStatement';
8181
test: Expression;
8282
consequent: Statement;
8383
alternate?: Statement | null;
8484
}
8585

8686
export interface ForStatement extends BaseNode {
87-
type: "ForStatement";
87+
type: 'ForStatement';
8888
init?: VariableDeclaration | Expression | null;
8989
test?: Expression | null;
9090
update?: Expression | null;
9191
body: Statement;
9292
}
9393

9494
export interface ForInStatement extends BaseNode {
95-
type: "ForInStatement";
95+
type: 'ForInStatement';
9696
left: VariableDeclaration | Pattern;
9797
right: Expression;
9898
body: Statement;
9999
}
100100

101101
export interface ForOfStatement extends BaseNode {
102-
type: "ForOfStatement";
102+
type: 'ForOfStatement';
103103
left: VariableDeclaration | Pattern;
104104
right: Expression;
105105
body: Statement;
106106
}
107107

108108
export interface WhileStatement extends BaseNode {
109-
type: "WhileStatement";
109+
type: 'WhileStatement';
110110
test: Expression;
111111
body: Statement;
112112
}
113113

114114
export interface DoWhileStatement extends BaseNode {
115-
type: "DoWhileStatement";
115+
type: 'DoWhileStatement';
116116
body: Statement;
117117
test: Expression;
118118
}
119119

120120
export interface TryStatement extends BaseNode {
121-
type: "TryStatement";
121+
type: 'TryStatement';
122122
block: BlockStatement;
123123
handler?: CatchClause | null;
124124
finalizer?: BlockStatement | null;
125125
}
126126

127127
export interface CatchClause extends BaseNode {
128-
type: "CatchClause";
128+
type: 'CatchClause';
129129
param?: Pattern | null;
130130
body: BlockStatement;
131131
}
132132

133133
export interface SwitchStatement extends BaseNode {
134-
type: "SwitchStatement";
134+
type: 'SwitchStatement';
135135
discriminant: Expression;
136136
cases: SwitchCase[];
137137
}
138138

139139
export interface SwitchCase extends BaseNode {
140-
type: "SwitchCase";
140+
type: 'SwitchCase';
141141
test?: Expression | null;
142142
consequent: Statement[];
143143
}
144144

145145
export interface WithStatement extends BaseNode {
146-
type: "WithStatement";
146+
type: 'WithStatement';
147147
object: Expression;
148148
body: Statement;
149149
}
150150

151151
export interface NewExpression extends BaseNode {
152-
type: "NewExpression";
152+
type: 'NewExpression';
153153
callee: Expression | Identifier;
154154
arguments: Expression[];
155155
}
156156

157157
export interface Program extends BaseNode {
158-
type: "Program";
158+
type: 'Program';
159159
body: Statement[];
160-
sourceType: "script" | "module";
160+
sourceType: 'script' | 'module';
161161
}
162162

163163
// Union types for categories
@@ -199,136 +199,131 @@ export type Expression =
199199
| ObjectExpression
200200
| Literal;
201201

202-
export type Pattern =
203-
| Identifier
204-
| ObjectPattern
205-
| ArrayPattern
206-
| RestElement
207-
| AssignmentPattern;
202+
export type Pattern = Identifier | ObjectPattern | ArrayPattern | RestElement | AssignmentPattern;
208203

209204
// Additional types we reference but don't fully define
210205
export interface ExpressionStatement extends BaseNode {
211-
type: "ExpressionStatement";
206+
type: 'ExpressionStatement';
212207
expression: Expression;
213208
}
214209

215210
export interface ReturnStatement extends BaseNode {
216-
type: "ReturnStatement";
211+
type: 'ReturnStatement';
217212
argument?: Expression | null;
218213
}
219214

220215
export interface ThrowStatement extends BaseNode {
221-
type: "ThrowStatement";
216+
type: 'ThrowStatement';
222217
argument: Expression;
223218
}
224219

225220
export interface BreakStatement extends BaseNode {
226-
type: "BreakStatement";
221+
type: 'BreakStatement';
227222
label?: Identifier | null;
228223
}
229224

230225
export interface ContinueStatement extends BaseNode {
231-
type: "ContinueStatement";
226+
type: 'ContinueStatement';
232227
label?: Identifier | null;
233228
}
234229

235230
export interface CallExpression extends BaseNode {
236-
type: "CallExpression";
231+
type: 'CallExpression';
237232
callee: Expression;
238233
arguments: Expression[];
239234
}
240235

241236
export interface MemberExpression extends BaseNode {
242-
type: "MemberExpression";
237+
type: 'MemberExpression';
243238
object: Expression;
244239
property: Expression;
245240
computed: boolean;
246241
}
247242

248243
export interface AssignmentExpression extends BaseNode {
249-
type: "AssignmentExpression";
244+
type: 'AssignmentExpression';
250245
operator: string;
251246
left: Pattern | Expression;
252247
right: Expression;
253248
}
254249

255250
export interface BinaryExpression extends BaseNode {
256-
type: "BinaryExpression";
251+
type: 'BinaryExpression';
257252
operator: string;
258253
left: Expression;
259254
right: Expression;
260255
}
261256

262257
export interface UnaryExpression extends BaseNode {
263-
type: "UnaryExpression";
258+
type: 'UnaryExpression';
264259
operator: string;
265260
argument: Expression;
266261
prefix: boolean;
267262
}
268263

269264
export interface UpdateExpression extends BaseNode {
270-
type: "UpdateExpression";
271-
operator: "++" | "--";
265+
type: 'UpdateExpression';
266+
operator: '++' | '--';
272267
argument: Expression;
273268
prefix: boolean;
274269
}
275270

276271
export interface LogicalExpression extends BaseNode {
277-
type: "LogicalExpression";
278-
operator: "||" | "&&" | "??";
272+
type: 'LogicalExpression';
273+
operator: '||' | '&&' | '??';
279274
left: Expression;
280275
right: Expression;
281276
}
282277

283278
export interface ConditionalExpression extends BaseNode {
284-
type: "ConditionalExpression";
279+
type: 'ConditionalExpression';
285280
test: Expression;
286281
consequent: Expression;
287282
alternate: Expression;
288283
}
289284

290285
export interface ArrayExpression extends BaseNode {
291-
type: "ArrayExpression";
286+
type: 'ArrayExpression';
292287
elements: (Expression | null)[];
293288
}
294289

295290
export interface ObjectExpression extends BaseNode {
296-
type: "ObjectExpression";
291+
type: 'ObjectExpression';
297292
properties: Property[];
298293
}
299294

300295
export interface Property extends BaseNode {
301-
type: "Property";
296+
type: 'Property';
302297
key: Expression;
303298
value: Expression;
304-
kind: "init" | "get" | "set";
299+
kind: 'init' | 'get' | 'set';
305300
shorthand: boolean;
306301
computed: boolean;
307302
}
308303

309304
export interface Literal extends BaseNode {
310-
type: "Literal";
305+
type: 'Literal';
311306
value: string | number | boolean | null | RegExp;
312307
raw: string;
313308
}
314309

315310
export interface ObjectPattern extends BaseNode {
316-
type: "ObjectPattern";
311+
type: 'ObjectPattern';
317312
properties: Property[];
318313
}
319314

320315
export interface ArrayPattern extends BaseNode {
321-
type: "ArrayPattern";
316+
type: 'ArrayPattern';
322317
elements: (Pattern | null)[];
323318
}
324319

325320
export interface RestElement extends BaseNode {
326-
type: "RestElement";
321+
type: 'RestElement';
327322
argument: Pattern;
328323
}
329324

330325
export interface AssignmentPattern extends BaseNode {
331-
type: "AssignmentPattern";
326+
type: 'AssignmentPattern';
332327
left: Pattern;
333328
right: Expression;
334329
}

0 commit comments

Comments
 (0)