oxlint-react-compiler-experimental 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +59 -0
- package/bin/oxlint +3 -0
- package/configuration_schema.json +800 -0
- package/dist/bindings.js +404 -0
- package/dist/cli.js +84 -0
- package/dist/config.js +16 -0
- package/dist/index.d.ts +735 -0
- package/dist/index.js +2 -0
- package/dist/js_config.js +66 -0
- package/dist/lint.js +22559 -0
- package/dist/oxlint.darwin-arm64.node +0 -0
- package/dist/plugins-dev.d.ts +4203 -0
- package/dist/plugins-dev.js +866 -0
- package/dist/plugins.js +23 -0
- package/dist/utils.js +44 -0
- package/dist/workspace.js +2 -0
- package/dist/workspace2.js +35 -0
- package/package.json +66 -0
|
@@ -0,0 +1,4203 @@
|
|
|
1
|
+
//#region ../../node_modules/.pnpm/type-fest@5.4.4/node_modules/type-fest/source/is-any.d.ts
|
|
2
|
+
/**
|
|
3
|
+
Returns a boolean for whether the given type is `any`.
|
|
4
|
+
|
|
5
|
+
@link https://stackoverflow.com/a/49928360/1490091
|
|
6
|
+
|
|
7
|
+
Useful in type utilities, such as disallowing `any`s to be passed to a function.
|
|
8
|
+
|
|
9
|
+
@example
|
|
10
|
+
```
|
|
11
|
+
import type {IsAny} from 'type-fest';
|
|
12
|
+
|
|
13
|
+
const typedObject = {a: 1, b: 2} as const;
|
|
14
|
+
const anyObject: any = {a: 1, b: 2};
|
|
15
|
+
|
|
16
|
+
function get<O extends (IsAny<O> extends true ? {} : Record<string, number>), K extends keyof O = keyof O>(object: O, key: K) {
|
|
17
|
+
return object[key];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const typedA = get(typedObject, 'a');
|
|
21
|
+
//=> 1
|
|
22
|
+
|
|
23
|
+
const anyA = get(anyObject, 'a');
|
|
24
|
+
//=> any
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
@category Type Guard
|
|
28
|
+
@category Utilities
|
|
29
|
+
*/
|
|
30
|
+
type IsAny<T> = 0 extends 1 & NoInfer<T> ? true : false;
|
|
31
|
+
//#endregion
|
|
32
|
+
//#region ../../node_modules/.pnpm/type-fest@5.4.4/node_modules/type-fest/source/is-optional-key-of.d.ts
|
|
33
|
+
/**
|
|
34
|
+
Returns a boolean for whether the given key is an optional key of type.
|
|
35
|
+
|
|
36
|
+
This is useful when writing utility types or schema validators that need to differentiate `optional` keys.
|
|
37
|
+
|
|
38
|
+
@example
|
|
39
|
+
```
|
|
40
|
+
import type {IsOptionalKeyOf} from 'type-fest';
|
|
41
|
+
|
|
42
|
+
type User = {
|
|
43
|
+
name: string;
|
|
44
|
+
surname: string;
|
|
45
|
+
|
|
46
|
+
luckyNumber?: number;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
type Admin = {
|
|
50
|
+
name: string;
|
|
51
|
+
surname?: string;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
type T1 = IsOptionalKeyOf<User, 'luckyNumber'>;
|
|
55
|
+
//=> true
|
|
56
|
+
|
|
57
|
+
type T2 = IsOptionalKeyOf<User, 'name'>;
|
|
58
|
+
//=> false
|
|
59
|
+
|
|
60
|
+
type T3 = IsOptionalKeyOf<User, 'name' | 'luckyNumber'>;
|
|
61
|
+
//=> boolean
|
|
62
|
+
|
|
63
|
+
type T4 = IsOptionalKeyOf<User | Admin, 'name'>;
|
|
64
|
+
//=> false
|
|
65
|
+
|
|
66
|
+
type T5 = IsOptionalKeyOf<User | Admin, 'surname'>;
|
|
67
|
+
//=> boolean
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
@category Type Guard
|
|
71
|
+
@category Utilities
|
|
72
|
+
*/
|
|
73
|
+
type IsOptionalKeyOf<Type extends object, Key extends keyof Type> = IsAny<Type | Key> extends true ? never : Key extends keyof Type ? Type extends Record<Key, Type[Key]> ? false : true : false;
|
|
74
|
+
//#endregion
|
|
75
|
+
//#region ../../node_modules/.pnpm/type-fest@5.4.4/node_modules/type-fest/source/optional-keys-of.d.ts
|
|
76
|
+
/**
|
|
77
|
+
Extract all optional keys from the given type.
|
|
78
|
+
|
|
79
|
+
This is useful when you want to create a new type that contains different type values for the optional keys only.
|
|
80
|
+
|
|
81
|
+
@example
|
|
82
|
+
```
|
|
83
|
+
import type {OptionalKeysOf, Except} from 'type-fest';
|
|
84
|
+
|
|
85
|
+
type User = {
|
|
86
|
+
name: string;
|
|
87
|
+
surname: string;
|
|
88
|
+
|
|
89
|
+
luckyNumber?: number;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const REMOVE_FIELD = Symbol('remove field symbol');
|
|
93
|
+
type UpdateOperation<Entity extends object> = Except<Partial<Entity>, OptionalKeysOf<Entity>> & {
|
|
94
|
+
[Key in OptionalKeysOf<Entity>]?: Entity[Key] | typeof REMOVE_FIELD;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const update1: UpdateOperation<User> = {
|
|
98
|
+
name: 'Alice',
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
const update2: UpdateOperation<User> = {
|
|
102
|
+
name: 'Bob',
|
|
103
|
+
luckyNumber: REMOVE_FIELD,
|
|
104
|
+
};
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
@category Utilities
|
|
108
|
+
*/
|
|
109
|
+
type OptionalKeysOf<Type extends object> = Type extends unknown // For distributing `Type`
|
|
110
|
+
? (keyof { [Key in keyof Type as IsOptionalKeyOf<Type, Key> extends false ? never : Key]: never }) & keyof Type // Intersect with `keyof Type` to ensure result of `OptionalKeysOf<Type>` is always assignable to `keyof Type`
|
|
111
|
+
: never;
|
|
112
|
+
//#endregion
|
|
113
|
+
//#region ../../node_modules/.pnpm/type-fest@5.4.4/node_modules/type-fest/source/required-keys-of.d.ts
|
|
114
|
+
/**
|
|
115
|
+
Extract all required keys from the given type.
|
|
116
|
+
|
|
117
|
+
This is useful when you want to create a new type that contains different type values for the required keys only or use the list of keys for validation purposes, etc...
|
|
118
|
+
|
|
119
|
+
@example
|
|
120
|
+
```
|
|
121
|
+
import type {RequiredKeysOf} from 'type-fest';
|
|
122
|
+
|
|
123
|
+
declare function createValidation<
|
|
124
|
+
Entity extends object,
|
|
125
|
+
Key extends RequiredKeysOf<Entity> = RequiredKeysOf<Entity>,
|
|
126
|
+
>(field: Key, validator: (value: Entity[Key]) => boolean): (entity: Entity) => boolean;
|
|
127
|
+
|
|
128
|
+
type User = {
|
|
129
|
+
name: string;
|
|
130
|
+
surname: string;
|
|
131
|
+
luckyNumber?: number;
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
const validator1 = createValidation<User>('name', value => value.length < 25);
|
|
135
|
+
const validator2 = createValidation<User>('surname', value => value.length < 25);
|
|
136
|
+
|
|
137
|
+
// @ts-expect-error
|
|
138
|
+
const validator3 = createValidation<User>('luckyNumber', value => value > 0);
|
|
139
|
+
// Error: Argument of type '"luckyNumber"' is not assignable to parameter of type '"name" | "surname"'.
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
@category Utilities
|
|
143
|
+
*/
|
|
144
|
+
type RequiredKeysOf<Type extends object> = Type extends unknown // For distributing `Type`
|
|
145
|
+
? Exclude<keyof Type, OptionalKeysOf<Type>> : never;
|
|
146
|
+
//#endregion
|
|
147
|
+
//#region ../../node_modules/.pnpm/type-fest@5.4.4/node_modules/type-fest/source/is-never.d.ts
|
|
148
|
+
/**
|
|
149
|
+
Returns a boolean for whether the given type is `never`.
|
|
150
|
+
|
|
151
|
+
@link https://github.com/microsoft/TypeScript/issues/31751#issuecomment-498526919
|
|
152
|
+
@link https://stackoverflow.com/a/53984913/10292952
|
|
153
|
+
@link https://www.zhenghao.io/posts/ts-never
|
|
154
|
+
|
|
155
|
+
Useful in type utilities, such as checking if something does not occur.
|
|
156
|
+
|
|
157
|
+
@example
|
|
158
|
+
```
|
|
159
|
+
import type {IsNever, And} from 'type-fest';
|
|
160
|
+
|
|
161
|
+
type A = IsNever<never>;
|
|
162
|
+
//=> true
|
|
163
|
+
|
|
164
|
+
type B = IsNever<any>;
|
|
165
|
+
//=> false
|
|
166
|
+
|
|
167
|
+
type C = IsNever<unknown>;
|
|
168
|
+
//=> false
|
|
169
|
+
|
|
170
|
+
type D = IsNever<never[]>;
|
|
171
|
+
//=> false
|
|
172
|
+
|
|
173
|
+
type E = IsNever<object>;
|
|
174
|
+
//=> false
|
|
175
|
+
|
|
176
|
+
type F = IsNever<string>;
|
|
177
|
+
//=> false
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
@example
|
|
181
|
+
```
|
|
182
|
+
import type {IsNever} from 'type-fest';
|
|
183
|
+
|
|
184
|
+
type IsTrue<T> = T extends true ? true : false;
|
|
185
|
+
|
|
186
|
+
// When a distributive conditional is instantiated with `never`, the entire conditional results in `never`.
|
|
187
|
+
type A = IsTrue<never>;
|
|
188
|
+
//=> never
|
|
189
|
+
|
|
190
|
+
// If you don't want that behaviour, you can explicitly add an `IsNever` check before the distributive conditional.
|
|
191
|
+
type IsTrueFixed<T> =
|
|
192
|
+
IsNever<T> extends true ? false : T extends true ? true : false;
|
|
193
|
+
|
|
194
|
+
type B = IsTrueFixed<never>;
|
|
195
|
+
//=> false
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
@category Type Guard
|
|
199
|
+
@category Utilities
|
|
200
|
+
*/
|
|
201
|
+
type IsNever<T> = [T] extends [never] ? true : false;
|
|
202
|
+
//#endregion
|
|
203
|
+
//#region ../../node_modules/.pnpm/type-fest@5.4.4/node_modules/type-fest/source/if.d.ts
|
|
204
|
+
/**
|
|
205
|
+
An if-else-like type that resolves depending on whether the given `boolean` type is `true` or `false`.
|
|
206
|
+
|
|
207
|
+
Use-cases:
|
|
208
|
+
- You can use this in combination with `Is*` types to create an if-else-like experience. For example, `If<IsAny<any>, 'is any', 'not any'>`.
|
|
209
|
+
|
|
210
|
+
Note:
|
|
211
|
+
- Returns a union of if branch and else branch if the given type is `boolean` or `any`. For example, `If<boolean, 'Y', 'N'>` will return `'Y' | 'N'`.
|
|
212
|
+
- Returns the else branch if the given type is `never`. For example, `If<never, 'Y', 'N'>` will return `'N'`.
|
|
213
|
+
|
|
214
|
+
@example
|
|
215
|
+
```
|
|
216
|
+
import type {If} from 'type-fest';
|
|
217
|
+
|
|
218
|
+
type A = If<true, 'yes', 'no'>;
|
|
219
|
+
//=> 'yes'
|
|
220
|
+
|
|
221
|
+
type B = If<false, 'yes', 'no'>;
|
|
222
|
+
//=> 'no'
|
|
223
|
+
|
|
224
|
+
type C = If<boolean, 'yes', 'no'>;
|
|
225
|
+
//=> 'yes' | 'no'
|
|
226
|
+
|
|
227
|
+
type D = If<any, 'yes', 'no'>;
|
|
228
|
+
//=> 'yes' | 'no'
|
|
229
|
+
|
|
230
|
+
type E = If<never, 'yes', 'no'>;
|
|
231
|
+
//=> 'no'
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
@example
|
|
235
|
+
```
|
|
236
|
+
import type {If, IsAny, IsNever} from 'type-fest';
|
|
237
|
+
|
|
238
|
+
type A = If<IsAny<unknown>, 'is any', 'not any'>;
|
|
239
|
+
//=> 'not any'
|
|
240
|
+
|
|
241
|
+
type B = If<IsNever<never>, 'is never', 'not never'>;
|
|
242
|
+
//=> 'is never'
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
@example
|
|
246
|
+
```
|
|
247
|
+
import type {If, IsEqual} from 'type-fest';
|
|
248
|
+
|
|
249
|
+
type IfEqual<T, U, IfBranch, ElseBranch> = If<IsEqual<T, U>, IfBranch, ElseBranch>;
|
|
250
|
+
|
|
251
|
+
type A = IfEqual<string, string, 'equal', 'not equal'>;
|
|
252
|
+
//=> 'equal'
|
|
253
|
+
|
|
254
|
+
type B = IfEqual<string, number, 'equal', 'not equal'>;
|
|
255
|
+
//=> 'not equal'
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
Note: Sometimes using the `If` type can make an implementation non–tail-recursive, which can impact performance. In such cases, it’s better to use a conditional directly. Refer to the following example:
|
|
259
|
+
|
|
260
|
+
@example
|
|
261
|
+
```
|
|
262
|
+
import type {If, IsEqual, StringRepeat} from 'type-fest';
|
|
263
|
+
|
|
264
|
+
type HundredZeroes = StringRepeat<'0', 100>;
|
|
265
|
+
|
|
266
|
+
// The following implementation is not tail recursive
|
|
267
|
+
type Includes<S extends string, Char extends string> =
|
|
268
|
+
S extends `${infer First}${infer Rest}`
|
|
269
|
+
? If<IsEqual<First, Char>,
|
|
270
|
+
'found',
|
|
271
|
+
Includes<Rest, Char>>
|
|
272
|
+
: 'not found';
|
|
273
|
+
|
|
274
|
+
// Hence, instantiations with long strings will fail
|
|
275
|
+
// @ts-expect-error
|
|
276
|
+
type Fails = Includes<HundredZeroes, '1'>;
|
|
277
|
+
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
278
|
+
// Error: Type instantiation is excessively deep and possibly infinite.
|
|
279
|
+
|
|
280
|
+
// However, if we use a simple conditional instead of `If`, the implementation becomes tail-recursive
|
|
281
|
+
type IncludesWithoutIf<S extends string, Char extends string> =
|
|
282
|
+
S extends `${infer First}${infer Rest}`
|
|
283
|
+
? IsEqual<First, Char> extends true
|
|
284
|
+
? 'found'
|
|
285
|
+
: IncludesWithoutIf<Rest, Char>
|
|
286
|
+
: 'not found';
|
|
287
|
+
|
|
288
|
+
// Now, instantiations with long strings will work
|
|
289
|
+
type Works = IncludesWithoutIf<HundredZeroes, '1'>;
|
|
290
|
+
//=> 'not found'
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
@category Type Guard
|
|
294
|
+
@category Utilities
|
|
295
|
+
*/
|
|
296
|
+
type If<Type extends boolean, IfBranch, ElseBranch> = IsNever<Type> extends true ? ElseBranch : Type extends true ? IfBranch : ElseBranch;
|
|
297
|
+
//#endregion
|
|
298
|
+
//#region ../../node_modules/.pnpm/type-fest@5.4.4/node_modules/type-fest/source/internal/type.d.ts
|
|
299
|
+
/**
|
|
300
|
+
An if-else-like type that resolves depending on whether the given type is `any` or `never`.
|
|
301
|
+
|
|
302
|
+
@example
|
|
303
|
+
```
|
|
304
|
+
// When `T` is a NOT `any` or `never` (like `string`) => Returns `IfNotAnyOrNever` branch
|
|
305
|
+
type A = IfNotAnyOrNever<string, 'VALID', 'IS_ANY', 'IS_NEVER'>;
|
|
306
|
+
//=> 'VALID'
|
|
307
|
+
|
|
308
|
+
// When `T` is `any` => Returns `IfAny` branch
|
|
309
|
+
type B = IfNotAnyOrNever<any, 'VALID', 'IS_ANY', 'IS_NEVER'>;
|
|
310
|
+
//=> 'IS_ANY'
|
|
311
|
+
|
|
312
|
+
// When `T` is `never` => Returns `IfNever` branch
|
|
313
|
+
type C = IfNotAnyOrNever<never, 'VALID', 'IS_ANY', 'IS_NEVER'>;
|
|
314
|
+
//=> 'IS_NEVER'
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
Note: Wrapping a tail-recursive type with `IfNotAnyOrNever` makes the implementation non-tail-recursive. To fix this, move the recursion into a helper type. Refer to the following example:
|
|
318
|
+
|
|
319
|
+
@example
|
|
320
|
+
```ts
|
|
321
|
+
import type {StringRepeat} from 'type-fest';
|
|
322
|
+
|
|
323
|
+
type NineHundredNinetyNineSpaces = StringRepeat<' ', 999>;
|
|
324
|
+
|
|
325
|
+
// The following implementation is not tail recursive
|
|
326
|
+
type TrimLeft<S extends string> = IfNotAnyOrNever<S, S extends ` ${infer R}` ? TrimLeft<R> : S>;
|
|
327
|
+
|
|
328
|
+
// Hence, instantiations with long strings will fail
|
|
329
|
+
// @ts-expect-error
|
|
330
|
+
type T1 = TrimLeft<NineHundredNinetyNineSpaces>;
|
|
331
|
+
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
332
|
+
// Error: Type instantiation is excessively deep and possibly infinite.
|
|
333
|
+
|
|
334
|
+
// To fix this, move the recursion into a helper type
|
|
335
|
+
type TrimLeftOptimised<S extends string> = IfNotAnyOrNever<S, _TrimLeftOptimised<S>>;
|
|
336
|
+
|
|
337
|
+
type _TrimLeftOptimised<S extends string> = S extends ` ${infer R}` ? _TrimLeftOptimised<R> : S;
|
|
338
|
+
|
|
339
|
+
type T2 = TrimLeftOptimised<NineHundredNinetyNineSpaces>;
|
|
340
|
+
//=> ''
|
|
341
|
+
```
|
|
342
|
+
*/
|
|
343
|
+
type IfNotAnyOrNever<T, IfNotAnyOrNever, IfAny = any, IfNever = never> = If<IsAny<T>, IfAny, If<IsNever<T>, IfNever, IfNotAnyOrNever>>;
|
|
344
|
+
//#endregion
|
|
345
|
+
//#region ../../node_modules/.pnpm/type-fest@5.4.4/node_modules/type-fest/source/simplify.d.ts
|
|
346
|
+
/**
|
|
347
|
+
Useful to flatten the type output to improve type hints shown in editors. And also to transform an interface into a type to aide with assignability.
|
|
348
|
+
|
|
349
|
+
@example
|
|
350
|
+
```
|
|
351
|
+
import type {Simplify} from 'type-fest';
|
|
352
|
+
|
|
353
|
+
type PositionProps = {
|
|
354
|
+
top: number;
|
|
355
|
+
left: number;
|
|
356
|
+
};
|
|
357
|
+
|
|
358
|
+
type SizeProps = {
|
|
359
|
+
width: number;
|
|
360
|
+
height: number;
|
|
361
|
+
};
|
|
362
|
+
|
|
363
|
+
// In your editor, hovering over `Props` will show a flattened object with all the properties.
|
|
364
|
+
type Props = Simplify<PositionProps & SizeProps>;
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
Sometimes it is desired to pass a value as a function argument that has a different type. At first inspection it may seem assignable, and then you discover it is not because the `value`'s type definition was defined as an interface. In the following example, `fn` requires an argument of type `Record<string, unknown>`. If the value is defined as a literal, then it is assignable. And if the `value` is defined as type using the `Simplify` utility the value is assignable. But if the `value` is defined as an interface, it is not assignable because the interface is not sealed and elsewhere a non-string property could be added to the interface.
|
|
368
|
+
|
|
369
|
+
If the type definition must be an interface (perhaps it was defined in a third-party npm package), then the `value` can be defined as `const value: Simplify<SomeInterface> = ...`. Then `value` will be assignable to the `fn` argument. Or the `value` can be cast as `Simplify<SomeInterface>` if you can't re-declare the `value`.
|
|
370
|
+
|
|
371
|
+
@example
|
|
372
|
+
```
|
|
373
|
+
import type {Simplify} from 'type-fest';
|
|
374
|
+
|
|
375
|
+
interface SomeInterface {
|
|
376
|
+
foo: number;
|
|
377
|
+
bar?: string;
|
|
378
|
+
baz: number | undefined;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
type SomeType = {
|
|
382
|
+
foo: number;
|
|
383
|
+
bar?: string;
|
|
384
|
+
baz: number | undefined;
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
const literal = {foo: 123, bar: 'hello', baz: 456};
|
|
388
|
+
const someType: SomeType = literal;
|
|
389
|
+
const someInterface: SomeInterface = literal;
|
|
390
|
+
|
|
391
|
+
declare function fn(object: Record<string, unknown>): void;
|
|
392
|
+
|
|
393
|
+
fn(literal); // Good: literal object type is sealed
|
|
394
|
+
fn(someType); // Good: type is sealed
|
|
395
|
+
// @ts-expect-error
|
|
396
|
+
fn(someInterface); // Error: Index signature for type 'string' is missing in type 'someInterface'. Because `interface` can be re-opened
|
|
397
|
+
fn(someInterface as Simplify<SomeInterface>); // Good: transform an `interface` into a `type`
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
@link https://github.com/microsoft/TypeScript/issues/15300
|
|
401
|
+
@see {@link SimplifyDeep}
|
|
402
|
+
@category Object
|
|
403
|
+
*/
|
|
404
|
+
type Simplify<T> = { [KeyType in keyof T]: T[KeyType] } & {};
|
|
405
|
+
//#endregion
|
|
406
|
+
//#region ../../node_modules/.pnpm/type-fest@5.4.4/node_modules/type-fest/source/is-equal.d.ts
|
|
407
|
+
/**
|
|
408
|
+
Returns a boolean for whether the two given types are equal.
|
|
409
|
+
|
|
410
|
+
@link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
|
|
411
|
+
@link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
|
|
412
|
+
|
|
413
|
+
Use-cases:
|
|
414
|
+
- If you want to make a conditional branch based on the result of a comparison of two types.
|
|
415
|
+
|
|
416
|
+
@example
|
|
417
|
+
```
|
|
418
|
+
import type {IsEqual} from 'type-fest';
|
|
419
|
+
|
|
420
|
+
// This type returns a boolean for whether the given array includes the given item.
|
|
421
|
+
// `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
|
|
422
|
+
type Includes<Value extends readonly any[], Item> =
|
|
423
|
+
Value extends readonly [Value[0], ...infer rest]
|
|
424
|
+
? IsEqual<Value[0], Item> extends true
|
|
425
|
+
? true
|
|
426
|
+
: Includes<rest, Item>
|
|
427
|
+
: false;
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
@category Type Guard
|
|
431
|
+
@category Utilities
|
|
432
|
+
*/
|
|
433
|
+
type IsEqual<A, B> = [A] extends [B] ? [B] extends [A] ? _IsEqual<A, B> : false : false;
|
|
434
|
+
// This version fails the `equalWrappedTupleIntersectionToBeNeverAndNeverExpanded` test in `test-d/is-equal.ts`.
|
|
435
|
+
type _IsEqual<A, B> = (<G>() => G extends A & G | G ? 1 : 2) extends (<G>() => G extends B & G | G ? 1 : 2) ? true : false;
|
|
436
|
+
//#endregion
|
|
437
|
+
//#region ../../node_modules/.pnpm/type-fest@5.4.4/node_modules/type-fest/source/omit-index-signature.d.ts
|
|
438
|
+
/**
|
|
439
|
+
Omit any index signatures from the given object type, leaving only explicitly defined properties.
|
|
440
|
+
|
|
441
|
+
This is the counterpart of `PickIndexSignature`.
|
|
442
|
+
|
|
443
|
+
Use-cases:
|
|
444
|
+
- Remove overly permissive signatures from third-party types.
|
|
445
|
+
|
|
446
|
+
This type was taken from this [StackOverflow answer](https://stackoverflow.com/a/68261113/420747).
|
|
447
|
+
|
|
448
|
+
It relies on the fact that an empty object (`{}`) is assignable to an object with just an index signature, like `Record<string, unknown>`, but not to an object with explicitly defined keys, like `Record<'foo' | 'bar', unknown>`.
|
|
449
|
+
|
|
450
|
+
(The actual value type, `unknown`, is irrelevant and could be any type. Only the key type matters.)
|
|
451
|
+
|
|
452
|
+
```
|
|
453
|
+
const indexed: Record<string, unknown> = {}; // Allowed
|
|
454
|
+
|
|
455
|
+
// @ts-expect-error
|
|
456
|
+
const keyed: Record<'foo', unknown> = {}; // Error
|
|
457
|
+
// TS2739: Type '{}' is missing the following properties from type 'Record<"foo" | "bar", unknown>': foo, bar
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
Instead of causing a type error like the above, you can also use a [conditional type](https://www.typescriptlang.org/docs/handbook/2/conditional-types.html) to test whether a type is assignable to another:
|
|
461
|
+
|
|
462
|
+
```
|
|
463
|
+
type Indexed = {} extends Record<string, unknown>
|
|
464
|
+
? '✅ `{}` is assignable to `Record<string, unknown>`'
|
|
465
|
+
: '❌ `{}` is NOT assignable to `Record<string, unknown>`';
|
|
466
|
+
|
|
467
|
+
type IndexedResult = Indexed;
|
|
468
|
+
//=> '✅ `{}` is assignable to `Record<string, unknown>`'
|
|
469
|
+
|
|
470
|
+
type Keyed = {} extends Record<'foo' | 'bar', unknown>
|
|
471
|
+
? '✅ `{}` is assignable to `Record<\'foo\' | \'bar\', unknown>`'
|
|
472
|
+
: '❌ `{}` is NOT assignable to `Record<\'foo\' | \'bar\', unknown>`';
|
|
473
|
+
|
|
474
|
+
type KeyedResult = Keyed;
|
|
475
|
+
//=> '❌ `{}` is NOT assignable to `Record<\'foo\' | \'bar\', unknown>`'
|
|
476
|
+
```
|
|
477
|
+
|
|
478
|
+
Using a [mapped type](https://www.typescriptlang.org/docs/handbook/2/mapped-types.html#further-exploration), you can then check for each `KeyType` of `ObjectType`...
|
|
479
|
+
|
|
480
|
+
```
|
|
481
|
+
type OmitIndexSignature<ObjectType> = {
|
|
482
|
+
[KeyType in keyof ObjectType // Map each key of `ObjectType`...
|
|
483
|
+
]: ObjectType[KeyType]; // ...to its original value, i.e. `OmitIndexSignature<Foo> == Foo`.
|
|
484
|
+
};
|
|
485
|
+
```
|
|
486
|
+
|
|
487
|
+
...whether an empty object (`{}`) would be assignable to an object with that `KeyType` (`Record<KeyType, unknown>`)...
|
|
488
|
+
|
|
489
|
+
```
|
|
490
|
+
type OmitIndexSignature<ObjectType> = {
|
|
491
|
+
[KeyType in keyof ObjectType
|
|
492
|
+
// Is `{}` assignable to `Record<KeyType, unknown>`?
|
|
493
|
+
as {} extends Record<KeyType, unknown>
|
|
494
|
+
? never // ✅ `{}` is assignable to `Record<KeyType, unknown>`
|
|
495
|
+
: KeyType // ❌ `{}` is NOT assignable to `Record<KeyType, unknown>`
|
|
496
|
+
]: ObjectType[KeyType];
|
|
497
|
+
};
|
|
498
|
+
```
|
|
499
|
+
|
|
500
|
+
If `{}` is assignable, it means that `KeyType` is an index signature and we want to remove it. If it is not assignable, `KeyType` is a "real" key and we want to keep it.
|
|
501
|
+
|
|
502
|
+
@example
|
|
503
|
+
```
|
|
504
|
+
import type {OmitIndexSignature} from 'type-fest';
|
|
505
|
+
|
|
506
|
+
type Example = {
|
|
507
|
+
// These index signatures will be removed.
|
|
508
|
+
[x: string]: any;
|
|
509
|
+
[x: number]: any;
|
|
510
|
+
[x: symbol]: any;
|
|
511
|
+
[x: `head-${string}`]: string;
|
|
512
|
+
[x: `${string}-tail`]: string;
|
|
513
|
+
[x: `head-${string}-tail`]: string;
|
|
514
|
+
[x: `${bigint}`]: string;
|
|
515
|
+
[x: `embedded-${number}`]: string;
|
|
516
|
+
|
|
517
|
+
// These explicitly defined keys will remain.
|
|
518
|
+
foo: 'bar';
|
|
519
|
+
qux?: 'baz';
|
|
520
|
+
};
|
|
521
|
+
|
|
522
|
+
type ExampleWithoutIndexSignatures = OmitIndexSignature<Example>;
|
|
523
|
+
//=> {foo: 'bar'; qux?: 'baz'}
|
|
524
|
+
```
|
|
525
|
+
|
|
526
|
+
@see {@link PickIndexSignature}
|
|
527
|
+
@category Object
|
|
528
|
+
*/
|
|
529
|
+
type OmitIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? never : KeyType]: ObjectType[KeyType] };
|
|
530
|
+
//#endregion
|
|
531
|
+
//#region ../../node_modules/.pnpm/type-fest@5.4.4/node_modules/type-fest/source/pick-index-signature.d.ts
|
|
532
|
+
/**
|
|
533
|
+
Pick only index signatures from the given object type, leaving out all explicitly defined properties.
|
|
534
|
+
|
|
535
|
+
This is the counterpart of `OmitIndexSignature`.
|
|
536
|
+
|
|
537
|
+
@example
|
|
538
|
+
```
|
|
539
|
+
import type {PickIndexSignature} from 'type-fest';
|
|
540
|
+
|
|
541
|
+
declare const symbolKey: unique symbol;
|
|
542
|
+
|
|
543
|
+
type Example = {
|
|
544
|
+
// These index signatures will remain.
|
|
545
|
+
[x: string]: unknown;
|
|
546
|
+
[x: number]: unknown;
|
|
547
|
+
[x: symbol]: unknown;
|
|
548
|
+
[x: `head-${string}`]: string;
|
|
549
|
+
[x: `${string}-tail`]: string;
|
|
550
|
+
[x: `head-${string}-tail`]: string;
|
|
551
|
+
[x: `${bigint}`]: string;
|
|
552
|
+
[x: `embedded-${number}`]: string;
|
|
553
|
+
|
|
554
|
+
// These explicitly defined keys will be removed.
|
|
555
|
+
['kebab-case-key']: string;
|
|
556
|
+
[symbolKey]: string;
|
|
557
|
+
foo: 'bar';
|
|
558
|
+
qux?: 'baz';
|
|
559
|
+
};
|
|
560
|
+
|
|
561
|
+
type ExampleIndexSignature = PickIndexSignature<Example>;
|
|
562
|
+
// {
|
|
563
|
+
// [x: string]: unknown;
|
|
564
|
+
// [x: number]: unknown;
|
|
565
|
+
// [x: symbol]: unknown;
|
|
566
|
+
// [x: `head-${string}`]: string;
|
|
567
|
+
// [x: `${string}-tail`]: string;
|
|
568
|
+
// [x: `head-${string}-tail`]: string;
|
|
569
|
+
// [x: `${bigint}`]: string;
|
|
570
|
+
// [x: `embedded-${number}`]: string;
|
|
571
|
+
// }
|
|
572
|
+
```
|
|
573
|
+
|
|
574
|
+
@see {@link OmitIndexSignature}
|
|
575
|
+
@category Object
|
|
576
|
+
*/
|
|
577
|
+
type PickIndexSignature<ObjectType> = { [KeyType in keyof ObjectType as {} extends Record<KeyType, unknown> ? KeyType : never]: ObjectType[KeyType] };
|
|
578
|
+
//#endregion
|
|
579
|
+
//#region ../../node_modules/.pnpm/type-fest@5.4.4/node_modules/type-fest/source/merge.d.ts
|
|
580
|
+
// Merges two objects without worrying about index signatures.
|
|
581
|
+
type SimpleMerge<Destination, Source> = Simplify<{ [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key] } & Source>;
|
|
582
|
+
/**
|
|
583
|
+
Merge two types into a new type. Keys of the second type overrides keys of the first type.
|
|
584
|
+
|
|
585
|
+
@example
|
|
586
|
+
```
|
|
587
|
+
import type {Merge} from 'type-fest';
|
|
588
|
+
|
|
589
|
+
type Foo = {
|
|
590
|
+
[x: string]: unknown;
|
|
591
|
+
[x: number]: unknown;
|
|
592
|
+
foo: string;
|
|
593
|
+
bar: symbol;
|
|
594
|
+
};
|
|
595
|
+
|
|
596
|
+
type Bar = {
|
|
597
|
+
[x: number]: number;
|
|
598
|
+
[x: symbol]: unknown;
|
|
599
|
+
bar: Date;
|
|
600
|
+
baz: boolean;
|
|
601
|
+
};
|
|
602
|
+
|
|
603
|
+
export type FooBar = Merge<Foo, Bar>;
|
|
604
|
+
//=> {
|
|
605
|
+
// [x: string]: unknown;
|
|
606
|
+
// [x: number]: number;
|
|
607
|
+
// [x: symbol]: unknown;
|
|
608
|
+
// foo: string;
|
|
609
|
+
// bar: Date;
|
|
610
|
+
// baz: boolean;
|
|
611
|
+
// }
|
|
612
|
+
```
|
|
613
|
+
|
|
614
|
+
Note: If you want a merge type that more accurately reflects the runtime behavior of object spread or `Object.assign`, refer to the {@link ObjectMerge} type.
|
|
615
|
+
|
|
616
|
+
@see {@link ObjectMerge}
|
|
617
|
+
@category Object
|
|
618
|
+
*/
|
|
619
|
+
type Merge<Destination, Source> = Destination extends unknown // For distributing `Destination`
|
|
620
|
+
? Source extends unknown // For distributing `Source`
|
|
621
|
+
? If<IsEqual<Destination, Source>, Destination, _Merge<Destination, Source>> : never // Should never happen
|
|
622
|
+
: never;
|
|
623
|
+
// Should never happen
|
|
624
|
+
type _Merge<Destination, Source> = Simplify<SimpleMerge<PickIndexSignature<Destination>, PickIndexSignature<Source>> & SimpleMerge<OmitIndexSignature<Destination>, OmitIndexSignature<Source>>>;
|
|
625
|
+
//#endregion
|
|
626
|
+
//#region ../../node_modules/.pnpm/type-fest@5.4.4/node_modules/type-fest/source/internal/object.d.ts
|
|
627
|
+
/**
|
|
628
|
+
Merges user specified options with default options.
|
|
629
|
+
|
|
630
|
+
@example
|
|
631
|
+
```
|
|
632
|
+
type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};
|
|
633
|
+
type DefaultPathsOptions = {maxRecursionDepth: 10; leavesOnly: false};
|
|
634
|
+
type SpecifiedOptions = {leavesOnly: true};
|
|
635
|
+
|
|
636
|
+
type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;
|
|
637
|
+
//=> {maxRecursionDepth: 10; leavesOnly: true}
|
|
638
|
+
```
|
|
639
|
+
|
|
640
|
+
@example
|
|
641
|
+
```
|
|
642
|
+
// Complains if default values are not provided for optional options
|
|
643
|
+
|
|
644
|
+
type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};
|
|
645
|
+
type DefaultPathsOptions = {maxRecursionDepth: 10};
|
|
646
|
+
type SpecifiedOptions = {};
|
|
647
|
+
|
|
648
|
+
type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;
|
|
649
|
+
// ~~~~~~~~~~~~~~~~~~~
|
|
650
|
+
// Property 'leavesOnly' is missing in type 'DefaultPathsOptions' but required in type '{ maxRecursionDepth: number; leavesOnly: boolean; }'.
|
|
651
|
+
```
|
|
652
|
+
|
|
653
|
+
@example
|
|
654
|
+
```
|
|
655
|
+
// Complains if an option's default type does not conform to the expected type
|
|
656
|
+
|
|
657
|
+
type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};
|
|
658
|
+
type DefaultPathsOptions = {maxRecursionDepth: 10; leavesOnly: 'no'};
|
|
659
|
+
type SpecifiedOptions = {};
|
|
660
|
+
|
|
661
|
+
type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;
|
|
662
|
+
// ~~~~~~~~~~~~~~~~~~~
|
|
663
|
+
// Types of property 'leavesOnly' are incompatible. Type 'string' is not assignable to type 'boolean'.
|
|
664
|
+
```
|
|
665
|
+
|
|
666
|
+
@example
|
|
667
|
+
```
|
|
668
|
+
// Complains if an option's specified type does not conform to the expected type
|
|
669
|
+
|
|
670
|
+
type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean};
|
|
671
|
+
type DefaultPathsOptions = {maxRecursionDepth: 10; leavesOnly: false};
|
|
672
|
+
type SpecifiedOptions = {leavesOnly: 'yes'};
|
|
673
|
+
|
|
674
|
+
type Result = ApplyDefaultOptions<PathsOptions, DefaultPathsOptions, SpecifiedOptions>;
|
|
675
|
+
// ~~~~~~~~~~~~~~~~
|
|
676
|
+
// Types of property 'leavesOnly' are incompatible. Type 'string' is not assignable to type 'boolean'.
|
|
677
|
+
```
|
|
678
|
+
*/
|
|
679
|
+
type ApplyDefaultOptions<Options extends object, Defaults extends Simplify<Omit<Required<Options>, RequiredKeysOf<Options>> & Partial<Record<RequiredKeysOf<Options>, never>>>, SpecifiedOptions extends Options> = If<IsAny<SpecifiedOptions>, Defaults, If<IsNever<SpecifiedOptions>, Defaults, Simplify<Merge<Defaults, { [Key in keyof SpecifiedOptions as Key extends OptionalKeysOf<Options> ? undefined extends SpecifiedOptions[Key] ? never : Key : Key]: SpecifiedOptions[Key] }> & Required<Options>>>>;
|
|
680
|
+
//#endregion
|
|
681
|
+
//#region ../../node_modules/.pnpm/type-fest@5.4.4/node_modules/type-fest/source/except.d.ts
|
|
682
|
+
/**
|
|
683
|
+
Filter out keys from an object.
|
|
684
|
+
|
|
685
|
+
Returns `never` if `Exclude` is strictly equal to `Key`.
|
|
686
|
+
Returns `never` if `Key` extends `Exclude`.
|
|
687
|
+
Returns `Key` otherwise.
|
|
688
|
+
|
|
689
|
+
@example
|
|
690
|
+
```
|
|
691
|
+
type Filtered = Filter<'foo', 'foo'>;
|
|
692
|
+
//=> never
|
|
693
|
+
```
|
|
694
|
+
|
|
695
|
+
@example
|
|
696
|
+
```
|
|
697
|
+
type Filtered = Filter<'bar', string>;
|
|
698
|
+
//=> never
|
|
699
|
+
```
|
|
700
|
+
|
|
701
|
+
@example
|
|
702
|
+
```
|
|
703
|
+
type Filtered = Filter<'bar', 'foo'>;
|
|
704
|
+
//=> 'bar'
|
|
705
|
+
```
|
|
706
|
+
|
|
707
|
+
@see {Except}
|
|
708
|
+
*/
|
|
709
|
+
type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
|
|
710
|
+
type ExceptOptions = {
|
|
711
|
+
/**
|
|
712
|
+
Disallow assigning non-specified properties.
|
|
713
|
+
Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
|
|
714
|
+
@default false
|
|
715
|
+
*/
|
|
716
|
+
requireExactProps?: boolean;
|
|
717
|
+
};
|
|
718
|
+
type DefaultExceptOptions = {
|
|
719
|
+
requireExactProps: false;
|
|
720
|
+
};
|
|
721
|
+
/**
|
|
722
|
+
Create a type from an object type without certain keys.
|
|
723
|
+
|
|
724
|
+
We recommend setting the `requireExactProps` option to `true`.
|
|
725
|
+
|
|
726
|
+
This type is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type). The `Omit` type does not restrict the omitted keys to be keys present on the given type, while `Except` does. The benefits of a stricter type are avoiding typos and allowing the compiler to pick up on rename refactors automatically.
|
|
727
|
+
|
|
728
|
+
This type was proposed to the TypeScript team, which declined it, saying they prefer that libraries implement stricter versions of the built-in types ([microsoft/TypeScript#30825](https://github.com/microsoft/TypeScript/issues/30825#issuecomment-523668235)).
|
|
729
|
+
|
|
730
|
+
@example
|
|
731
|
+
```
|
|
732
|
+
import type {Except} from 'type-fest';
|
|
733
|
+
|
|
734
|
+
type Foo = {
|
|
735
|
+
a: number;
|
|
736
|
+
b: string;
|
|
737
|
+
};
|
|
738
|
+
|
|
739
|
+
type FooWithoutA = Except<Foo, 'a'>;
|
|
740
|
+
//=> {b: string}
|
|
741
|
+
|
|
742
|
+
// @ts-expect-error
|
|
743
|
+
const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
|
|
744
|
+
// errors: 'a' does not exist in type '{ b: string; }'
|
|
745
|
+
|
|
746
|
+
type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
|
|
747
|
+
//=> {a: number} & Partial<Record<'b', never>>
|
|
748
|
+
|
|
749
|
+
// @ts-expect-error
|
|
750
|
+
const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
|
|
751
|
+
// errors at 'b': Type 'string' is not assignable to type 'undefined'.
|
|
752
|
+
|
|
753
|
+
// The `Omit` utility type doesn't work when omitting specific keys from objects containing index signatures.
|
|
754
|
+
|
|
755
|
+
// Consider the following example:
|
|
756
|
+
|
|
757
|
+
type UserData = {
|
|
758
|
+
[metadata: string]: string;
|
|
759
|
+
email: string;
|
|
760
|
+
name: string;
|
|
761
|
+
role: 'admin' | 'user';
|
|
762
|
+
};
|
|
763
|
+
|
|
764
|
+
// `Omit` clearly doesn't behave as expected in this case:
|
|
765
|
+
type PostPayload = Omit<UserData, 'email'>;
|
|
766
|
+
//=> {[x: string]: string; [x: number]: string}
|
|
767
|
+
|
|
768
|
+
// In situations like this, `Except` works better.
|
|
769
|
+
// It simply removes the `email` key while preserving all the other keys.
|
|
770
|
+
type PostPayloadFixed = Except<UserData, 'email'>;
|
|
771
|
+
//=> {[x: string]: string; name: string; role: 'admin' | 'user'}
|
|
772
|
+
```
|
|
773
|
+
|
|
774
|
+
@category Object
|
|
775
|
+
*/
|
|
776
|
+
type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {}> = _Except<ObjectType, KeysType, ApplyDefaultOptions<ExceptOptions, DefaultExceptOptions, Options>>;
|
|
777
|
+
type _Except<ObjectType, KeysType extends keyof ObjectType, Options extends Required<ExceptOptions>> = { [KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType] } & (Options['requireExactProps'] extends true ? Partial<Record<KeysType, never>> : {});
|
|
778
|
+
//#endregion
|
|
779
|
+
//#region ../../node_modules/.pnpm/type-fest@5.4.4/node_modules/type-fest/source/require-at-least-one.d.ts
|
|
780
|
+
/**
|
|
781
|
+
Create a type that requires at least one of the given keys. The remaining keys are kept as is.
|
|
782
|
+
|
|
783
|
+
@example
|
|
784
|
+
```
|
|
785
|
+
import type {RequireAtLeastOne} from 'type-fest';
|
|
786
|
+
|
|
787
|
+
type Responder = {
|
|
788
|
+
text?: () => string;
|
|
789
|
+
json?: () => string;
|
|
790
|
+
secure?: boolean;
|
|
791
|
+
};
|
|
792
|
+
|
|
793
|
+
const responder: RequireAtLeastOne<Responder, 'text' | 'json'> = {
|
|
794
|
+
json: () => '{"message": "ok"}',
|
|
795
|
+
secure: true,
|
|
796
|
+
};
|
|
797
|
+
```
|
|
798
|
+
|
|
799
|
+
@category Object
|
|
800
|
+
*/
|
|
801
|
+
type RequireAtLeastOne<ObjectType, KeysType extends keyof ObjectType = keyof ObjectType> = IfNotAnyOrNever<ObjectType, If<IsNever<KeysType>, never, _RequireAtLeastOne<ObjectType, If<IsAny<KeysType>, keyof ObjectType, KeysType>>>>;
|
|
802
|
+
type _RequireAtLeastOne<ObjectType, KeysType extends keyof ObjectType> = { // For each `Key` in `KeysType` make a mapped type:
|
|
803
|
+
[Key in KeysType]-?: Required<Pick<ObjectType, Key>> & // 1. Make `Key`'s type required
|
|
804
|
+
// 2. Make all other keys in `KeysType` optional
|
|
805
|
+
Partial<Pick<ObjectType, Exclude<KeysType, Key>>> }[KeysType] & // 3. Add the remaining keys not in `KeysType`
|
|
806
|
+
Except<ObjectType, KeysType>;
|
|
807
|
+
//#endregion
|
|
808
|
+
//#region src-js/plugins/globals.d.ts
|
|
809
|
+
/**
|
|
810
|
+
* Globals for the file being linted.
|
|
811
|
+
*
|
|
812
|
+
* Globals are deserialized from JSON, so can only contain JSON-compatible values.
|
|
813
|
+
* Each global variable maps to "readonly", "writable", or "off".
|
|
814
|
+
*/
|
|
815
|
+
type Globals$1 = Record<string, "readonly" | "writable" | "off">;
|
|
816
|
+
/**
|
|
817
|
+
* Environments for the file being linted.
|
|
818
|
+
*
|
|
819
|
+
* Only includes environments that are enabled, so all properties are `true`.
|
|
820
|
+
*/
|
|
821
|
+
type Envs$1 = Record<string, true>;
|
|
822
|
+
//#endregion
|
|
823
|
+
//#region ../../node_modules/.pnpm/@types+json-schema@7.0.15/node_modules/@types/json-schema/index.d.ts
|
|
824
|
+
// ==================================================================================================
|
|
825
|
+
// JSON Schema Draft 04
|
|
826
|
+
// ==================================================================================================
|
|
827
|
+
/**
|
|
828
|
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.1
|
|
829
|
+
*/
|
|
830
|
+
type JSONSchema4TypeName = "string" //
|
|
831
|
+
| "number" | "integer" | "boolean" | "object" | "array" | "null" | "any";
|
|
832
|
+
/**
|
|
833
|
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-04#section-3.5
|
|
834
|
+
*/
|
|
835
|
+
type JSONSchema4Type = string //
|
|
836
|
+
| number | boolean | JSONSchema4Object | JSONSchema4Array | null;
|
|
837
|
+
// Workaround for infinite type recursion
|
|
838
|
+
interface JSONSchema4Object {
|
|
839
|
+
[key: string]: JSONSchema4Type;
|
|
840
|
+
}
|
|
841
|
+
// Workaround for infinite type recursion
|
|
842
|
+
// https://github.com/Microsoft/TypeScript/issues/3496#issuecomment-128553540
|
|
843
|
+
interface JSONSchema4Array extends Array<JSONSchema4Type> {}
|
|
844
|
+
/**
|
|
845
|
+
* Meta schema
|
|
846
|
+
*
|
|
847
|
+
* Recommended values:
|
|
848
|
+
* - 'http://json-schema.org/schema#'
|
|
849
|
+
* - 'http://json-schema.org/hyper-schema#'
|
|
850
|
+
* - 'http://json-schema.org/draft-04/schema#'
|
|
851
|
+
* - 'http://json-schema.org/draft-04/hyper-schema#'
|
|
852
|
+
* - 'http://json-schema.org/draft-03/schema#'
|
|
853
|
+
* - 'http://json-schema.org/draft-03/hyper-schema#'
|
|
854
|
+
*
|
|
855
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-5
|
|
856
|
+
*/
|
|
857
|
+
type JSONSchema4Version = string;
|
|
858
|
+
/**
|
|
859
|
+
* JSON Schema V4
|
|
860
|
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-04
|
|
861
|
+
*/
|
|
862
|
+
interface JSONSchema4 {
|
|
863
|
+
id?: string | undefined;
|
|
864
|
+
$ref?: string | undefined;
|
|
865
|
+
$schema?: JSONSchema4Version | undefined;
|
|
866
|
+
/**
|
|
867
|
+
* This attribute is a string that provides a short description of the
|
|
868
|
+
* instance property.
|
|
869
|
+
*
|
|
870
|
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.21
|
|
871
|
+
*/
|
|
872
|
+
title?: string | undefined;
|
|
873
|
+
/**
|
|
874
|
+
* This attribute is a string that provides a full description of the of
|
|
875
|
+
* purpose the instance property.
|
|
876
|
+
*
|
|
877
|
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.22
|
|
878
|
+
*/
|
|
879
|
+
description?: string | undefined;
|
|
880
|
+
default?: JSONSchema4Type | undefined;
|
|
881
|
+
multipleOf?: number | undefined;
|
|
882
|
+
maximum?: number | undefined;
|
|
883
|
+
exclusiveMaximum?: boolean | undefined;
|
|
884
|
+
minimum?: number | undefined;
|
|
885
|
+
exclusiveMinimum?: boolean | undefined;
|
|
886
|
+
maxLength?: number | undefined;
|
|
887
|
+
minLength?: number | undefined;
|
|
888
|
+
pattern?: string | undefined;
|
|
889
|
+
/**
|
|
890
|
+
* May only be defined when "items" is defined, and is a tuple of JSONSchemas.
|
|
891
|
+
*
|
|
892
|
+
* This provides a definition for additional items in an array instance
|
|
893
|
+
* when tuple definitions of the items is provided. This can be false
|
|
894
|
+
* to indicate additional items in the array are not allowed, or it can
|
|
895
|
+
* be a schema that defines the schema of the additional items.
|
|
896
|
+
*
|
|
897
|
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.6
|
|
898
|
+
*/
|
|
899
|
+
additionalItems?: boolean | JSONSchema4 | undefined;
|
|
900
|
+
/**
|
|
901
|
+
* This attribute defines the allowed items in an instance array, and
|
|
902
|
+
* MUST be a schema or an array of schemas. The default value is an
|
|
903
|
+
* empty schema which allows any value for items in the instance array.
|
|
904
|
+
*
|
|
905
|
+
* When this attribute value is a schema and the instance value is an
|
|
906
|
+
* array, then all the items in the array MUST be valid according to the
|
|
907
|
+
* schema.
|
|
908
|
+
*
|
|
909
|
+
* When this attribute value is an array of schemas and the instance
|
|
910
|
+
* value is an array, each position in the instance array MUST conform
|
|
911
|
+
* to the schema in the corresponding position for this array. This
|
|
912
|
+
* called tuple typing. When tuple typing is used, additional items are
|
|
913
|
+
* allowed, disallowed, or constrained by the "additionalItems"
|
|
914
|
+
* (Section 5.6) attribute using the same rules as
|
|
915
|
+
* "additionalProperties" (Section 5.4) for objects.
|
|
916
|
+
*
|
|
917
|
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.5
|
|
918
|
+
*/
|
|
919
|
+
items?: JSONSchema4 | JSONSchema4[] | undefined;
|
|
920
|
+
maxItems?: number | undefined;
|
|
921
|
+
minItems?: number | undefined;
|
|
922
|
+
uniqueItems?: boolean | undefined;
|
|
923
|
+
maxProperties?: number | undefined;
|
|
924
|
+
minProperties?: number | undefined;
|
|
925
|
+
/**
|
|
926
|
+
* This attribute indicates if the instance must have a value, and not
|
|
927
|
+
* be undefined. This is false by default, making the instance
|
|
928
|
+
* optional.
|
|
929
|
+
*
|
|
930
|
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.7
|
|
931
|
+
*/
|
|
932
|
+
required?: boolean | string[] | undefined;
|
|
933
|
+
/**
|
|
934
|
+
* This attribute defines a schema for all properties that are not
|
|
935
|
+
* explicitly defined in an object type definition. If specified, the
|
|
936
|
+
* value MUST be a schema or a boolean. If false is provided, no
|
|
937
|
+
* additional properties are allowed beyond the properties defined in
|
|
938
|
+
* the schema. The default value is an empty schema which allows any
|
|
939
|
+
* value for additional properties.
|
|
940
|
+
*
|
|
941
|
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.4
|
|
942
|
+
*/
|
|
943
|
+
additionalProperties?: boolean | JSONSchema4 | undefined;
|
|
944
|
+
definitions?: {
|
|
945
|
+
[k: string]: JSONSchema4;
|
|
946
|
+
} | undefined;
|
|
947
|
+
/**
|
|
948
|
+
* This attribute is an object with property definitions that define the
|
|
949
|
+
* valid values of instance object property values. When the instance
|
|
950
|
+
* value is an object, the property values of the instance object MUST
|
|
951
|
+
* conform to the property definitions in this object. In this object,
|
|
952
|
+
* each property definition's value MUST be a schema, and the property's
|
|
953
|
+
* name MUST be the name of the instance property that it defines. The
|
|
954
|
+
* instance property value MUST be valid according to the schema from
|
|
955
|
+
* the property definition. Properties are considered unordered, the
|
|
956
|
+
* order of the instance properties MAY be in any order.
|
|
957
|
+
*
|
|
958
|
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.2
|
|
959
|
+
*/
|
|
960
|
+
properties?: {
|
|
961
|
+
[k: string]: JSONSchema4;
|
|
962
|
+
} | undefined;
|
|
963
|
+
/**
|
|
964
|
+
* This attribute is an object that defines the schema for a set of
|
|
965
|
+
* property names of an object instance. The name of each property of
|
|
966
|
+
* this attribute's object is a regular expression pattern in the ECMA
|
|
967
|
+
* 262/Perl 5 format, while the value is a schema. If the pattern
|
|
968
|
+
* matches the name of a property on the instance object, the value of
|
|
969
|
+
* the instance's property MUST be valid against the pattern name's
|
|
970
|
+
* schema value.
|
|
971
|
+
*
|
|
972
|
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.3
|
|
973
|
+
*/
|
|
974
|
+
patternProperties?: {
|
|
975
|
+
[k: string]: JSONSchema4;
|
|
976
|
+
} | undefined;
|
|
977
|
+
dependencies?: {
|
|
978
|
+
[k: string]: JSONSchema4 | string[];
|
|
979
|
+
} | undefined;
|
|
980
|
+
/**
|
|
981
|
+
* This provides an enumeration of all possible values that are valid
|
|
982
|
+
* for the instance property. This MUST be an array, and each item in
|
|
983
|
+
* the array represents a possible value for the instance value. If
|
|
984
|
+
* this attribute is defined, the instance value MUST be one of the
|
|
985
|
+
* values in the array in order for the schema to be valid.
|
|
986
|
+
*
|
|
987
|
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.19
|
|
988
|
+
*/
|
|
989
|
+
enum?: JSONSchema4Type[] | undefined;
|
|
990
|
+
/**
|
|
991
|
+
* A single type, or a union of simple types
|
|
992
|
+
*/
|
|
993
|
+
type?: JSONSchema4TypeName | JSONSchema4TypeName[] | undefined;
|
|
994
|
+
allOf?: JSONSchema4[] | undefined;
|
|
995
|
+
anyOf?: JSONSchema4[] | undefined;
|
|
996
|
+
oneOf?: JSONSchema4[] | undefined;
|
|
997
|
+
not?: JSONSchema4 | undefined;
|
|
998
|
+
/**
|
|
999
|
+
* The value of this property MUST be another schema which will provide
|
|
1000
|
+
* a base schema which the current schema will inherit from. The
|
|
1001
|
+
* inheritance rules are such that any instance that is valid according
|
|
1002
|
+
* to the current schema MUST be valid according to the referenced
|
|
1003
|
+
* schema. This MAY also be an array, in which case, the instance MUST
|
|
1004
|
+
* be valid for all the schemas in the array. A schema that extends
|
|
1005
|
+
* another schema MAY define additional attributes, constrain existing
|
|
1006
|
+
* attributes, or add other constraints.
|
|
1007
|
+
*
|
|
1008
|
+
* Conceptually, the behavior of extends can be seen as validating an
|
|
1009
|
+
* instance against all constraints in the extending schema as well as
|
|
1010
|
+
* the extended schema(s).
|
|
1011
|
+
*
|
|
1012
|
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.26
|
|
1013
|
+
*/
|
|
1014
|
+
extends?: string | string[] | undefined;
|
|
1015
|
+
/**
|
|
1016
|
+
* @see https://tools.ietf.org/html/draft-zyp-json-schema-04#section-5.6
|
|
1017
|
+
*/
|
|
1018
|
+
[k: string]: any;
|
|
1019
|
+
format?: string | undefined;
|
|
1020
|
+
}
|
|
1021
|
+
//#endregion
|
|
1022
|
+
//#region src-js/plugins/json.d.ts
|
|
1023
|
+
/**
|
|
1024
|
+
* A JSON value.
|
|
1025
|
+
*/
|
|
1026
|
+
type JsonValue = JsonObject | JsonValue[] | string | number | boolean | null;
|
|
1027
|
+
/**
|
|
1028
|
+
* A JSON object.
|
|
1029
|
+
*/
|
|
1030
|
+
type JsonObject = {
|
|
1031
|
+
[key: string]: JsonValue;
|
|
1032
|
+
};
|
|
1033
|
+
//#endregion
|
|
1034
|
+
//#region src-js/plugins/options.d.ts
|
|
1035
|
+
/**
|
|
1036
|
+
* Options for a rule on a file.
|
|
1037
|
+
*/
|
|
1038
|
+
type Options = JsonValue[];
|
|
1039
|
+
/**
|
|
1040
|
+
* Schema describing valid options for a rule.
|
|
1041
|
+
* `schema` property of `RuleMeta`.
|
|
1042
|
+
*
|
|
1043
|
+
* Can be one of:
|
|
1044
|
+
* - `JSONSchema4` - Full JSON Schema object (must have `type: "array"` at root).
|
|
1045
|
+
* - `JSONSchema4[]` - Array shorthand where each element describes corresponding options element.
|
|
1046
|
+
* - `false` - Opts out of schema validation (not recommended).
|
|
1047
|
+
*/
|
|
1048
|
+
type RuleOptionsSchema = JSONSchema4 | JSONSchema4[] | false;
|
|
1049
|
+
//#endregion
|
|
1050
|
+
//#region src-js/plugins/tokens.d.ts
|
|
1051
|
+
/**
|
|
1052
|
+
* AST token type.
|
|
1053
|
+
*/
|
|
1054
|
+
type TokenType = BooleanToken | IdentifierToken | JSXIdentifierToken | JSXTextToken | KeywordToken | NullToken | NumericToken | PrivateIdentifierToken | PunctuatorToken | RegularExpressionToken | StringToken | TemplateToken;
|
|
1055
|
+
interface BaseToken extends Span {
|
|
1056
|
+
value: string;
|
|
1057
|
+
regex: undefined;
|
|
1058
|
+
}
|
|
1059
|
+
interface BooleanToken extends BaseToken {
|
|
1060
|
+
type: "Boolean";
|
|
1061
|
+
}
|
|
1062
|
+
interface IdentifierToken extends BaseToken {
|
|
1063
|
+
type: "Identifier";
|
|
1064
|
+
}
|
|
1065
|
+
interface JSXIdentifierToken extends BaseToken {
|
|
1066
|
+
type: "JSXIdentifier";
|
|
1067
|
+
}
|
|
1068
|
+
interface JSXTextToken extends BaseToken {
|
|
1069
|
+
type: "JSXText";
|
|
1070
|
+
}
|
|
1071
|
+
interface KeywordToken extends BaseToken {
|
|
1072
|
+
type: "Keyword";
|
|
1073
|
+
}
|
|
1074
|
+
interface NullToken extends BaseToken {
|
|
1075
|
+
type: "Null";
|
|
1076
|
+
}
|
|
1077
|
+
interface NumericToken extends BaseToken {
|
|
1078
|
+
type: "Numeric";
|
|
1079
|
+
}
|
|
1080
|
+
interface PrivateIdentifierToken extends BaseToken {
|
|
1081
|
+
type: "PrivateIdentifier";
|
|
1082
|
+
}
|
|
1083
|
+
interface PunctuatorToken extends BaseToken {
|
|
1084
|
+
type: "Punctuator";
|
|
1085
|
+
}
|
|
1086
|
+
interface RegularExpressionToken extends Span {
|
|
1087
|
+
type: "RegularExpression";
|
|
1088
|
+
value: string;
|
|
1089
|
+
regex: {
|
|
1090
|
+
pattern: string;
|
|
1091
|
+
flags: string;
|
|
1092
|
+
};
|
|
1093
|
+
}
|
|
1094
|
+
interface StringToken extends BaseToken {
|
|
1095
|
+
type: "String";
|
|
1096
|
+
}
|
|
1097
|
+
interface TemplateToken extends BaseToken {
|
|
1098
|
+
type: "Template";
|
|
1099
|
+
}
|
|
1100
|
+
type TokenOrComment = TokenType | Comment;
|
|
1101
|
+
//#endregion
|
|
1102
|
+
//#region src-js/generated/types.d.ts
|
|
1103
|
+
interface Program extends Span {
|
|
1104
|
+
type: "Program";
|
|
1105
|
+
body: Array<Directive | Statement>;
|
|
1106
|
+
sourceType: ModuleKind;
|
|
1107
|
+
hashbang: Hashbang | null;
|
|
1108
|
+
comments: Comment[];
|
|
1109
|
+
tokens: TokenType[];
|
|
1110
|
+
parent: null;
|
|
1111
|
+
}
|
|
1112
|
+
type Expression = BooleanLiteral | NullLiteral | NumericLiteral | BigIntLiteral | RegExpLiteral | StringLiteral | TemplateLiteral | IdentifierReference | MetaProperty | Super | ArrayExpression | ArrowFunctionExpression | AssignmentExpression | AwaitExpression | BinaryExpression | CallExpression | ChainExpression | Class | ConditionalExpression | Function$1 | ImportExpression | LogicalExpression | NewExpression | ObjectExpression | ParenthesizedExpression | SequenceExpression | TaggedTemplateExpression | ThisExpression | UnaryExpression | UpdateExpression | YieldExpression | PrivateInExpression | JSXElement | JSXFragment | TSAsExpression | TSSatisfiesExpression | TSTypeAssertion | TSNonNullExpression | TSInstantiationExpression | V8IntrinsicExpression | MemberExpression;
|
|
1113
|
+
interface IdentifierName extends Span {
|
|
1114
|
+
type: "Identifier";
|
|
1115
|
+
decorators?: [];
|
|
1116
|
+
name: string;
|
|
1117
|
+
optional?: false;
|
|
1118
|
+
typeAnnotation?: null;
|
|
1119
|
+
parent: Node$1;
|
|
1120
|
+
}
|
|
1121
|
+
interface IdentifierReference extends Span {
|
|
1122
|
+
type: "Identifier";
|
|
1123
|
+
decorators?: [];
|
|
1124
|
+
name: string;
|
|
1125
|
+
optional?: false;
|
|
1126
|
+
typeAnnotation?: null;
|
|
1127
|
+
parent: Node$1;
|
|
1128
|
+
}
|
|
1129
|
+
interface BindingIdentifier extends Span {
|
|
1130
|
+
type: "Identifier";
|
|
1131
|
+
decorators?: [];
|
|
1132
|
+
name: string;
|
|
1133
|
+
optional?: false;
|
|
1134
|
+
typeAnnotation?: null;
|
|
1135
|
+
parent: Node$1;
|
|
1136
|
+
}
|
|
1137
|
+
interface LabelIdentifier extends Span {
|
|
1138
|
+
type: "Identifier";
|
|
1139
|
+
decorators?: [];
|
|
1140
|
+
name: string;
|
|
1141
|
+
optional?: false;
|
|
1142
|
+
typeAnnotation?: null;
|
|
1143
|
+
parent: Node$1;
|
|
1144
|
+
}
|
|
1145
|
+
interface ThisExpression extends Span {
|
|
1146
|
+
type: "ThisExpression";
|
|
1147
|
+
parent: Node$1;
|
|
1148
|
+
}
|
|
1149
|
+
interface ArrayExpression extends Span {
|
|
1150
|
+
type: "ArrayExpression";
|
|
1151
|
+
elements: Array<ArrayExpressionElement>;
|
|
1152
|
+
parent: Node$1;
|
|
1153
|
+
}
|
|
1154
|
+
type ArrayExpressionElement = SpreadElement | null | Expression;
|
|
1155
|
+
interface ObjectExpression extends Span {
|
|
1156
|
+
type: "ObjectExpression";
|
|
1157
|
+
properties: Array<ObjectPropertyKind>;
|
|
1158
|
+
parent: Node$1;
|
|
1159
|
+
}
|
|
1160
|
+
type ObjectPropertyKind = ObjectProperty | SpreadElement;
|
|
1161
|
+
interface ObjectProperty extends Span {
|
|
1162
|
+
type: "Property";
|
|
1163
|
+
kind: PropertyKind;
|
|
1164
|
+
key: PropertyKey$1;
|
|
1165
|
+
value: Expression;
|
|
1166
|
+
method: boolean;
|
|
1167
|
+
shorthand: boolean;
|
|
1168
|
+
computed: boolean;
|
|
1169
|
+
optional?: false;
|
|
1170
|
+
parent: Node$1;
|
|
1171
|
+
}
|
|
1172
|
+
type PropertyKey$1 = IdentifierName | PrivateIdentifier | Expression;
|
|
1173
|
+
type PropertyKind = "init" | "get" | "set";
|
|
1174
|
+
interface TemplateLiteral extends Span {
|
|
1175
|
+
type: "TemplateLiteral";
|
|
1176
|
+
quasis: Array<TemplateElement>;
|
|
1177
|
+
expressions: Array<Expression>;
|
|
1178
|
+
parent: Node$1;
|
|
1179
|
+
}
|
|
1180
|
+
interface TaggedTemplateExpression extends Span {
|
|
1181
|
+
type: "TaggedTemplateExpression";
|
|
1182
|
+
tag: Expression;
|
|
1183
|
+
typeArguments?: TSTypeParameterInstantiation | null;
|
|
1184
|
+
quasi: TemplateLiteral;
|
|
1185
|
+
parent: Node$1;
|
|
1186
|
+
}
|
|
1187
|
+
interface TemplateElement extends Span {
|
|
1188
|
+
type: "TemplateElement";
|
|
1189
|
+
value: TemplateElementValue;
|
|
1190
|
+
tail: boolean;
|
|
1191
|
+
parent: Node$1;
|
|
1192
|
+
}
|
|
1193
|
+
interface TemplateElementValue {
|
|
1194
|
+
raw: string;
|
|
1195
|
+
cooked: string | null;
|
|
1196
|
+
}
|
|
1197
|
+
type MemberExpression = ComputedMemberExpression | StaticMemberExpression | PrivateFieldExpression;
|
|
1198
|
+
interface ComputedMemberExpression extends Span {
|
|
1199
|
+
type: "MemberExpression";
|
|
1200
|
+
object: Expression;
|
|
1201
|
+
property: Expression;
|
|
1202
|
+
optional: boolean;
|
|
1203
|
+
computed: true;
|
|
1204
|
+
parent: Node$1;
|
|
1205
|
+
}
|
|
1206
|
+
interface StaticMemberExpression extends Span {
|
|
1207
|
+
type: "MemberExpression";
|
|
1208
|
+
object: Expression;
|
|
1209
|
+
property: IdentifierName;
|
|
1210
|
+
optional: boolean;
|
|
1211
|
+
computed: false;
|
|
1212
|
+
parent: Node$1;
|
|
1213
|
+
}
|
|
1214
|
+
interface PrivateFieldExpression extends Span {
|
|
1215
|
+
type: "MemberExpression";
|
|
1216
|
+
object: Expression;
|
|
1217
|
+
property: PrivateIdentifier;
|
|
1218
|
+
optional: boolean;
|
|
1219
|
+
computed: false;
|
|
1220
|
+
parent: Node$1;
|
|
1221
|
+
}
|
|
1222
|
+
interface CallExpression extends Span {
|
|
1223
|
+
type: "CallExpression";
|
|
1224
|
+
callee: Expression;
|
|
1225
|
+
typeArguments?: TSTypeParameterInstantiation | null;
|
|
1226
|
+
arguments: Array<Argument>;
|
|
1227
|
+
optional: boolean;
|
|
1228
|
+
parent: Node$1;
|
|
1229
|
+
}
|
|
1230
|
+
interface NewExpression extends Span {
|
|
1231
|
+
type: "NewExpression";
|
|
1232
|
+
callee: Expression;
|
|
1233
|
+
typeArguments?: TSTypeParameterInstantiation | null;
|
|
1234
|
+
arguments: Array<Argument>;
|
|
1235
|
+
parent: Node$1;
|
|
1236
|
+
}
|
|
1237
|
+
interface MetaProperty extends Span {
|
|
1238
|
+
type: "MetaProperty";
|
|
1239
|
+
meta: IdentifierName;
|
|
1240
|
+
property: IdentifierName;
|
|
1241
|
+
parent: Node$1;
|
|
1242
|
+
}
|
|
1243
|
+
interface SpreadElement extends Span {
|
|
1244
|
+
type: "SpreadElement";
|
|
1245
|
+
argument: Expression;
|
|
1246
|
+
parent: Node$1;
|
|
1247
|
+
}
|
|
1248
|
+
type Argument = SpreadElement | Expression;
|
|
1249
|
+
interface UpdateExpression extends Span {
|
|
1250
|
+
type: "UpdateExpression";
|
|
1251
|
+
operator: UpdateOperator;
|
|
1252
|
+
prefix: boolean;
|
|
1253
|
+
argument: SimpleAssignmentTarget;
|
|
1254
|
+
parent: Node$1;
|
|
1255
|
+
}
|
|
1256
|
+
interface UnaryExpression extends Span {
|
|
1257
|
+
type: "UnaryExpression";
|
|
1258
|
+
operator: UnaryOperator;
|
|
1259
|
+
argument: Expression;
|
|
1260
|
+
prefix: true;
|
|
1261
|
+
parent: Node$1;
|
|
1262
|
+
}
|
|
1263
|
+
interface BinaryExpression extends Span {
|
|
1264
|
+
type: "BinaryExpression";
|
|
1265
|
+
left: Expression;
|
|
1266
|
+
operator: BinaryOperator;
|
|
1267
|
+
right: Expression;
|
|
1268
|
+
parent: Node$1;
|
|
1269
|
+
}
|
|
1270
|
+
interface PrivateInExpression extends Span {
|
|
1271
|
+
type: "BinaryExpression";
|
|
1272
|
+
left: PrivateIdentifier;
|
|
1273
|
+
operator: "in";
|
|
1274
|
+
right: Expression;
|
|
1275
|
+
parent: Node$1;
|
|
1276
|
+
}
|
|
1277
|
+
interface LogicalExpression extends Span {
|
|
1278
|
+
type: "LogicalExpression";
|
|
1279
|
+
left: Expression;
|
|
1280
|
+
operator: LogicalOperator;
|
|
1281
|
+
right: Expression;
|
|
1282
|
+
parent: Node$1;
|
|
1283
|
+
}
|
|
1284
|
+
interface ConditionalExpression extends Span {
|
|
1285
|
+
type: "ConditionalExpression";
|
|
1286
|
+
test: Expression;
|
|
1287
|
+
consequent: Expression;
|
|
1288
|
+
alternate: Expression;
|
|
1289
|
+
parent: Node$1;
|
|
1290
|
+
}
|
|
1291
|
+
interface AssignmentExpression extends Span {
|
|
1292
|
+
type: "AssignmentExpression";
|
|
1293
|
+
operator: AssignmentOperator;
|
|
1294
|
+
left: AssignmentTarget;
|
|
1295
|
+
right: Expression;
|
|
1296
|
+
parent: Node$1;
|
|
1297
|
+
}
|
|
1298
|
+
type AssignmentTarget = SimpleAssignmentTarget | AssignmentTargetPattern;
|
|
1299
|
+
type SimpleAssignmentTarget = IdentifierReference | TSAsExpression | TSSatisfiesExpression | TSNonNullExpression | TSTypeAssertion | MemberExpression;
|
|
1300
|
+
type AssignmentTargetPattern = ArrayAssignmentTarget | ObjectAssignmentTarget;
|
|
1301
|
+
interface ArrayAssignmentTarget extends Span {
|
|
1302
|
+
type: "ArrayPattern";
|
|
1303
|
+
decorators?: [];
|
|
1304
|
+
elements: Array<AssignmentTargetMaybeDefault | AssignmentTargetRest | null>;
|
|
1305
|
+
optional?: false;
|
|
1306
|
+
typeAnnotation?: null;
|
|
1307
|
+
parent: Node$1;
|
|
1308
|
+
}
|
|
1309
|
+
interface ObjectAssignmentTarget extends Span {
|
|
1310
|
+
type: "ObjectPattern";
|
|
1311
|
+
decorators?: [];
|
|
1312
|
+
properties: Array<AssignmentTargetProperty | AssignmentTargetRest>;
|
|
1313
|
+
optional?: false;
|
|
1314
|
+
typeAnnotation?: null;
|
|
1315
|
+
parent: Node$1;
|
|
1316
|
+
}
|
|
1317
|
+
interface AssignmentTargetRest extends Span {
|
|
1318
|
+
type: "RestElement";
|
|
1319
|
+
decorators?: [];
|
|
1320
|
+
argument: AssignmentTarget;
|
|
1321
|
+
optional?: false;
|
|
1322
|
+
typeAnnotation?: null;
|
|
1323
|
+
value?: null;
|
|
1324
|
+
parent: Node$1;
|
|
1325
|
+
}
|
|
1326
|
+
type AssignmentTargetMaybeDefault = AssignmentTargetWithDefault | AssignmentTarget;
|
|
1327
|
+
interface AssignmentTargetWithDefault extends Span {
|
|
1328
|
+
type: "AssignmentPattern";
|
|
1329
|
+
decorators?: [];
|
|
1330
|
+
left: AssignmentTarget;
|
|
1331
|
+
right: Expression;
|
|
1332
|
+
optional?: false;
|
|
1333
|
+
typeAnnotation?: null;
|
|
1334
|
+
parent: Node$1;
|
|
1335
|
+
}
|
|
1336
|
+
type AssignmentTargetProperty = AssignmentTargetPropertyIdentifier | AssignmentTargetPropertyProperty;
|
|
1337
|
+
interface AssignmentTargetPropertyIdentifier extends Span {
|
|
1338
|
+
type: "Property";
|
|
1339
|
+
kind: "init";
|
|
1340
|
+
key: IdentifierReference;
|
|
1341
|
+
value: IdentifierReference | AssignmentTargetWithDefault;
|
|
1342
|
+
method: false;
|
|
1343
|
+
shorthand: true;
|
|
1344
|
+
computed: false;
|
|
1345
|
+
optional?: false;
|
|
1346
|
+
parent: Node$1;
|
|
1347
|
+
}
|
|
1348
|
+
interface AssignmentTargetPropertyProperty extends Span {
|
|
1349
|
+
type: "Property";
|
|
1350
|
+
kind: "init";
|
|
1351
|
+
key: PropertyKey$1;
|
|
1352
|
+
value: AssignmentTargetMaybeDefault;
|
|
1353
|
+
method: false;
|
|
1354
|
+
shorthand: false;
|
|
1355
|
+
computed: boolean;
|
|
1356
|
+
optional?: false;
|
|
1357
|
+
parent: Node$1;
|
|
1358
|
+
}
|
|
1359
|
+
interface SequenceExpression extends Span {
|
|
1360
|
+
type: "SequenceExpression";
|
|
1361
|
+
expressions: Array<Expression>;
|
|
1362
|
+
parent: Node$1;
|
|
1363
|
+
}
|
|
1364
|
+
interface Super extends Span {
|
|
1365
|
+
type: "Super";
|
|
1366
|
+
parent: Node$1;
|
|
1367
|
+
}
|
|
1368
|
+
interface AwaitExpression extends Span {
|
|
1369
|
+
type: "AwaitExpression";
|
|
1370
|
+
argument: Expression;
|
|
1371
|
+
parent: Node$1;
|
|
1372
|
+
}
|
|
1373
|
+
interface ChainExpression extends Span {
|
|
1374
|
+
type: "ChainExpression";
|
|
1375
|
+
expression: ChainElement;
|
|
1376
|
+
parent: Node$1;
|
|
1377
|
+
}
|
|
1378
|
+
type ChainElement = CallExpression | TSNonNullExpression | MemberExpression;
|
|
1379
|
+
interface ParenthesizedExpression extends Span {
|
|
1380
|
+
type: "ParenthesizedExpression";
|
|
1381
|
+
expression: Expression;
|
|
1382
|
+
parent: Node$1;
|
|
1383
|
+
}
|
|
1384
|
+
type Statement = BlockStatement | BreakStatement | ContinueStatement | DebuggerStatement | DoWhileStatement | EmptyStatement | ExpressionStatement | ForInStatement | ForOfStatement | ForStatement | IfStatement | LabeledStatement | ReturnStatement | SwitchStatement | ThrowStatement | TryStatement | WhileStatement | WithStatement | Declaration | ModuleDeclaration;
|
|
1385
|
+
interface Directive extends Span {
|
|
1386
|
+
type: "ExpressionStatement";
|
|
1387
|
+
expression: StringLiteral;
|
|
1388
|
+
directive: string;
|
|
1389
|
+
parent: Node$1;
|
|
1390
|
+
}
|
|
1391
|
+
interface Hashbang extends Span {
|
|
1392
|
+
type: "Hashbang";
|
|
1393
|
+
value: string;
|
|
1394
|
+
parent: Node$1;
|
|
1395
|
+
}
|
|
1396
|
+
interface BlockStatement extends Span {
|
|
1397
|
+
type: "BlockStatement";
|
|
1398
|
+
body: Array<Statement>;
|
|
1399
|
+
parent: Node$1;
|
|
1400
|
+
}
|
|
1401
|
+
type Declaration = VariableDeclaration | Function$1 | Class | TSTypeAliasDeclaration | TSInterfaceDeclaration | TSEnumDeclaration | TSModuleDeclaration | TSGlobalDeclaration | TSImportEqualsDeclaration;
|
|
1402
|
+
interface VariableDeclaration extends Span {
|
|
1403
|
+
type: "VariableDeclaration";
|
|
1404
|
+
kind: VariableDeclarationKind;
|
|
1405
|
+
declarations: Array<VariableDeclarator>;
|
|
1406
|
+
declare?: boolean;
|
|
1407
|
+
parent: Node$1;
|
|
1408
|
+
}
|
|
1409
|
+
type VariableDeclarationKind = "var" | "let" | "const" | "using" | "await using";
|
|
1410
|
+
interface VariableDeclarator extends Span {
|
|
1411
|
+
type: "VariableDeclarator";
|
|
1412
|
+
id: BindingPattern;
|
|
1413
|
+
init: Expression | null;
|
|
1414
|
+
definite?: boolean;
|
|
1415
|
+
parent: Node$1;
|
|
1416
|
+
}
|
|
1417
|
+
interface EmptyStatement extends Span {
|
|
1418
|
+
type: "EmptyStatement";
|
|
1419
|
+
parent: Node$1;
|
|
1420
|
+
}
|
|
1421
|
+
interface ExpressionStatement extends Span {
|
|
1422
|
+
type: "ExpressionStatement";
|
|
1423
|
+
expression: Expression;
|
|
1424
|
+
directive?: string | null;
|
|
1425
|
+
parent: Node$1;
|
|
1426
|
+
}
|
|
1427
|
+
interface IfStatement extends Span {
|
|
1428
|
+
type: "IfStatement";
|
|
1429
|
+
test: Expression;
|
|
1430
|
+
consequent: Statement;
|
|
1431
|
+
alternate: Statement | null;
|
|
1432
|
+
parent: Node$1;
|
|
1433
|
+
}
|
|
1434
|
+
interface DoWhileStatement extends Span {
|
|
1435
|
+
type: "DoWhileStatement";
|
|
1436
|
+
body: Statement;
|
|
1437
|
+
test: Expression;
|
|
1438
|
+
parent: Node$1;
|
|
1439
|
+
}
|
|
1440
|
+
interface WhileStatement extends Span {
|
|
1441
|
+
type: "WhileStatement";
|
|
1442
|
+
test: Expression;
|
|
1443
|
+
body: Statement;
|
|
1444
|
+
parent: Node$1;
|
|
1445
|
+
}
|
|
1446
|
+
interface ForStatement extends Span {
|
|
1447
|
+
type: "ForStatement";
|
|
1448
|
+
init: ForStatementInit | null;
|
|
1449
|
+
test: Expression | null;
|
|
1450
|
+
update: Expression | null;
|
|
1451
|
+
body: Statement;
|
|
1452
|
+
parent: Node$1;
|
|
1453
|
+
}
|
|
1454
|
+
type ForStatementInit = VariableDeclaration | Expression;
|
|
1455
|
+
interface ForInStatement extends Span {
|
|
1456
|
+
type: "ForInStatement";
|
|
1457
|
+
left: ForStatementLeft;
|
|
1458
|
+
right: Expression;
|
|
1459
|
+
body: Statement;
|
|
1460
|
+
parent: Node$1;
|
|
1461
|
+
}
|
|
1462
|
+
type ForStatementLeft = VariableDeclaration | AssignmentTarget;
|
|
1463
|
+
interface ForOfStatement extends Span {
|
|
1464
|
+
type: "ForOfStatement";
|
|
1465
|
+
await: boolean;
|
|
1466
|
+
left: ForStatementLeft;
|
|
1467
|
+
right: Expression;
|
|
1468
|
+
body: Statement;
|
|
1469
|
+
parent: Node$1;
|
|
1470
|
+
}
|
|
1471
|
+
interface ContinueStatement extends Span {
|
|
1472
|
+
type: "ContinueStatement";
|
|
1473
|
+
label: LabelIdentifier | null;
|
|
1474
|
+
parent: Node$1;
|
|
1475
|
+
}
|
|
1476
|
+
interface BreakStatement extends Span {
|
|
1477
|
+
type: "BreakStatement";
|
|
1478
|
+
label: LabelIdentifier | null;
|
|
1479
|
+
parent: Node$1;
|
|
1480
|
+
}
|
|
1481
|
+
interface ReturnStatement extends Span {
|
|
1482
|
+
type: "ReturnStatement";
|
|
1483
|
+
argument: Expression | null;
|
|
1484
|
+
parent: Node$1;
|
|
1485
|
+
}
|
|
1486
|
+
interface WithStatement extends Span {
|
|
1487
|
+
type: "WithStatement";
|
|
1488
|
+
object: Expression;
|
|
1489
|
+
body: Statement;
|
|
1490
|
+
parent: Node$1;
|
|
1491
|
+
}
|
|
1492
|
+
interface SwitchStatement extends Span {
|
|
1493
|
+
type: "SwitchStatement";
|
|
1494
|
+
discriminant: Expression;
|
|
1495
|
+
cases: Array<SwitchCase>;
|
|
1496
|
+
parent: Node$1;
|
|
1497
|
+
}
|
|
1498
|
+
interface SwitchCase extends Span {
|
|
1499
|
+
type: "SwitchCase";
|
|
1500
|
+
test: Expression | null;
|
|
1501
|
+
consequent: Array<Statement>;
|
|
1502
|
+
parent: Node$1;
|
|
1503
|
+
}
|
|
1504
|
+
interface LabeledStatement extends Span {
|
|
1505
|
+
type: "LabeledStatement";
|
|
1506
|
+
label: LabelIdentifier;
|
|
1507
|
+
body: Statement;
|
|
1508
|
+
parent: Node$1;
|
|
1509
|
+
}
|
|
1510
|
+
interface ThrowStatement extends Span {
|
|
1511
|
+
type: "ThrowStatement";
|
|
1512
|
+
argument: Expression;
|
|
1513
|
+
parent: Node$1;
|
|
1514
|
+
}
|
|
1515
|
+
interface TryStatement extends Span {
|
|
1516
|
+
type: "TryStatement";
|
|
1517
|
+
block: BlockStatement;
|
|
1518
|
+
handler: CatchClause | null;
|
|
1519
|
+
finalizer: BlockStatement | null;
|
|
1520
|
+
parent: Node$1;
|
|
1521
|
+
}
|
|
1522
|
+
interface CatchClause extends Span {
|
|
1523
|
+
type: "CatchClause";
|
|
1524
|
+
param: BindingPattern | null;
|
|
1525
|
+
body: BlockStatement;
|
|
1526
|
+
parent: Node$1;
|
|
1527
|
+
}
|
|
1528
|
+
interface DebuggerStatement extends Span {
|
|
1529
|
+
type: "DebuggerStatement";
|
|
1530
|
+
parent: Node$1;
|
|
1531
|
+
}
|
|
1532
|
+
type BindingPattern = BindingIdentifier | ObjectPattern | ArrayPattern | AssignmentPattern;
|
|
1533
|
+
interface AssignmentPattern extends Span {
|
|
1534
|
+
type: "AssignmentPattern";
|
|
1535
|
+
decorators?: [];
|
|
1536
|
+
left: BindingPattern;
|
|
1537
|
+
right: Expression;
|
|
1538
|
+
optional?: false;
|
|
1539
|
+
typeAnnotation?: null;
|
|
1540
|
+
parent: Node$1;
|
|
1541
|
+
}
|
|
1542
|
+
interface ObjectPattern extends Span {
|
|
1543
|
+
type: "ObjectPattern";
|
|
1544
|
+
decorators?: [];
|
|
1545
|
+
properties: Array<BindingProperty | BindingRestElement>;
|
|
1546
|
+
optional?: false;
|
|
1547
|
+
typeAnnotation?: null;
|
|
1548
|
+
parent: Node$1;
|
|
1549
|
+
}
|
|
1550
|
+
interface BindingProperty extends Span {
|
|
1551
|
+
type: "Property";
|
|
1552
|
+
kind: "init";
|
|
1553
|
+
key: PropertyKey$1;
|
|
1554
|
+
value: BindingPattern;
|
|
1555
|
+
method: false;
|
|
1556
|
+
shorthand: boolean;
|
|
1557
|
+
computed: boolean;
|
|
1558
|
+
optional?: false;
|
|
1559
|
+
parent: Node$1;
|
|
1560
|
+
}
|
|
1561
|
+
interface ArrayPattern extends Span {
|
|
1562
|
+
type: "ArrayPattern";
|
|
1563
|
+
decorators?: [];
|
|
1564
|
+
elements: Array<BindingPattern | BindingRestElement | null>;
|
|
1565
|
+
optional?: false;
|
|
1566
|
+
typeAnnotation?: null;
|
|
1567
|
+
parent: Node$1;
|
|
1568
|
+
}
|
|
1569
|
+
interface BindingRestElement extends Span {
|
|
1570
|
+
type: "RestElement";
|
|
1571
|
+
decorators?: [];
|
|
1572
|
+
argument: BindingPattern;
|
|
1573
|
+
optional?: false;
|
|
1574
|
+
typeAnnotation?: null;
|
|
1575
|
+
value?: null;
|
|
1576
|
+
parent: Node$1;
|
|
1577
|
+
}
|
|
1578
|
+
interface Function$1 extends Span {
|
|
1579
|
+
type: FunctionType;
|
|
1580
|
+
id: BindingIdentifier | null;
|
|
1581
|
+
generator: boolean;
|
|
1582
|
+
async: boolean;
|
|
1583
|
+
declare?: boolean;
|
|
1584
|
+
typeParameters?: TSTypeParameterDeclaration | null;
|
|
1585
|
+
params: ParamPattern[];
|
|
1586
|
+
returnType?: TSTypeAnnotation | null;
|
|
1587
|
+
body: FunctionBody | null;
|
|
1588
|
+
expression: false;
|
|
1589
|
+
parent: Node$1;
|
|
1590
|
+
}
|
|
1591
|
+
type ParamPattern = FormalParameter | TSParameterProperty | FormalParameterRest;
|
|
1592
|
+
type FunctionType = "FunctionDeclaration" | "FunctionExpression" | "TSDeclareFunction" | "TSEmptyBodyFunctionExpression";
|
|
1593
|
+
interface FormalParameterRest extends Span {
|
|
1594
|
+
type: "RestElement";
|
|
1595
|
+
argument: BindingPattern;
|
|
1596
|
+
decorators?: [];
|
|
1597
|
+
optional?: boolean;
|
|
1598
|
+
typeAnnotation?: TSTypeAnnotation | null;
|
|
1599
|
+
value?: null;
|
|
1600
|
+
parent: Node$1;
|
|
1601
|
+
}
|
|
1602
|
+
type FormalParameter = {
|
|
1603
|
+
decorators?: Array<Decorator>;
|
|
1604
|
+
} & BindingPattern;
|
|
1605
|
+
interface TSParameterProperty extends Span {
|
|
1606
|
+
type: "TSParameterProperty";
|
|
1607
|
+
accessibility: TSAccessibility | null;
|
|
1608
|
+
decorators: Array<Decorator>;
|
|
1609
|
+
override: boolean;
|
|
1610
|
+
parameter: FormalParameter;
|
|
1611
|
+
readonly: boolean;
|
|
1612
|
+
static: boolean;
|
|
1613
|
+
parent: Node$1;
|
|
1614
|
+
}
|
|
1615
|
+
interface FunctionBody extends Span {
|
|
1616
|
+
type: "BlockStatement";
|
|
1617
|
+
body: Array<Directive | Statement>;
|
|
1618
|
+
parent: Node$1;
|
|
1619
|
+
}
|
|
1620
|
+
interface ArrowFunctionExpression extends Span {
|
|
1621
|
+
type: "ArrowFunctionExpression";
|
|
1622
|
+
expression: boolean;
|
|
1623
|
+
async: boolean;
|
|
1624
|
+
typeParameters?: TSTypeParameterDeclaration | null;
|
|
1625
|
+
params: ParamPattern[];
|
|
1626
|
+
returnType?: TSTypeAnnotation | null;
|
|
1627
|
+
body: FunctionBody | Expression;
|
|
1628
|
+
id: null;
|
|
1629
|
+
generator: false;
|
|
1630
|
+
parent: Node$1;
|
|
1631
|
+
}
|
|
1632
|
+
interface YieldExpression extends Span {
|
|
1633
|
+
type: "YieldExpression";
|
|
1634
|
+
delegate: boolean;
|
|
1635
|
+
argument: Expression | null;
|
|
1636
|
+
parent: Node$1;
|
|
1637
|
+
}
|
|
1638
|
+
interface Class extends Span {
|
|
1639
|
+
type: ClassType;
|
|
1640
|
+
decorators: Array<Decorator>;
|
|
1641
|
+
id: BindingIdentifier | null;
|
|
1642
|
+
typeParameters?: TSTypeParameterDeclaration | null;
|
|
1643
|
+
superClass: Expression | null;
|
|
1644
|
+
superTypeArguments?: TSTypeParameterInstantiation | null;
|
|
1645
|
+
implements?: Array<TSClassImplements>;
|
|
1646
|
+
body: ClassBody;
|
|
1647
|
+
abstract?: boolean;
|
|
1648
|
+
declare?: boolean;
|
|
1649
|
+
parent: Node$1;
|
|
1650
|
+
}
|
|
1651
|
+
type ClassType = "ClassDeclaration" | "ClassExpression";
|
|
1652
|
+
interface ClassBody extends Span {
|
|
1653
|
+
type: "ClassBody";
|
|
1654
|
+
body: Array<ClassElement>;
|
|
1655
|
+
parent: Node$1;
|
|
1656
|
+
}
|
|
1657
|
+
type ClassElement = StaticBlock | MethodDefinition | PropertyDefinition | AccessorProperty | TSIndexSignature;
|
|
1658
|
+
interface MethodDefinition extends Span {
|
|
1659
|
+
type: MethodDefinitionType;
|
|
1660
|
+
decorators: Array<Decorator>;
|
|
1661
|
+
key: PropertyKey$1;
|
|
1662
|
+
value: Function$1;
|
|
1663
|
+
kind: MethodDefinitionKind;
|
|
1664
|
+
computed: boolean;
|
|
1665
|
+
static: boolean;
|
|
1666
|
+
override?: boolean;
|
|
1667
|
+
optional?: boolean;
|
|
1668
|
+
accessibility?: TSAccessibility | null;
|
|
1669
|
+
parent: Node$1;
|
|
1670
|
+
}
|
|
1671
|
+
type MethodDefinitionType = "MethodDefinition" | "TSAbstractMethodDefinition";
|
|
1672
|
+
interface PropertyDefinition extends Span {
|
|
1673
|
+
type: PropertyDefinitionType;
|
|
1674
|
+
decorators: Array<Decorator>;
|
|
1675
|
+
key: PropertyKey$1;
|
|
1676
|
+
typeAnnotation?: TSTypeAnnotation | null;
|
|
1677
|
+
value: Expression | null;
|
|
1678
|
+
computed: boolean;
|
|
1679
|
+
static: boolean;
|
|
1680
|
+
declare?: boolean;
|
|
1681
|
+
override?: boolean;
|
|
1682
|
+
optional?: boolean;
|
|
1683
|
+
definite?: boolean;
|
|
1684
|
+
readonly?: boolean;
|
|
1685
|
+
accessibility?: TSAccessibility | null;
|
|
1686
|
+
parent: Node$1;
|
|
1687
|
+
}
|
|
1688
|
+
type PropertyDefinitionType = "PropertyDefinition" | "TSAbstractPropertyDefinition";
|
|
1689
|
+
type MethodDefinitionKind = "constructor" | "method" | "get" | "set";
|
|
1690
|
+
interface PrivateIdentifier extends Span {
|
|
1691
|
+
type: "PrivateIdentifier";
|
|
1692
|
+
name: string;
|
|
1693
|
+
parent: Node$1;
|
|
1694
|
+
}
|
|
1695
|
+
interface StaticBlock extends Span {
|
|
1696
|
+
type: "StaticBlock";
|
|
1697
|
+
body: Array<Statement>;
|
|
1698
|
+
parent: Node$1;
|
|
1699
|
+
}
|
|
1700
|
+
type ModuleDeclaration = ImportDeclaration | ExportAllDeclaration | ExportDefaultDeclaration | ExportNamedDeclaration | TSExportAssignment | TSNamespaceExportDeclaration;
|
|
1701
|
+
type AccessorPropertyType = "AccessorProperty" | "TSAbstractAccessorProperty";
|
|
1702
|
+
interface AccessorProperty extends Span {
|
|
1703
|
+
type: AccessorPropertyType;
|
|
1704
|
+
decorators: Array<Decorator>;
|
|
1705
|
+
key: PropertyKey$1;
|
|
1706
|
+
typeAnnotation?: TSTypeAnnotation | null;
|
|
1707
|
+
value: Expression | null;
|
|
1708
|
+
computed: boolean;
|
|
1709
|
+
static: boolean;
|
|
1710
|
+
override?: boolean;
|
|
1711
|
+
definite?: boolean;
|
|
1712
|
+
accessibility?: TSAccessibility | null;
|
|
1713
|
+
declare?: false;
|
|
1714
|
+
optional?: false;
|
|
1715
|
+
readonly?: false;
|
|
1716
|
+
parent: Node$1;
|
|
1717
|
+
}
|
|
1718
|
+
interface ImportExpression extends Span {
|
|
1719
|
+
type: "ImportExpression";
|
|
1720
|
+
source: Expression;
|
|
1721
|
+
options: Expression | null;
|
|
1722
|
+
phase: ImportPhase | null;
|
|
1723
|
+
parent: Node$1;
|
|
1724
|
+
}
|
|
1725
|
+
interface ImportDeclaration extends Span {
|
|
1726
|
+
type: "ImportDeclaration";
|
|
1727
|
+
specifiers: Array<ImportDeclarationSpecifier>;
|
|
1728
|
+
source: StringLiteral;
|
|
1729
|
+
phase: ImportPhase | null;
|
|
1730
|
+
attributes: Array<ImportAttribute>;
|
|
1731
|
+
importKind?: ImportOrExportKind;
|
|
1732
|
+
parent: Node$1;
|
|
1733
|
+
}
|
|
1734
|
+
type ImportPhase = "source" | "defer";
|
|
1735
|
+
type ImportDeclarationSpecifier = ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier;
|
|
1736
|
+
interface ImportSpecifier extends Span {
|
|
1737
|
+
type: "ImportSpecifier";
|
|
1738
|
+
imported: ModuleExportName;
|
|
1739
|
+
local: BindingIdentifier;
|
|
1740
|
+
importKind?: ImportOrExportKind;
|
|
1741
|
+
parent: Node$1;
|
|
1742
|
+
}
|
|
1743
|
+
interface ImportDefaultSpecifier extends Span {
|
|
1744
|
+
type: "ImportDefaultSpecifier";
|
|
1745
|
+
local: BindingIdentifier;
|
|
1746
|
+
parent: Node$1;
|
|
1747
|
+
}
|
|
1748
|
+
interface ImportNamespaceSpecifier extends Span {
|
|
1749
|
+
type: "ImportNamespaceSpecifier";
|
|
1750
|
+
local: BindingIdentifier;
|
|
1751
|
+
parent: Node$1;
|
|
1752
|
+
}
|
|
1753
|
+
interface ImportAttribute extends Span {
|
|
1754
|
+
type: "ImportAttribute";
|
|
1755
|
+
key: ImportAttributeKey;
|
|
1756
|
+
value: StringLiteral;
|
|
1757
|
+
parent: Node$1;
|
|
1758
|
+
}
|
|
1759
|
+
type ImportAttributeKey = IdentifierName | StringLiteral;
|
|
1760
|
+
interface ExportNamedDeclaration extends Span {
|
|
1761
|
+
type: "ExportNamedDeclaration";
|
|
1762
|
+
declaration: Declaration | null;
|
|
1763
|
+
specifiers: Array<ExportSpecifier>;
|
|
1764
|
+
source: StringLiteral | null;
|
|
1765
|
+
exportKind?: ImportOrExportKind;
|
|
1766
|
+
attributes: Array<ImportAttribute>;
|
|
1767
|
+
parent: Node$1;
|
|
1768
|
+
}
|
|
1769
|
+
interface ExportDefaultDeclaration extends Span {
|
|
1770
|
+
type: "ExportDefaultDeclaration";
|
|
1771
|
+
declaration: ExportDefaultDeclarationKind;
|
|
1772
|
+
exportKind?: "value";
|
|
1773
|
+
parent: Node$1;
|
|
1774
|
+
}
|
|
1775
|
+
interface ExportAllDeclaration extends Span {
|
|
1776
|
+
type: "ExportAllDeclaration";
|
|
1777
|
+
exported: ModuleExportName | null;
|
|
1778
|
+
source: StringLiteral;
|
|
1779
|
+
attributes: Array<ImportAttribute>;
|
|
1780
|
+
exportKind?: ImportOrExportKind;
|
|
1781
|
+
parent: Node$1;
|
|
1782
|
+
}
|
|
1783
|
+
interface ExportSpecifier extends Span {
|
|
1784
|
+
type: "ExportSpecifier";
|
|
1785
|
+
local: ModuleExportName;
|
|
1786
|
+
exported: ModuleExportName;
|
|
1787
|
+
exportKind?: ImportOrExportKind;
|
|
1788
|
+
parent: Node$1;
|
|
1789
|
+
}
|
|
1790
|
+
type ExportDefaultDeclarationKind = Function$1 | Class | TSInterfaceDeclaration | Expression;
|
|
1791
|
+
type ModuleExportName = IdentifierName | IdentifierReference | StringLiteral;
|
|
1792
|
+
interface V8IntrinsicExpression extends Span {
|
|
1793
|
+
type: "V8IntrinsicExpression";
|
|
1794
|
+
name: IdentifierName;
|
|
1795
|
+
arguments: Array<Argument>;
|
|
1796
|
+
parent: Node$1;
|
|
1797
|
+
}
|
|
1798
|
+
interface BooleanLiteral extends Span {
|
|
1799
|
+
type: "Literal";
|
|
1800
|
+
value: boolean;
|
|
1801
|
+
raw: string | null;
|
|
1802
|
+
parent: Node$1;
|
|
1803
|
+
}
|
|
1804
|
+
interface NullLiteral extends Span {
|
|
1805
|
+
type: "Literal";
|
|
1806
|
+
value: null;
|
|
1807
|
+
raw: "null" | null;
|
|
1808
|
+
parent: Node$1;
|
|
1809
|
+
}
|
|
1810
|
+
interface NumericLiteral extends Span {
|
|
1811
|
+
type: "Literal";
|
|
1812
|
+
value: number;
|
|
1813
|
+
raw: string | null;
|
|
1814
|
+
parent: Node$1;
|
|
1815
|
+
}
|
|
1816
|
+
interface StringLiteral extends Span {
|
|
1817
|
+
type: "Literal";
|
|
1818
|
+
value: string;
|
|
1819
|
+
raw: string | null;
|
|
1820
|
+
parent: Node$1;
|
|
1821
|
+
}
|
|
1822
|
+
interface BigIntLiteral extends Span {
|
|
1823
|
+
type: "Literal";
|
|
1824
|
+
value: bigint;
|
|
1825
|
+
raw: string | null;
|
|
1826
|
+
bigint: string;
|
|
1827
|
+
parent: Node$1;
|
|
1828
|
+
}
|
|
1829
|
+
interface RegExpLiteral extends Span {
|
|
1830
|
+
type: "Literal";
|
|
1831
|
+
value: RegExp | null;
|
|
1832
|
+
raw: string | null;
|
|
1833
|
+
regex: {
|
|
1834
|
+
pattern: string;
|
|
1835
|
+
flags: string;
|
|
1836
|
+
};
|
|
1837
|
+
parent: Node$1;
|
|
1838
|
+
}
|
|
1839
|
+
interface JSXElement extends Span {
|
|
1840
|
+
type: "JSXElement";
|
|
1841
|
+
openingElement: JSXOpeningElement;
|
|
1842
|
+
children: Array<JSXChild>;
|
|
1843
|
+
closingElement: JSXClosingElement | null;
|
|
1844
|
+
parent: Node$1;
|
|
1845
|
+
}
|
|
1846
|
+
interface JSXOpeningElement extends Span {
|
|
1847
|
+
type: "JSXOpeningElement";
|
|
1848
|
+
name: JSXElementName;
|
|
1849
|
+
typeArguments?: TSTypeParameterInstantiation | null;
|
|
1850
|
+
attributes: Array<JSXAttributeItem>;
|
|
1851
|
+
selfClosing: boolean;
|
|
1852
|
+
parent: Node$1;
|
|
1853
|
+
}
|
|
1854
|
+
interface JSXClosingElement extends Span {
|
|
1855
|
+
type: "JSXClosingElement";
|
|
1856
|
+
name: JSXElementName;
|
|
1857
|
+
parent: Node$1;
|
|
1858
|
+
}
|
|
1859
|
+
interface JSXFragment extends Span {
|
|
1860
|
+
type: "JSXFragment";
|
|
1861
|
+
openingFragment: JSXOpeningFragment;
|
|
1862
|
+
children: Array<JSXChild>;
|
|
1863
|
+
closingFragment: JSXClosingFragment;
|
|
1864
|
+
parent: Node$1;
|
|
1865
|
+
}
|
|
1866
|
+
interface JSXOpeningFragment extends Span {
|
|
1867
|
+
type: "JSXOpeningFragment";
|
|
1868
|
+
attributes?: [];
|
|
1869
|
+
selfClosing?: false;
|
|
1870
|
+
parent: Node$1;
|
|
1871
|
+
}
|
|
1872
|
+
interface JSXClosingFragment extends Span {
|
|
1873
|
+
type: "JSXClosingFragment";
|
|
1874
|
+
parent: Node$1;
|
|
1875
|
+
}
|
|
1876
|
+
type JSXElementName = JSXIdentifier | JSXNamespacedName | JSXMemberExpression;
|
|
1877
|
+
interface JSXNamespacedName extends Span {
|
|
1878
|
+
type: "JSXNamespacedName";
|
|
1879
|
+
namespace: JSXIdentifier;
|
|
1880
|
+
name: JSXIdentifier;
|
|
1881
|
+
parent: Node$1;
|
|
1882
|
+
}
|
|
1883
|
+
interface JSXMemberExpression extends Span {
|
|
1884
|
+
type: "JSXMemberExpression";
|
|
1885
|
+
object: JSXMemberExpressionObject;
|
|
1886
|
+
property: JSXIdentifier;
|
|
1887
|
+
parent: Node$1;
|
|
1888
|
+
}
|
|
1889
|
+
type JSXMemberExpressionObject = JSXIdentifier | JSXMemberExpression;
|
|
1890
|
+
interface JSXExpressionContainer extends Span {
|
|
1891
|
+
type: "JSXExpressionContainer";
|
|
1892
|
+
expression: JSXExpression;
|
|
1893
|
+
parent: Node$1;
|
|
1894
|
+
}
|
|
1895
|
+
type JSXExpression = JSXEmptyExpression | Expression;
|
|
1896
|
+
interface JSXEmptyExpression extends Span {
|
|
1897
|
+
type: "JSXEmptyExpression";
|
|
1898
|
+
parent: Node$1;
|
|
1899
|
+
}
|
|
1900
|
+
type JSXAttributeItem = JSXAttribute | JSXSpreadAttribute;
|
|
1901
|
+
interface JSXAttribute extends Span {
|
|
1902
|
+
type: "JSXAttribute";
|
|
1903
|
+
name: JSXAttributeName;
|
|
1904
|
+
value: JSXAttributeValue | null;
|
|
1905
|
+
parent: Node$1;
|
|
1906
|
+
}
|
|
1907
|
+
interface JSXSpreadAttribute extends Span {
|
|
1908
|
+
type: "JSXSpreadAttribute";
|
|
1909
|
+
argument: Expression;
|
|
1910
|
+
parent: Node$1;
|
|
1911
|
+
}
|
|
1912
|
+
type JSXAttributeName = JSXIdentifier | JSXNamespacedName;
|
|
1913
|
+
type JSXAttributeValue = StringLiteral | JSXExpressionContainer | JSXElement | JSXFragment;
|
|
1914
|
+
interface JSXIdentifier extends Span {
|
|
1915
|
+
type: "JSXIdentifier";
|
|
1916
|
+
name: string;
|
|
1917
|
+
parent: Node$1;
|
|
1918
|
+
}
|
|
1919
|
+
type JSXChild = JSXText | JSXElement | JSXFragment | JSXExpressionContainer | JSXSpreadChild;
|
|
1920
|
+
interface JSXSpreadChild extends Span {
|
|
1921
|
+
type: "JSXSpreadChild";
|
|
1922
|
+
expression: Expression;
|
|
1923
|
+
parent: Node$1;
|
|
1924
|
+
}
|
|
1925
|
+
interface JSXText extends Span {
|
|
1926
|
+
type: "JSXText";
|
|
1927
|
+
value: string;
|
|
1928
|
+
raw: string | null;
|
|
1929
|
+
parent: Node$1;
|
|
1930
|
+
}
|
|
1931
|
+
interface TSThisParameter extends Span {
|
|
1932
|
+
type: "Identifier";
|
|
1933
|
+
decorators: [];
|
|
1934
|
+
name: "this";
|
|
1935
|
+
optional: false;
|
|
1936
|
+
typeAnnotation: TSTypeAnnotation | null;
|
|
1937
|
+
parent: Node$1;
|
|
1938
|
+
}
|
|
1939
|
+
interface TSEnumDeclaration extends Span {
|
|
1940
|
+
type: "TSEnumDeclaration";
|
|
1941
|
+
id: BindingIdentifier;
|
|
1942
|
+
body: TSEnumBody;
|
|
1943
|
+
const: boolean;
|
|
1944
|
+
declare: boolean;
|
|
1945
|
+
parent: Node$1;
|
|
1946
|
+
}
|
|
1947
|
+
interface TSEnumBody extends Span {
|
|
1948
|
+
type: "TSEnumBody";
|
|
1949
|
+
members: Array<TSEnumMember>;
|
|
1950
|
+
parent: Node$1;
|
|
1951
|
+
}
|
|
1952
|
+
interface TSEnumMember extends Span {
|
|
1953
|
+
type: "TSEnumMember";
|
|
1954
|
+
id: TSEnumMemberName;
|
|
1955
|
+
initializer: Expression | null;
|
|
1956
|
+
computed: boolean;
|
|
1957
|
+
parent: Node$1;
|
|
1958
|
+
}
|
|
1959
|
+
type TSEnumMemberName = IdentifierName | StringLiteral | TemplateLiteral;
|
|
1960
|
+
interface TSTypeAnnotation extends Span {
|
|
1961
|
+
type: "TSTypeAnnotation";
|
|
1962
|
+
typeAnnotation: TSType;
|
|
1963
|
+
parent: Node$1;
|
|
1964
|
+
}
|
|
1965
|
+
interface TSLiteralType extends Span {
|
|
1966
|
+
type: "TSLiteralType";
|
|
1967
|
+
literal: TSLiteral;
|
|
1968
|
+
parent: Node$1;
|
|
1969
|
+
}
|
|
1970
|
+
type TSLiteral = BooleanLiteral | NumericLiteral | BigIntLiteral | StringLiteral | TemplateLiteral | UnaryExpression;
|
|
1971
|
+
type TSType = TSAnyKeyword | TSBigIntKeyword | TSBooleanKeyword | TSIntrinsicKeyword | TSNeverKeyword | TSNullKeyword | TSNumberKeyword | TSObjectKeyword | TSStringKeyword | TSSymbolKeyword | TSUndefinedKeyword | TSUnknownKeyword | TSVoidKeyword | TSArrayType | TSConditionalType | TSConstructorType | TSFunctionType | TSImportType | TSIndexedAccessType | TSInferType | TSIntersectionType | TSLiteralType | TSMappedType | TSNamedTupleMember | TSTemplateLiteralType | TSThisType | TSTupleType | TSTypeLiteral | TSTypeOperator | TSTypePredicate | TSTypeQuery | TSTypeReference | TSUnionType | TSParenthesizedType | JSDocNullableType | JSDocNonNullableType | JSDocUnknownType;
|
|
1972
|
+
interface TSConditionalType extends Span {
|
|
1973
|
+
type: "TSConditionalType";
|
|
1974
|
+
checkType: TSType;
|
|
1975
|
+
extendsType: TSType;
|
|
1976
|
+
trueType: TSType;
|
|
1977
|
+
falseType: TSType;
|
|
1978
|
+
parent: Node$1;
|
|
1979
|
+
}
|
|
1980
|
+
interface TSUnionType extends Span {
|
|
1981
|
+
type: "TSUnionType";
|
|
1982
|
+
types: Array<TSType>;
|
|
1983
|
+
parent: Node$1;
|
|
1984
|
+
}
|
|
1985
|
+
interface TSIntersectionType extends Span {
|
|
1986
|
+
type: "TSIntersectionType";
|
|
1987
|
+
types: Array<TSType>;
|
|
1988
|
+
parent: Node$1;
|
|
1989
|
+
}
|
|
1990
|
+
interface TSParenthesizedType extends Span {
|
|
1991
|
+
type: "TSParenthesizedType";
|
|
1992
|
+
typeAnnotation: TSType;
|
|
1993
|
+
parent: Node$1;
|
|
1994
|
+
}
|
|
1995
|
+
interface TSTypeOperator extends Span {
|
|
1996
|
+
type: "TSTypeOperator";
|
|
1997
|
+
operator: TSTypeOperatorOperator;
|
|
1998
|
+
typeAnnotation: TSType;
|
|
1999
|
+
parent: Node$1;
|
|
2000
|
+
}
|
|
2001
|
+
type TSTypeOperatorOperator = "keyof" | "unique" | "readonly";
|
|
2002
|
+
interface TSArrayType extends Span {
|
|
2003
|
+
type: "TSArrayType";
|
|
2004
|
+
elementType: TSType;
|
|
2005
|
+
parent: Node$1;
|
|
2006
|
+
}
|
|
2007
|
+
interface TSIndexedAccessType extends Span {
|
|
2008
|
+
type: "TSIndexedAccessType";
|
|
2009
|
+
objectType: TSType;
|
|
2010
|
+
indexType: TSType;
|
|
2011
|
+
parent: Node$1;
|
|
2012
|
+
}
|
|
2013
|
+
interface TSTupleType extends Span {
|
|
2014
|
+
type: "TSTupleType";
|
|
2015
|
+
elementTypes: Array<TSTupleElement>;
|
|
2016
|
+
parent: Node$1;
|
|
2017
|
+
}
|
|
2018
|
+
interface TSNamedTupleMember extends Span {
|
|
2019
|
+
type: "TSNamedTupleMember";
|
|
2020
|
+
label: IdentifierName;
|
|
2021
|
+
elementType: TSTupleElement;
|
|
2022
|
+
optional: boolean;
|
|
2023
|
+
parent: Node$1;
|
|
2024
|
+
}
|
|
2025
|
+
interface TSOptionalType extends Span {
|
|
2026
|
+
type: "TSOptionalType";
|
|
2027
|
+
typeAnnotation: TSType;
|
|
2028
|
+
parent: Node$1;
|
|
2029
|
+
}
|
|
2030
|
+
interface TSRestType extends Span {
|
|
2031
|
+
type: "TSRestType";
|
|
2032
|
+
typeAnnotation: TSType;
|
|
2033
|
+
parent: Node$1;
|
|
2034
|
+
}
|
|
2035
|
+
type TSTupleElement = TSOptionalType | TSRestType | TSType;
|
|
2036
|
+
interface TSAnyKeyword extends Span {
|
|
2037
|
+
type: "TSAnyKeyword";
|
|
2038
|
+
parent: Node$1;
|
|
2039
|
+
}
|
|
2040
|
+
interface TSStringKeyword extends Span {
|
|
2041
|
+
type: "TSStringKeyword";
|
|
2042
|
+
parent: Node$1;
|
|
2043
|
+
}
|
|
2044
|
+
interface TSBooleanKeyword extends Span {
|
|
2045
|
+
type: "TSBooleanKeyword";
|
|
2046
|
+
parent: Node$1;
|
|
2047
|
+
}
|
|
2048
|
+
interface TSNumberKeyword extends Span {
|
|
2049
|
+
type: "TSNumberKeyword";
|
|
2050
|
+
parent: Node$1;
|
|
2051
|
+
}
|
|
2052
|
+
interface TSNeverKeyword extends Span {
|
|
2053
|
+
type: "TSNeverKeyword";
|
|
2054
|
+
parent: Node$1;
|
|
2055
|
+
}
|
|
2056
|
+
interface TSIntrinsicKeyword extends Span {
|
|
2057
|
+
type: "TSIntrinsicKeyword";
|
|
2058
|
+
parent: Node$1;
|
|
2059
|
+
}
|
|
2060
|
+
interface TSUnknownKeyword extends Span {
|
|
2061
|
+
type: "TSUnknownKeyword";
|
|
2062
|
+
parent: Node$1;
|
|
2063
|
+
}
|
|
2064
|
+
interface TSNullKeyword extends Span {
|
|
2065
|
+
type: "TSNullKeyword";
|
|
2066
|
+
parent: Node$1;
|
|
2067
|
+
}
|
|
2068
|
+
interface TSUndefinedKeyword extends Span {
|
|
2069
|
+
type: "TSUndefinedKeyword";
|
|
2070
|
+
parent: Node$1;
|
|
2071
|
+
}
|
|
2072
|
+
interface TSVoidKeyword extends Span {
|
|
2073
|
+
type: "TSVoidKeyword";
|
|
2074
|
+
parent: Node$1;
|
|
2075
|
+
}
|
|
2076
|
+
interface TSSymbolKeyword extends Span {
|
|
2077
|
+
type: "TSSymbolKeyword";
|
|
2078
|
+
parent: Node$1;
|
|
2079
|
+
}
|
|
2080
|
+
interface TSThisType extends Span {
|
|
2081
|
+
type: "TSThisType";
|
|
2082
|
+
parent: Node$1;
|
|
2083
|
+
}
|
|
2084
|
+
interface TSObjectKeyword extends Span {
|
|
2085
|
+
type: "TSObjectKeyword";
|
|
2086
|
+
parent: Node$1;
|
|
2087
|
+
}
|
|
2088
|
+
interface TSBigIntKeyword extends Span {
|
|
2089
|
+
type: "TSBigIntKeyword";
|
|
2090
|
+
parent: Node$1;
|
|
2091
|
+
}
|
|
2092
|
+
interface TSTypeReference extends Span {
|
|
2093
|
+
type: "TSTypeReference";
|
|
2094
|
+
typeName: TSTypeName;
|
|
2095
|
+
typeArguments: TSTypeParameterInstantiation | null;
|
|
2096
|
+
parent: Node$1;
|
|
2097
|
+
}
|
|
2098
|
+
type TSTypeName = IdentifierReference | TSQualifiedName | ThisExpression;
|
|
2099
|
+
interface TSQualifiedName extends Span {
|
|
2100
|
+
type: "TSQualifiedName";
|
|
2101
|
+
left: TSTypeName;
|
|
2102
|
+
right: IdentifierName;
|
|
2103
|
+
parent: Node$1;
|
|
2104
|
+
}
|
|
2105
|
+
interface TSTypeParameterInstantiation extends Span {
|
|
2106
|
+
type: "TSTypeParameterInstantiation";
|
|
2107
|
+
params: Array<TSType>;
|
|
2108
|
+
parent: Node$1;
|
|
2109
|
+
}
|
|
2110
|
+
interface TSTypeParameter extends Span {
|
|
2111
|
+
type: "TSTypeParameter";
|
|
2112
|
+
name: BindingIdentifier;
|
|
2113
|
+
constraint: TSType | null;
|
|
2114
|
+
default: TSType | null;
|
|
2115
|
+
in: boolean;
|
|
2116
|
+
out: boolean;
|
|
2117
|
+
const: boolean;
|
|
2118
|
+
parent: Node$1;
|
|
2119
|
+
}
|
|
2120
|
+
interface TSTypeParameterDeclaration extends Span {
|
|
2121
|
+
type: "TSTypeParameterDeclaration";
|
|
2122
|
+
params: Array<TSTypeParameter>;
|
|
2123
|
+
parent: Node$1;
|
|
2124
|
+
}
|
|
2125
|
+
interface TSTypeAliasDeclaration extends Span {
|
|
2126
|
+
type: "TSTypeAliasDeclaration";
|
|
2127
|
+
id: BindingIdentifier;
|
|
2128
|
+
typeParameters: TSTypeParameterDeclaration | null;
|
|
2129
|
+
typeAnnotation: TSType;
|
|
2130
|
+
declare: boolean;
|
|
2131
|
+
parent: Node$1;
|
|
2132
|
+
}
|
|
2133
|
+
type TSAccessibility = "private" | "protected" | "public";
|
|
2134
|
+
interface TSClassImplements extends Span {
|
|
2135
|
+
type: "TSClassImplements";
|
|
2136
|
+
expression: IdentifierReference | ThisExpression | MemberExpression;
|
|
2137
|
+
typeArguments: TSTypeParameterInstantiation | null;
|
|
2138
|
+
parent: Node$1;
|
|
2139
|
+
}
|
|
2140
|
+
interface TSInterfaceDeclaration extends Span {
|
|
2141
|
+
type: "TSInterfaceDeclaration";
|
|
2142
|
+
id: BindingIdentifier;
|
|
2143
|
+
typeParameters: TSTypeParameterDeclaration | null;
|
|
2144
|
+
extends: Array<TSInterfaceHeritage>;
|
|
2145
|
+
body: TSInterfaceBody;
|
|
2146
|
+
declare: boolean;
|
|
2147
|
+
parent: Node$1;
|
|
2148
|
+
}
|
|
2149
|
+
interface TSInterfaceBody extends Span {
|
|
2150
|
+
type: "TSInterfaceBody";
|
|
2151
|
+
body: Array<TSSignature>;
|
|
2152
|
+
parent: Node$1;
|
|
2153
|
+
}
|
|
2154
|
+
interface TSPropertySignature extends Span {
|
|
2155
|
+
type: "TSPropertySignature";
|
|
2156
|
+
computed: boolean;
|
|
2157
|
+
optional: boolean;
|
|
2158
|
+
readonly: boolean;
|
|
2159
|
+
key: PropertyKey$1;
|
|
2160
|
+
typeAnnotation: TSTypeAnnotation | null;
|
|
2161
|
+
accessibility: null;
|
|
2162
|
+
static: false;
|
|
2163
|
+
parent: Node$1;
|
|
2164
|
+
}
|
|
2165
|
+
type TSSignature = TSIndexSignature | TSPropertySignature | TSCallSignatureDeclaration | TSConstructSignatureDeclaration | TSMethodSignature;
|
|
2166
|
+
interface TSIndexSignature extends Span {
|
|
2167
|
+
type: "TSIndexSignature";
|
|
2168
|
+
parameters: Array<TSIndexSignatureName>;
|
|
2169
|
+
typeAnnotation: TSTypeAnnotation;
|
|
2170
|
+
readonly: boolean;
|
|
2171
|
+
static: boolean;
|
|
2172
|
+
accessibility: null;
|
|
2173
|
+
parent: Node$1;
|
|
2174
|
+
}
|
|
2175
|
+
interface TSCallSignatureDeclaration extends Span {
|
|
2176
|
+
type: "TSCallSignatureDeclaration";
|
|
2177
|
+
typeParameters: TSTypeParameterDeclaration | null;
|
|
2178
|
+
params: ParamPattern[];
|
|
2179
|
+
returnType: TSTypeAnnotation | null;
|
|
2180
|
+
parent: Node$1;
|
|
2181
|
+
}
|
|
2182
|
+
type TSMethodSignatureKind = "method" | "get" | "set";
|
|
2183
|
+
interface TSMethodSignature extends Span {
|
|
2184
|
+
type: "TSMethodSignature";
|
|
2185
|
+
key: PropertyKey$1;
|
|
2186
|
+
computed: boolean;
|
|
2187
|
+
optional: boolean;
|
|
2188
|
+
kind: TSMethodSignatureKind;
|
|
2189
|
+
typeParameters: TSTypeParameterDeclaration | null;
|
|
2190
|
+
params: ParamPattern[];
|
|
2191
|
+
returnType: TSTypeAnnotation | null;
|
|
2192
|
+
accessibility: null;
|
|
2193
|
+
readonly: false;
|
|
2194
|
+
static: false;
|
|
2195
|
+
parent: Node$1;
|
|
2196
|
+
}
|
|
2197
|
+
interface TSConstructSignatureDeclaration extends Span {
|
|
2198
|
+
type: "TSConstructSignatureDeclaration";
|
|
2199
|
+
typeParameters: TSTypeParameterDeclaration | null;
|
|
2200
|
+
params: ParamPattern[];
|
|
2201
|
+
returnType: TSTypeAnnotation | null;
|
|
2202
|
+
parent: Node$1;
|
|
2203
|
+
}
|
|
2204
|
+
interface TSIndexSignatureName extends Span {
|
|
2205
|
+
type: "Identifier";
|
|
2206
|
+
decorators: [];
|
|
2207
|
+
name: string;
|
|
2208
|
+
optional: false;
|
|
2209
|
+
typeAnnotation: TSTypeAnnotation;
|
|
2210
|
+
parent: Node$1;
|
|
2211
|
+
}
|
|
2212
|
+
interface TSInterfaceHeritage extends Span {
|
|
2213
|
+
type: "TSInterfaceHeritage";
|
|
2214
|
+
expression: Expression;
|
|
2215
|
+
typeArguments: TSTypeParameterInstantiation | null;
|
|
2216
|
+
parent: Node$1;
|
|
2217
|
+
}
|
|
2218
|
+
interface TSTypePredicate extends Span {
|
|
2219
|
+
type: "TSTypePredicate";
|
|
2220
|
+
parameterName: TSTypePredicateName;
|
|
2221
|
+
asserts: boolean;
|
|
2222
|
+
typeAnnotation: TSTypeAnnotation | null;
|
|
2223
|
+
parent: Node$1;
|
|
2224
|
+
}
|
|
2225
|
+
type TSTypePredicateName = IdentifierName | TSThisType;
|
|
2226
|
+
interface TSModuleDeclaration extends Span {
|
|
2227
|
+
type: "TSModuleDeclaration";
|
|
2228
|
+
id: BindingIdentifier | StringLiteral | TSQualifiedName;
|
|
2229
|
+
body: TSModuleBlock | null;
|
|
2230
|
+
kind: TSModuleDeclarationKind;
|
|
2231
|
+
declare: boolean;
|
|
2232
|
+
global: false;
|
|
2233
|
+
parent: Node$1;
|
|
2234
|
+
}
|
|
2235
|
+
type TSModuleDeclarationKind = "module" | "namespace";
|
|
2236
|
+
interface TSGlobalDeclaration extends Span {
|
|
2237
|
+
type: "TSModuleDeclaration";
|
|
2238
|
+
id: IdentifierName;
|
|
2239
|
+
body: TSModuleBlock;
|
|
2240
|
+
kind: "global";
|
|
2241
|
+
declare: boolean;
|
|
2242
|
+
global: true;
|
|
2243
|
+
parent: Node$1;
|
|
2244
|
+
}
|
|
2245
|
+
interface TSModuleBlock extends Span {
|
|
2246
|
+
type: "TSModuleBlock";
|
|
2247
|
+
body: Array<Directive | Statement>;
|
|
2248
|
+
parent: Node$1;
|
|
2249
|
+
}
|
|
2250
|
+
interface TSTypeLiteral extends Span {
|
|
2251
|
+
type: "TSTypeLiteral";
|
|
2252
|
+
members: Array<TSSignature>;
|
|
2253
|
+
parent: Node$1;
|
|
2254
|
+
}
|
|
2255
|
+
interface TSInferType extends Span {
|
|
2256
|
+
type: "TSInferType";
|
|
2257
|
+
typeParameter: TSTypeParameter;
|
|
2258
|
+
parent: Node$1;
|
|
2259
|
+
}
|
|
2260
|
+
interface TSTypeQuery extends Span {
|
|
2261
|
+
type: "TSTypeQuery";
|
|
2262
|
+
exprName: TSTypeQueryExprName;
|
|
2263
|
+
typeArguments: TSTypeParameterInstantiation | null;
|
|
2264
|
+
parent: Node$1;
|
|
2265
|
+
}
|
|
2266
|
+
type TSTypeQueryExprName = TSImportType | TSTypeName;
|
|
2267
|
+
interface TSImportType extends Span {
|
|
2268
|
+
type: "TSImportType";
|
|
2269
|
+
source: StringLiteral;
|
|
2270
|
+
options: ObjectExpression | null;
|
|
2271
|
+
qualifier: TSImportTypeQualifier | null;
|
|
2272
|
+
typeArguments: TSTypeParameterInstantiation | null;
|
|
2273
|
+
parent: Node$1;
|
|
2274
|
+
}
|
|
2275
|
+
type TSImportTypeQualifier = IdentifierName | TSImportTypeQualifiedName;
|
|
2276
|
+
interface TSImportTypeQualifiedName extends Span {
|
|
2277
|
+
type: "TSQualifiedName";
|
|
2278
|
+
left: TSImportTypeQualifier;
|
|
2279
|
+
right: IdentifierName;
|
|
2280
|
+
parent: Node$1;
|
|
2281
|
+
}
|
|
2282
|
+
interface TSFunctionType extends Span {
|
|
2283
|
+
type: "TSFunctionType";
|
|
2284
|
+
typeParameters: TSTypeParameterDeclaration | null;
|
|
2285
|
+
params: ParamPattern[];
|
|
2286
|
+
returnType: TSTypeAnnotation;
|
|
2287
|
+
parent: Node$1;
|
|
2288
|
+
}
|
|
2289
|
+
interface TSConstructorType extends Span {
|
|
2290
|
+
type: "TSConstructorType";
|
|
2291
|
+
abstract: boolean;
|
|
2292
|
+
typeParameters: TSTypeParameterDeclaration | null;
|
|
2293
|
+
params: ParamPattern[];
|
|
2294
|
+
returnType: TSTypeAnnotation;
|
|
2295
|
+
parent: Node$1;
|
|
2296
|
+
}
|
|
2297
|
+
interface TSMappedType extends Span {
|
|
2298
|
+
type: "TSMappedType";
|
|
2299
|
+
key: BindingIdentifier;
|
|
2300
|
+
constraint: TSType;
|
|
2301
|
+
nameType: TSType | null;
|
|
2302
|
+
typeAnnotation: TSType | null;
|
|
2303
|
+
optional: TSMappedTypeModifierOperator | false;
|
|
2304
|
+
readonly: TSMappedTypeModifierOperator | null;
|
|
2305
|
+
parent: Node$1;
|
|
2306
|
+
}
|
|
2307
|
+
type TSMappedTypeModifierOperator = true | "+" | "-";
|
|
2308
|
+
interface TSTemplateLiteralType extends Span {
|
|
2309
|
+
type: "TSTemplateLiteralType";
|
|
2310
|
+
quasis: Array<TemplateElement>;
|
|
2311
|
+
types: Array<TSType>;
|
|
2312
|
+
parent: Node$1;
|
|
2313
|
+
}
|
|
2314
|
+
interface TSAsExpression extends Span {
|
|
2315
|
+
type: "TSAsExpression";
|
|
2316
|
+
expression: Expression;
|
|
2317
|
+
typeAnnotation: TSType;
|
|
2318
|
+
parent: Node$1;
|
|
2319
|
+
}
|
|
2320
|
+
interface TSSatisfiesExpression extends Span {
|
|
2321
|
+
type: "TSSatisfiesExpression";
|
|
2322
|
+
expression: Expression;
|
|
2323
|
+
typeAnnotation: TSType;
|
|
2324
|
+
parent: Node$1;
|
|
2325
|
+
}
|
|
2326
|
+
interface TSTypeAssertion extends Span {
|
|
2327
|
+
type: "TSTypeAssertion";
|
|
2328
|
+
typeAnnotation: TSType;
|
|
2329
|
+
expression: Expression;
|
|
2330
|
+
parent: Node$1;
|
|
2331
|
+
}
|
|
2332
|
+
interface TSImportEqualsDeclaration extends Span {
|
|
2333
|
+
type: "TSImportEqualsDeclaration";
|
|
2334
|
+
id: BindingIdentifier;
|
|
2335
|
+
moduleReference: TSModuleReference;
|
|
2336
|
+
importKind: ImportOrExportKind;
|
|
2337
|
+
parent: Node$1;
|
|
2338
|
+
}
|
|
2339
|
+
type TSModuleReference = TSExternalModuleReference | IdentifierReference | TSQualifiedName;
|
|
2340
|
+
interface TSExternalModuleReference extends Span {
|
|
2341
|
+
type: "TSExternalModuleReference";
|
|
2342
|
+
expression: StringLiteral;
|
|
2343
|
+
parent: Node$1;
|
|
2344
|
+
}
|
|
2345
|
+
interface TSNonNullExpression extends Span {
|
|
2346
|
+
type: "TSNonNullExpression";
|
|
2347
|
+
expression: Expression;
|
|
2348
|
+
parent: Node$1;
|
|
2349
|
+
}
|
|
2350
|
+
interface Decorator extends Span {
|
|
2351
|
+
type: "Decorator";
|
|
2352
|
+
expression: Expression;
|
|
2353
|
+
parent: Node$1;
|
|
2354
|
+
}
|
|
2355
|
+
interface TSExportAssignment extends Span {
|
|
2356
|
+
type: "TSExportAssignment";
|
|
2357
|
+
expression: Expression;
|
|
2358
|
+
parent: Node$1;
|
|
2359
|
+
}
|
|
2360
|
+
interface TSNamespaceExportDeclaration extends Span {
|
|
2361
|
+
type: "TSNamespaceExportDeclaration";
|
|
2362
|
+
id: IdentifierName;
|
|
2363
|
+
parent: Node$1;
|
|
2364
|
+
}
|
|
2365
|
+
interface TSInstantiationExpression extends Span {
|
|
2366
|
+
type: "TSInstantiationExpression";
|
|
2367
|
+
expression: Expression;
|
|
2368
|
+
typeArguments: TSTypeParameterInstantiation;
|
|
2369
|
+
parent: Node$1;
|
|
2370
|
+
}
|
|
2371
|
+
type ImportOrExportKind = "value" | "type";
|
|
2372
|
+
interface JSDocNullableType extends Span {
|
|
2373
|
+
type: "TSJSDocNullableType";
|
|
2374
|
+
typeAnnotation: TSType;
|
|
2375
|
+
postfix: boolean;
|
|
2376
|
+
parent: Node$1;
|
|
2377
|
+
}
|
|
2378
|
+
interface JSDocNonNullableType extends Span {
|
|
2379
|
+
type: "TSJSDocNonNullableType";
|
|
2380
|
+
typeAnnotation: TSType;
|
|
2381
|
+
postfix: boolean;
|
|
2382
|
+
parent: Node$1;
|
|
2383
|
+
}
|
|
2384
|
+
interface JSDocUnknownType extends Span {
|
|
2385
|
+
type: "TSJSDocUnknownType";
|
|
2386
|
+
parent: Node$1;
|
|
2387
|
+
}
|
|
2388
|
+
type AssignmentOperator = "=" | "+=" | "-=" | "*=" | "/=" | "%=" | "**=" | "<<=" | ">>=" | ">>>=" | "|=" | "^=" | "&=" | "||=" | "&&=" | "??=";
|
|
2389
|
+
type BinaryOperator = "==" | "!=" | "===" | "!==" | "<" | "<=" | ">" | ">=" | "+" | "-" | "*" | "/" | "%" | "**" | "<<" | ">>" | ">>>" | "|" | "^" | "&" | "in" | "instanceof";
|
|
2390
|
+
type LogicalOperator = "||" | "&&" | "??";
|
|
2391
|
+
type UnaryOperator = "+" | "-" | "!" | "~" | "typeof" | "void" | "delete";
|
|
2392
|
+
type UpdateOperator = "++" | "--";
|
|
2393
|
+
type ModuleKind = "script" | "module" | "commonjs";
|
|
2394
|
+
type Node$1 = Program | IdentifierName | IdentifierReference | BindingIdentifier | LabelIdentifier | ThisExpression | ArrayExpression | ObjectExpression | ObjectProperty | TemplateLiteral | TaggedTemplateExpression | TemplateElement | ComputedMemberExpression | StaticMemberExpression | PrivateFieldExpression | CallExpression | NewExpression | MetaProperty | SpreadElement | UpdateExpression | UnaryExpression | BinaryExpression | PrivateInExpression | LogicalExpression | ConditionalExpression | AssignmentExpression | ArrayAssignmentTarget | ObjectAssignmentTarget | AssignmentTargetRest | AssignmentTargetWithDefault | AssignmentTargetPropertyIdentifier | AssignmentTargetPropertyProperty | SequenceExpression | Super | AwaitExpression | ChainExpression | ParenthesizedExpression | Directive | Hashbang | BlockStatement | VariableDeclaration | VariableDeclarator | EmptyStatement | ExpressionStatement | IfStatement | DoWhileStatement | WhileStatement | ForStatement | ForInStatement | ForOfStatement | ContinueStatement | BreakStatement | ReturnStatement | WithStatement | SwitchStatement | SwitchCase | LabeledStatement | ThrowStatement | TryStatement | CatchClause | DebuggerStatement | AssignmentPattern | ObjectPattern | BindingProperty | ArrayPattern | BindingRestElement | Function$1 | FunctionBody | ArrowFunctionExpression | YieldExpression | Class | ClassBody | MethodDefinition | PropertyDefinition | PrivateIdentifier | StaticBlock | AccessorProperty | ImportExpression | ImportDeclaration | ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier | ImportAttribute | ExportNamedDeclaration | ExportDefaultDeclaration | ExportAllDeclaration | ExportSpecifier | V8IntrinsicExpression | BooleanLiteral | NullLiteral | NumericLiteral | StringLiteral | BigIntLiteral | RegExpLiteral | JSXElement | JSXOpeningElement | JSXClosingElement | JSXFragment | JSXOpeningFragment | JSXClosingFragment | JSXNamespacedName | JSXMemberExpression | JSXExpressionContainer | JSXEmptyExpression | JSXAttribute | JSXSpreadAttribute | JSXIdentifier | JSXSpreadChild | JSXText | TSThisParameter | TSEnumDeclaration | TSEnumBody | TSEnumMember | TSTypeAnnotation | TSLiteralType | TSConditionalType | TSUnionType | TSIntersectionType | TSParenthesizedType | TSTypeOperator | TSArrayType | TSIndexedAccessType | TSTupleType | TSNamedTupleMember | TSOptionalType | TSRestType | TSAnyKeyword | TSStringKeyword | TSBooleanKeyword | TSNumberKeyword | TSNeverKeyword | TSIntrinsicKeyword | TSUnknownKeyword | TSNullKeyword | TSUndefinedKeyword | TSVoidKeyword | TSSymbolKeyword | TSThisType | TSObjectKeyword | TSBigIntKeyword | TSTypeReference | TSQualifiedName | TSTypeParameterInstantiation | TSTypeParameter | TSTypeParameterDeclaration | TSTypeAliasDeclaration | TSClassImplements | TSInterfaceDeclaration | TSInterfaceBody | TSPropertySignature | TSIndexSignature | TSCallSignatureDeclaration | TSMethodSignature | TSConstructSignatureDeclaration | TSIndexSignatureName | TSInterfaceHeritage | TSTypePredicate | TSModuleDeclaration | TSGlobalDeclaration | TSModuleBlock | TSTypeLiteral | TSInferType | TSTypeQuery | TSImportType | TSImportTypeQualifiedName | TSFunctionType | TSConstructorType | TSMappedType | TSTemplateLiteralType | TSAsExpression | TSSatisfiesExpression | TSTypeAssertion | TSImportEqualsDeclaration | TSExternalModuleReference | TSNonNullExpression | Decorator | TSExportAssignment | TSNamespaceExportDeclaration | TSInstantiationExpression | JSDocNullableType | JSDocNonNullableType | JSDocUnknownType | ParamPattern;
|
|
2395
|
+
//#endregion
|
|
2396
|
+
//#region src-js/generated/visitor.d.ts
|
|
2397
|
+
// To understand why we need the "Bivariance hack", see: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/20219
|
|
2398
|
+
// For downsides, see: https://github.com/oxc-project/oxc/issues/18154#issuecomment-4012955607
|
|
2399
|
+
type BivarianceHackHandler<Handler extends (...args: any) => any> = {
|
|
2400
|
+
bivarianceHack(...args: Parameters<Handler>): ReturnType<Handler>;
|
|
2401
|
+
}["bivarianceHack"];
|
|
2402
|
+
interface StrictVisitorObject {
|
|
2403
|
+
DebuggerStatement?: (node: DebuggerStatement) => void;
|
|
2404
|
+
"DebuggerStatement:exit"?: (node: DebuggerStatement) => void;
|
|
2405
|
+
EmptyStatement?: (node: EmptyStatement) => void;
|
|
2406
|
+
"EmptyStatement:exit"?: (node: EmptyStatement) => void;
|
|
2407
|
+
Literal?: (node: BooleanLiteral | NullLiteral | NumericLiteral | StringLiteral | BigIntLiteral | RegExpLiteral) => void;
|
|
2408
|
+
"Literal:exit"?: (node: BooleanLiteral | NullLiteral | NumericLiteral | StringLiteral | BigIntLiteral | RegExpLiteral) => void;
|
|
2409
|
+
PrivateIdentifier?: (node: PrivateIdentifier) => void;
|
|
2410
|
+
"PrivateIdentifier:exit"?: (node: PrivateIdentifier) => void;
|
|
2411
|
+
Super?: (node: Super) => void;
|
|
2412
|
+
"Super:exit"?: (node: Super) => void;
|
|
2413
|
+
TemplateElement?: (node: TemplateElement) => void;
|
|
2414
|
+
"TemplateElement:exit"?: (node: TemplateElement) => void;
|
|
2415
|
+
ThisExpression?: (node: ThisExpression) => void;
|
|
2416
|
+
"ThisExpression:exit"?: (node: ThisExpression) => void;
|
|
2417
|
+
JSXClosingFragment?: (node: JSXClosingFragment) => void;
|
|
2418
|
+
"JSXClosingFragment:exit"?: (node: JSXClosingFragment) => void;
|
|
2419
|
+
JSXEmptyExpression?: (node: JSXEmptyExpression) => void;
|
|
2420
|
+
"JSXEmptyExpression:exit"?: (node: JSXEmptyExpression) => void;
|
|
2421
|
+
JSXIdentifier?: (node: JSXIdentifier) => void;
|
|
2422
|
+
"JSXIdentifier:exit"?: (node: JSXIdentifier) => void;
|
|
2423
|
+
JSXOpeningFragment?: (node: JSXOpeningFragment) => void;
|
|
2424
|
+
"JSXOpeningFragment:exit"?: (node: JSXOpeningFragment) => void;
|
|
2425
|
+
JSXText?: (node: JSXText) => void;
|
|
2426
|
+
"JSXText:exit"?: (node: JSXText) => void;
|
|
2427
|
+
TSAnyKeyword?: (node: TSAnyKeyword) => void;
|
|
2428
|
+
"TSAnyKeyword:exit"?: (node: TSAnyKeyword) => void;
|
|
2429
|
+
TSBigIntKeyword?: (node: TSBigIntKeyword) => void;
|
|
2430
|
+
"TSBigIntKeyword:exit"?: (node: TSBigIntKeyword) => void;
|
|
2431
|
+
TSBooleanKeyword?: (node: TSBooleanKeyword) => void;
|
|
2432
|
+
"TSBooleanKeyword:exit"?: (node: TSBooleanKeyword) => void;
|
|
2433
|
+
TSIntrinsicKeyword?: (node: TSIntrinsicKeyword) => void;
|
|
2434
|
+
"TSIntrinsicKeyword:exit"?: (node: TSIntrinsicKeyword) => void;
|
|
2435
|
+
TSJSDocUnknownType?: (node: JSDocUnknownType) => void;
|
|
2436
|
+
"TSJSDocUnknownType:exit"?: (node: JSDocUnknownType) => void;
|
|
2437
|
+
TSNeverKeyword?: (node: TSNeverKeyword) => void;
|
|
2438
|
+
"TSNeverKeyword:exit"?: (node: TSNeverKeyword) => void;
|
|
2439
|
+
TSNullKeyword?: (node: TSNullKeyword) => void;
|
|
2440
|
+
"TSNullKeyword:exit"?: (node: TSNullKeyword) => void;
|
|
2441
|
+
TSNumberKeyword?: (node: TSNumberKeyword) => void;
|
|
2442
|
+
"TSNumberKeyword:exit"?: (node: TSNumberKeyword) => void;
|
|
2443
|
+
TSObjectKeyword?: (node: TSObjectKeyword) => void;
|
|
2444
|
+
"TSObjectKeyword:exit"?: (node: TSObjectKeyword) => void;
|
|
2445
|
+
TSStringKeyword?: (node: TSStringKeyword) => void;
|
|
2446
|
+
"TSStringKeyword:exit"?: (node: TSStringKeyword) => void;
|
|
2447
|
+
TSSymbolKeyword?: (node: TSSymbolKeyword) => void;
|
|
2448
|
+
"TSSymbolKeyword:exit"?: (node: TSSymbolKeyword) => void;
|
|
2449
|
+
TSThisType?: (node: TSThisType) => void;
|
|
2450
|
+
"TSThisType:exit"?: (node: TSThisType) => void;
|
|
2451
|
+
TSUndefinedKeyword?: (node: TSUndefinedKeyword) => void;
|
|
2452
|
+
"TSUndefinedKeyword:exit"?: (node: TSUndefinedKeyword) => void;
|
|
2453
|
+
TSUnknownKeyword?: (node: TSUnknownKeyword) => void;
|
|
2454
|
+
"TSUnknownKeyword:exit"?: (node: TSUnknownKeyword) => void;
|
|
2455
|
+
TSVoidKeyword?: (node: TSVoidKeyword) => void;
|
|
2456
|
+
"TSVoidKeyword:exit"?: (node: TSVoidKeyword) => void;
|
|
2457
|
+
AccessorProperty?: (node: AccessorProperty) => void;
|
|
2458
|
+
"AccessorProperty:exit"?: (node: AccessorProperty) => void;
|
|
2459
|
+
ArrayExpression?: (node: ArrayExpression) => void;
|
|
2460
|
+
"ArrayExpression:exit"?: (node: ArrayExpression) => void;
|
|
2461
|
+
ArrayPattern?: (node: ArrayPattern) => void;
|
|
2462
|
+
"ArrayPattern:exit"?: (node: ArrayPattern) => void;
|
|
2463
|
+
ArrowFunctionExpression?: (node: ArrowFunctionExpression) => void;
|
|
2464
|
+
"ArrowFunctionExpression:exit"?: (node: ArrowFunctionExpression) => void;
|
|
2465
|
+
AssignmentExpression?: (node: AssignmentExpression) => void;
|
|
2466
|
+
"AssignmentExpression:exit"?: (node: AssignmentExpression) => void;
|
|
2467
|
+
AssignmentPattern?: (node: AssignmentPattern) => void;
|
|
2468
|
+
"AssignmentPattern:exit"?: (node: AssignmentPattern) => void;
|
|
2469
|
+
AwaitExpression?: (node: AwaitExpression) => void;
|
|
2470
|
+
"AwaitExpression:exit"?: (node: AwaitExpression) => void;
|
|
2471
|
+
BinaryExpression?: (node: BinaryExpression) => void;
|
|
2472
|
+
"BinaryExpression:exit"?: (node: BinaryExpression) => void;
|
|
2473
|
+
BlockStatement?: (node: BlockStatement) => void;
|
|
2474
|
+
"BlockStatement:exit"?: (node: BlockStatement) => void;
|
|
2475
|
+
BreakStatement?: (node: BreakStatement) => void;
|
|
2476
|
+
"BreakStatement:exit"?: (node: BreakStatement) => void;
|
|
2477
|
+
CallExpression?: (node: CallExpression) => void;
|
|
2478
|
+
"CallExpression:exit"?: (node: CallExpression) => void;
|
|
2479
|
+
CatchClause?: (node: CatchClause) => void;
|
|
2480
|
+
"CatchClause:exit"?: (node: CatchClause) => void;
|
|
2481
|
+
ChainExpression?: (node: ChainExpression) => void;
|
|
2482
|
+
"ChainExpression:exit"?: (node: ChainExpression) => void;
|
|
2483
|
+
ClassBody?: (node: ClassBody) => void;
|
|
2484
|
+
"ClassBody:exit"?: (node: ClassBody) => void;
|
|
2485
|
+
ClassDeclaration?: (node: Class) => void;
|
|
2486
|
+
"ClassDeclaration:exit"?: (node: Class) => void;
|
|
2487
|
+
ClassExpression?: (node: Class) => void;
|
|
2488
|
+
"ClassExpression:exit"?: (node: Class) => void;
|
|
2489
|
+
ConditionalExpression?: (node: ConditionalExpression) => void;
|
|
2490
|
+
"ConditionalExpression:exit"?: (node: ConditionalExpression) => void;
|
|
2491
|
+
ContinueStatement?: (node: ContinueStatement) => void;
|
|
2492
|
+
"ContinueStatement:exit"?: (node: ContinueStatement) => void;
|
|
2493
|
+
Decorator?: (node: Decorator) => void;
|
|
2494
|
+
"Decorator:exit"?: (node: Decorator) => void;
|
|
2495
|
+
DoWhileStatement?: (node: DoWhileStatement) => void;
|
|
2496
|
+
"DoWhileStatement:exit"?: (node: DoWhileStatement) => void;
|
|
2497
|
+
ExportAllDeclaration?: (node: ExportAllDeclaration) => void;
|
|
2498
|
+
"ExportAllDeclaration:exit"?: (node: ExportAllDeclaration) => void;
|
|
2499
|
+
ExportDefaultDeclaration?: (node: ExportDefaultDeclaration) => void;
|
|
2500
|
+
"ExportDefaultDeclaration:exit"?: (node: ExportDefaultDeclaration) => void;
|
|
2501
|
+
ExportNamedDeclaration?: (node: ExportNamedDeclaration) => void;
|
|
2502
|
+
"ExportNamedDeclaration:exit"?: (node: ExportNamedDeclaration) => void;
|
|
2503
|
+
ExportSpecifier?: (node: ExportSpecifier) => void;
|
|
2504
|
+
"ExportSpecifier:exit"?: (node: ExportSpecifier) => void;
|
|
2505
|
+
ExpressionStatement?: (node: ExpressionStatement) => void;
|
|
2506
|
+
"ExpressionStatement:exit"?: (node: ExpressionStatement) => void;
|
|
2507
|
+
ForInStatement?: (node: ForInStatement) => void;
|
|
2508
|
+
"ForInStatement:exit"?: (node: ForInStatement) => void;
|
|
2509
|
+
ForOfStatement?: (node: ForOfStatement) => void;
|
|
2510
|
+
"ForOfStatement:exit"?: (node: ForOfStatement) => void;
|
|
2511
|
+
ForStatement?: (node: ForStatement) => void;
|
|
2512
|
+
"ForStatement:exit"?: (node: ForStatement) => void;
|
|
2513
|
+
FunctionDeclaration?: (node: Function$1) => void;
|
|
2514
|
+
"FunctionDeclaration:exit"?: (node: Function$1) => void;
|
|
2515
|
+
FunctionExpression?: (node: Function$1) => void;
|
|
2516
|
+
"FunctionExpression:exit"?: (node: Function$1) => void;
|
|
2517
|
+
Identifier?: (node: IdentifierName | IdentifierReference | BindingIdentifier | LabelIdentifier | TSThisParameter | TSIndexSignatureName) => void;
|
|
2518
|
+
"Identifier:exit"?: (node: IdentifierName | IdentifierReference | BindingIdentifier | LabelIdentifier | TSThisParameter | TSIndexSignatureName) => void;
|
|
2519
|
+
IfStatement?: (node: IfStatement) => void;
|
|
2520
|
+
"IfStatement:exit"?: (node: IfStatement) => void;
|
|
2521
|
+
ImportAttribute?: (node: ImportAttribute) => void;
|
|
2522
|
+
"ImportAttribute:exit"?: (node: ImportAttribute) => void;
|
|
2523
|
+
ImportDeclaration?: (node: ImportDeclaration) => void;
|
|
2524
|
+
"ImportDeclaration:exit"?: (node: ImportDeclaration) => void;
|
|
2525
|
+
ImportDefaultSpecifier?: (node: ImportDefaultSpecifier) => void;
|
|
2526
|
+
"ImportDefaultSpecifier:exit"?: (node: ImportDefaultSpecifier) => void;
|
|
2527
|
+
ImportExpression?: (node: ImportExpression) => void;
|
|
2528
|
+
"ImportExpression:exit"?: (node: ImportExpression) => void;
|
|
2529
|
+
ImportNamespaceSpecifier?: (node: ImportNamespaceSpecifier) => void;
|
|
2530
|
+
"ImportNamespaceSpecifier:exit"?: (node: ImportNamespaceSpecifier) => void;
|
|
2531
|
+
ImportSpecifier?: (node: ImportSpecifier) => void;
|
|
2532
|
+
"ImportSpecifier:exit"?: (node: ImportSpecifier) => void;
|
|
2533
|
+
LabeledStatement?: (node: LabeledStatement) => void;
|
|
2534
|
+
"LabeledStatement:exit"?: (node: LabeledStatement) => void;
|
|
2535
|
+
LogicalExpression?: (node: LogicalExpression) => void;
|
|
2536
|
+
"LogicalExpression:exit"?: (node: LogicalExpression) => void;
|
|
2537
|
+
MemberExpression?: (node: MemberExpression) => void;
|
|
2538
|
+
"MemberExpression:exit"?: (node: MemberExpression) => void;
|
|
2539
|
+
MetaProperty?: (node: MetaProperty) => void;
|
|
2540
|
+
"MetaProperty:exit"?: (node: MetaProperty) => void;
|
|
2541
|
+
MethodDefinition?: (node: MethodDefinition) => void;
|
|
2542
|
+
"MethodDefinition:exit"?: (node: MethodDefinition) => void;
|
|
2543
|
+
NewExpression?: (node: NewExpression) => void;
|
|
2544
|
+
"NewExpression:exit"?: (node: NewExpression) => void;
|
|
2545
|
+
ObjectExpression?: (node: ObjectExpression) => void;
|
|
2546
|
+
"ObjectExpression:exit"?: (node: ObjectExpression) => void;
|
|
2547
|
+
ObjectPattern?: (node: ObjectPattern) => void;
|
|
2548
|
+
"ObjectPattern:exit"?: (node: ObjectPattern) => void;
|
|
2549
|
+
ParenthesizedExpression?: (node: ParenthesizedExpression) => void;
|
|
2550
|
+
"ParenthesizedExpression:exit"?: (node: ParenthesizedExpression) => void;
|
|
2551
|
+
Program?: (node: Program) => void;
|
|
2552
|
+
"Program:exit"?: (node: Program) => void;
|
|
2553
|
+
Property?: (node: ObjectProperty | AssignmentTargetProperty | AssignmentTargetPropertyProperty | BindingProperty) => void;
|
|
2554
|
+
"Property:exit"?: (node: ObjectProperty | AssignmentTargetProperty | AssignmentTargetPropertyProperty | BindingProperty) => void;
|
|
2555
|
+
PropertyDefinition?: (node: PropertyDefinition) => void;
|
|
2556
|
+
"PropertyDefinition:exit"?: (node: PropertyDefinition) => void;
|
|
2557
|
+
RestElement?: (node: AssignmentTargetRest | BindingRestElement | FormalParameterRest) => void;
|
|
2558
|
+
"RestElement:exit"?: (node: AssignmentTargetRest | BindingRestElement | FormalParameterRest) => void;
|
|
2559
|
+
ReturnStatement?: (node: ReturnStatement) => void;
|
|
2560
|
+
"ReturnStatement:exit"?: (node: ReturnStatement) => void;
|
|
2561
|
+
SequenceExpression?: (node: SequenceExpression) => void;
|
|
2562
|
+
"SequenceExpression:exit"?: (node: SequenceExpression) => void;
|
|
2563
|
+
SpreadElement?: (node: SpreadElement) => void;
|
|
2564
|
+
"SpreadElement:exit"?: (node: SpreadElement) => void;
|
|
2565
|
+
StaticBlock?: (node: StaticBlock) => void;
|
|
2566
|
+
"StaticBlock:exit"?: (node: StaticBlock) => void;
|
|
2567
|
+
SwitchCase?: (node: SwitchCase) => void;
|
|
2568
|
+
"SwitchCase:exit"?: (node: SwitchCase) => void;
|
|
2569
|
+
SwitchStatement?: (node: SwitchStatement) => void;
|
|
2570
|
+
"SwitchStatement:exit"?: (node: SwitchStatement) => void;
|
|
2571
|
+
TaggedTemplateExpression?: (node: TaggedTemplateExpression) => void;
|
|
2572
|
+
"TaggedTemplateExpression:exit"?: (node: TaggedTemplateExpression) => void;
|
|
2573
|
+
TemplateLiteral?: (node: TemplateLiteral) => void;
|
|
2574
|
+
"TemplateLiteral:exit"?: (node: TemplateLiteral) => void;
|
|
2575
|
+
ThrowStatement?: (node: ThrowStatement) => void;
|
|
2576
|
+
"ThrowStatement:exit"?: (node: ThrowStatement) => void;
|
|
2577
|
+
TryStatement?: (node: TryStatement) => void;
|
|
2578
|
+
"TryStatement:exit"?: (node: TryStatement) => void;
|
|
2579
|
+
UnaryExpression?: (node: UnaryExpression) => void;
|
|
2580
|
+
"UnaryExpression:exit"?: (node: UnaryExpression) => void;
|
|
2581
|
+
UpdateExpression?: (node: UpdateExpression) => void;
|
|
2582
|
+
"UpdateExpression:exit"?: (node: UpdateExpression) => void;
|
|
2583
|
+
V8IntrinsicExpression?: (node: V8IntrinsicExpression) => void;
|
|
2584
|
+
"V8IntrinsicExpression:exit"?: (node: V8IntrinsicExpression) => void;
|
|
2585
|
+
VariableDeclaration?: (node: VariableDeclaration) => void;
|
|
2586
|
+
"VariableDeclaration:exit"?: (node: VariableDeclaration) => void;
|
|
2587
|
+
VariableDeclarator?: (node: VariableDeclarator) => void;
|
|
2588
|
+
"VariableDeclarator:exit"?: (node: VariableDeclarator) => void;
|
|
2589
|
+
WhileStatement?: (node: WhileStatement) => void;
|
|
2590
|
+
"WhileStatement:exit"?: (node: WhileStatement) => void;
|
|
2591
|
+
WithStatement?: (node: WithStatement) => void;
|
|
2592
|
+
"WithStatement:exit"?: (node: WithStatement) => void;
|
|
2593
|
+
YieldExpression?: (node: YieldExpression) => void;
|
|
2594
|
+
"YieldExpression:exit"?: (node: YieldExpression) => void;
|
|
2595
|
+
JSXAttribute?: (node: JSXAttribute) => void;
|
|
2596
|
+
"JSXAttribute:exit"?: (node: JSXAttribute) => void;
|
|
2597
|
+
JSXClosingElement?: (node: JSXClosingElement) => void;
|
|
2598
|
+
"JSXClosingElement:exit"?: (node: JSXClosingElement) => void;
|
|
2599
|
+
JSXElement?: (node: JSXElement) => void;
|
|
2600
|
+
"JSXElement:exit"?: (node: JSXElement) => void;
|
|
2601
|
+
JSXExpressionContainer?: (node: JSXExpressionContainer) => void;
|
|
2602
|
+
"JSXExpressionContainer:exit"?: (node: JSXExpressionContainer) => void;
|
|
2603
|
+
JSXFragment?: (node: JSXFragment) => void;
|
|
2604
|
+
"JSXFragment:exit"?: (node: JSXFragment) => void;
|
|
2605
|
+
JSXMemberExpression?: (node: JSXMemberExpression) => void;
|
|
2606
|
+
"JSXMemberExpression:exit"?: (node: JSXMemberExpression) => void;
|
|
2607
|
+
JSXNamespacedName?: (node: JSXNamespacedName) => void;
|
|
2608
|
+
"JSXNamespacedName:exit"?: (node: JSXNamespacedName) => void;
|
|
2609
|
+
JSXOpeningElement?: (node: JSXOpeningElement) => void;
|
|
2610
|
+
"JSXOpeningElement:exit"?: (node: JSXOpeningElement) => void;
|
|
2611
|
+
JSXSpreadAttribute?: (node: JSXSpreadAttribute) => void;
|
|
2612
|
+
"JSXSpreadAttribute:exit"?: (node: JSXSpreadAttribute) => void;
|
|
2613
|
+
JSXSpreadChild?: (node: JSXSpreadChild) => void;
|
|
2614
|
+
"JSXSpreadChild:exit"?: (node: JSXSpreadChild) => void;
|
|
2615
|
+
TSAbstractAccessorProperty?: (node: AccessorProperty) => void;
|
|
2616
|
+
"TSAbstractAccessorProperty:exit"?: (node: AccessorProperty) => void;
|
|
2617
|
+
TSAbstractMethodDefinition?: (node: MethodDefinition) => void;
|
|
2618
|
+
"TSAbstractMethodDefinition:exit"?: (node: MethodDefinition) => void;
|
|
2619
|
+
TSAbstractPropertyDefinition?: (node: PropertyDefinition) => void;
|
|
2620
|
+
"TSAbstractPropertyDefinition:exit"?: (node: PropertyDefinition) => void;
|
|
2621
|
+
TSArrayType?: (node: TSArrayType) => void;
|
|
2622
|
+
"TSArrayType:exit"?: (node: TSArrayType) => void;
|
|
2623
|
+
TSAsExpression?: (node: TSAsExpression) => void;
|
|
2624
|
+
"TSAsExpression:exit"?: (node: TSAsExpression) => void;
|
|
2625
|
+
TSCallSignatureDeclaration?: (node: TSCallSignatureDeclaration) => void;
|
|
2626
|
+
"TSCallSignatureDeclaration:exit"?: (node: TSCallSignatureDeclaration) => void;
|
|
2627
|
+
TSClassImplements?: (node: TSClassImplements) => void;
|
|
2628
|
+
"TSClassImplements:exit"?: (node: TSClassImplements) => void;
|
|
2629
|
+
TSConditionalType?: (node: TSConditionalType) => void;
|
|
2630
|
+
"TSConditionalType:exit"?: (node: TSConditionalType) => void;
|
|
2631
|
+
TSConstructSignatureDeclaration?: (node: TSConstructSignatureDeclaration) => void;
|
|
2632
|
+
"TSConstructSignatureDeclaration:exit"?: (node: TSConstructSignatureDeclaration) => void;
|
|
2633
|
+
TSConstructorType?: (node: TSConstructorType) => void;
|
|
2634
|
+
"TSConstructorType:exit"?: (node: TSConstructorType) => void;
|
|
2635
|
+
TSDeclareFunction?: (node: Function$1) => void;
|
|
2636
|
+
"TSDeclareFunction:exit"?: (node: Function$1) => void;
|
|
2637
|
+
TSEmptyBodyFunctionExpression?: (node: Function$1) => void;
|
|
2638
|
+
"TSEmptyBodyFunctionExpression:exit"?: (node: Function$1) => void;
|
|
2639
|
+
TSEnumBody?: (node: TSEnumBody) => void;
|
|
2640
|
+
"TSEnumBody:exit"?: (node: TSEnumBody) => void;
|
|
2641
|
+
TSEnumDeclaration?: (node: TSEnumDeclaration) => void;
|
|
2642
|
+
"TSEnumDeclaration:exit"?: (node: TSEnumDeclaration) => void;
|
|
2643
|
+
TSEnumMember?: (node: TSEnumMember) => void;
|
|
2644
|
+
"TSEnumMember:exit"?: (node: TSEnumMember) => void;
|
|
2645
|
+
TSExportAssignment?: (node: TSExportAssignment) => void;
|
|
2646
|
+
"TSExportAssignment:exit"?: (node: TSExportAssignment) => void;
|
|
2647
|
+
TSExternalModuleReference?: (node: TSExternalModuleReference) => void;
|
|
2648
|
+
"TSExternalModuleReference:exit"?: (node: TSExternalModuleReference) => void;
|
|
2649
|
+
TSFunctionType?: (node: TSFunctionType) => void;
|
|
2650
|
+
"TSFunctionType:exit"?: (node: TSFunctionType) => void;
|
|
2651
|
+
TSImportEqualsDeclaration?: (node: TSImportEqualsDeclaration) => void;
|
|
2652
|
+
"TSImportEqualsDeclaration:exit"?: (node: TSImportEqualsDeclaration) => void;
|
|
2653
|
+
TSImportType?: (node: TSImportType) => void;
|
|
2654
|
+
"TSImportType:exit"?: (node: TSImportType) => void;
|
|
2655
|
+
TSIndexSignature?: (node: TSIndexSignature) => void;
|
|
2656
|
+
"TSIndexSignature:exit"?: (node: TSIndexSignature) => void;
|
|
2657
|
+
TSIndexedAccessType?: (node: TSIndexedAccessType) => void;
|
|
2658
|
+
"TSIndexedAccessType:exit"?: (node: TSIndexedAccessType) => void;
|
|
2659
|
+
TSInferType?: (node: TSInferType) => void;
|
|
2660
|
+
"TSInferType:exit"?: (node: TSInferType) => void;
|
|
2661
|
+
TSInstantiationExpression?: (node: TSInstantiationExpression) => void;
|
|
2662
|
+
"TSInstantiationExpression:exit"?: (node: TSInstantiationExpression) => void;
|
|
2663
|
+
TSInterfaceBody?: (node: TSInterfaceBody) => void;
|
|
2664
|
+
"TSInterfaceBody:exit"?: (node: TSInterfaceBody) => void;
|
|
2665
|
+
TSInterfaceDeclaration?: (node: TSInterfaceDeclaration) => void;
|
|
2666
|
+
"TSInterfaceDeclaration:exit"?: (node: TSInterfaceDeclaration) => void;
|
|
2667
|
+
TSInterfaceHeritage?: (node: TSInterfaceHeritage) => void;
|
|
2668
|
+
"TSInterfaceHeritage:exit"?: (node: TSInterfaceHeritage) => void;
|
|
2669
|
+
TSIntersectionType?: (node: TSIntersectionType) => void;
|
|
2670
|
+
"TSIntersectionType:exit"?: (node: TSIntersectionType) => void;
|
|
2671
|
+
TSJSDocNonNullableType?: (node: JSDocNonNullableType) => void;
|
|
2672
|
+
"TSJSDocNonNullableType:exit"?: (node: JSDocNonNullableType) => void;
|
|
2673
|
+
TSJSDocNullableType?: (node: JSDocNullableType) => void;
|
|
2674
|
+
"TSJSDocNullableType:exit"?: (node: JSDocNullableType) => void;
|
|
2675
|
+
TSLiteralType?: (node: TSLiteralType) => void;
|
|
2676
|
+
"TSLiteralType:exit"?: (node: TSLiteralType) => void;
|
|
2677
|
+
TSMappedType?: (node: TSMappedType) => void;
|
|
2678
|
+
"TSMappedType:exit"?: (node: TSMappedType) => void;
|
|
2679
|
+
TSMethodSignature?: (node: TSMethodSignature) => void;
|
|
2680
|
+
"TSMethodSignature:exit"?: (node: TSMethodSignature) => void;
|
|
2681
|
+
TSModuleBlock?: (node: TSModuleBlock) => void;
|
|
2682
|
+
"TSModuleBlock:exit"?: (node: TSModuleBlock) => void;
|
|
2683
|
+
TSModuleDeclaration?: (node: TSModuleDeclaration | TSGlobalDeclaration) => void;
|
|
2684
|
+
"TSModuleDeclaration:exit"?: (node: TSModuleDeclaration | TSGlobalDeclaration) => void;
|
|
2685
|
+
TSNamedTupleMember?: (node: TSNamedTupleMember) => void;
|
|
2686
|
+
"TSNamedTupleMember:exit"?: (node: TSNamedTupleMember) => void;
|
|
2687
|
+
TSNamespaceExportDeclaration?: (node: TSNamespaceExportDeclaration) => void;
|
|
2688
|
+
"TSNamespaceExportDeclaration:exit"?: (node: TSNamespaceExportDeclaration) => void;
|
|
2689
|
+
TSNonNullExpression?: (node: TSNonNullExpression) => void;
|
|
2690
|
+
"TSNonNullExpression:exit"?: (node: TSNonNullExpression) => void;
|
|
2691
|
+
TSOptionalType?: (node: TSOptionalType) => void;
|
|
2692
|
+
"TSOptionalType:exit"?: (node: TSOptionalType) => void;
|
|
2693
|
+
TSParameterProperty?: (node: TSParameterProperty) => void;
|
|
2694
|
+
"TSParameterProperty:exit"?: (node: TSParameterProperty) => void;
|
|
2695
|
+
TSParenthesizedType?: (node: TSParenthesizedType) => void;
|
|
2696
|
+
"TSParenthesizedType:exit"?: (node: TSParenthesizedType) => void;
|
|
2697
|
+
TSPropertySignature?: (node: TSPropertySignature) => void;
|
|
2698
|
+
"TSPropertySignature:exit"?: (node: TSPropertySignature) => void;
|
|
2699
|
+
TSQualifiedName?: (node: TSQualifiedName) => void;
|
|
2700
|
+
"TSQualifiedName:exit"?: (node: TSQualifiedName) => void;
|
|
2701
|
+
TSRestType?: (node: TSRestType) => void;
|
|
2702
|
+
"TSRestType:exit"?: (node: TSRestType) => void;
|
|
2703
|
+
TSSatisfiesExpression?: (node: TSSatisfiesExpression) => void;
|
|
2704
|
+
"TSSatisfiesExpression:exit"?: (node: TSSatisfiesExpression) => void;
|
|
2705
|
+
TSTemplateLiteralType?: (node: TSTemplateLiteralType) => void;
|
|
2706
|
+
"TSTemplateLiteralType:exit"?: (node: TSTemplateLiteralType) => void;
|
|
2707
|
+
TSTupleType?: (node: TSTupleType) => void;
|
|
2708
|
+
"TSTupleType:exit"?: (node: TSTupleType) => void;
|
|
2709
|
+
TSTypeAliasDeclaration?: (node: TSTypeAliasDeclaration) => void;
|
|
2710
|
+
"TSTypeAliasDeclaration:exit"?: (node: TSTypeAliasDeclaration) => void;
|
|
2711
|
+
TSTypeAnnotation?: (node: TSTypeAnnotation) => void;
|
|
2712
|
+
"TSTypeAnnotation:exit"?: (node: TSTypeAnnotation) => void;
|
|
2713
|
+
TSTypeAssertion?: (node: TSTypeAssertion) => void;
|
|
2714
|
+
"TSTypeAssertion:exit"?: (node: TSTypeAssertion) => void;
|
|
2715
|
+
TSTypeLiteral?: (node: TSTypeLiteral) => void;
|
|
2716
|
+
"TSTypeLiteral:exit"?: (node: TSTypeLiteral) => void;
|
|
2717
|
+
TSTypeOperator?: (node: TSTypeOperator) => void;
|
|
2718
|
+
"TSTypeOperator:exit"?: (node: TSTypeOperator) => void;
|
|
2719
|
+
TSTypeParameter?: (node: TSTypeParameter) => void;
|
|
2720
|
+
"TSTypeParameter:exit"?: (node: TSTypeParameter) => void;
|
|
2721
|
+
TSTypeParameterDeclaration?: (node: TSTypeParameterDeclaration) => void;
|
|
2722
|
+
"TSTypeParameterDeclaration:exit"?: (node: TSTypeParameterDeclaration) => void;
|
|
2723
|
+
TSTypeParameterInstantiation?: (node: TSTypeParameterInstantiation) => void;
|
|
2724
|
+
"TSTypeParameterInstantiation:exit"?: (node: TSTypeParameterInstantiation) => void;
|
|
2725
|
+
TSTypePredicate?: (node: TSTypePredicate) => void;
|
|
2726
|
+
"TSTypePredicate:exit"?: (node: TSTypePredicate) => void;
|
|
2727
|
+
TSTypeQuery?: (node: TSTypeQuery) => void;
|
|
2728
|
+
"TSTypeQuery:exit"?: (node: TSTypeQuery) => void;
|
|
2729
|
+
TSTypeReference?: (node: TSTypeReference) => void;
|
|
2730
|
+
"TSTypeReference:exit"?: (node: TSTypeReference) => void;
|
|
2731
|
+
TSUnionType?: (node: TSUnionType) => void;
|
|
2732
|
+
"TSUnionType:exit"?: (node: TSUnionType) => void;
|
|
2733
|
+
}
|
|
2734
|
+
type VisitorObject = { [K in keyof StrictVisitorObject]?: BivarianceHackHandler<Exclude<StrictVisitorObject[K], undefined>> | undefined } & Record<string, BivarianceHackHandler<(node: Node$1) => void> | undefined>;
|
|
2735
|
+
//#endregion
|
|
2736
|
+
//#region src-js/plugins/types.d.ts
|
|
2737
|
+
type BeforeHook = () => boolean | void;
|
|
2738
|
+
type AfterHook = () => void;
|
|
2739
|
+
type VisitorWithHooks = VisitorObject & {
|
|
2740
|
+
before?: BeforeHook;
|
|
2741
|
+
after?: AfterHook;
|
|
2742
|
+
};
|
|
2743
|
+
interface Node extends Span {}
|
|
2744
|
+
type NodeOrToken = Node | TokenType | Comment;
|
|
2745
|
+
interface Comment extends Span {
|
|
2746
|
+
type: "Line" | "Block" | "Shebang";
|
|
2747
|
+
value: string;
|
|
2748
|
+
}
|
|
2749
|
+
//#endregion
|
|
2750
|
+
//#region src-js/plugins/location.d.ts
|
|
2751
|
+
/**
|
|
2752
|
+
* Range of source offsets.
|
|
2753
|
+
*/
|
|
2754
|
+
type Range = [number, number];
|
|
2755
|
+
/**
|
|
2756
|
+
* Interface for any type which has `range` field.
|
|
2757
|
+
*/
|
|
2758
|
+
interface Ranged {
|
|
2759
|
+
range: Range;
|
|
2760
|
+
}
|
|
2761
|
+
/**
|
|
2762
|
+
* Interface for any type which has location properties.
|
|
2763
|
+
*/
|
|
2764
|
+
interface Span extends Ranged {
|
|
2765
|
+
start: number;
|
|
2766
|
+
end: number;
|
|
2767
|
+
loc: Location;
|
|
2768
|
+
}
|
|
2769
|
+
/**
|
|
2770
|
+
* Source code location.
|
|
2771
|
+
*/
|
|
2772
|
+
interface Location {
|
|
2773
|
+
start: LineColumn;
|
|
2774
|
+
end: LineColumn;
|
|
2775
|
+
}
|
|
2776
|
+
/**
|
|
2777
|
+
* Line number + column number pair.
|
|
2778
|
+
* `line` is 1-indexed, `column` is 0-indexed.
|
|
2779
|
+
*/
|
|
2780
|
+
interface LineColumn {
|
|
2781
|
+
line: number;
|
|
2782
|
+
column: number;
|
|
2783
|
+
}
|
|
2784
|
+
/**
|
|
2785
|
+
* Convert a source text index into a (line, column) pair.
|
|
2786
|
+
* @param offset - The index of a character in a file.
|
|
2787
|
+
* @returns `{line, column}` location object with 1-indexed line and 0-indexed column.
|
|
2788
|
+
* @throws {TypeError|RangeError} If non-numeric `offset`, or `offset` out of range.
|
|
2789
|
+
*/
|
|
2790
|
+
declare function getLineColumnFromOffset(offset: number): LineColumn;
|
|
2791
|
+
/**
|
|
2792
|
+
* Convert a `{ line, column }` pair into a range index.
|
|
2793
|
+
* @param loc - A line/column location.
|
|
2794
|
+
* @returns The character index of the location in the file.
|
|
2795
|
+
* @throws {TypeError|RangeError} If `loc` is not an object with a numeric `line` and `column`,
|
|
2796
|
+
* or if the `line` is less than or equal to zero, or the line or column is out of the expected range.
|
|
2797
|
+
*/
|
|
2798
|
+
declare function getOffsetFromLineColumn(loc: LineColumn): number;
|
|
2799
|
+
/**
|
|
2800
|
+
* Get the range of the given node or token.
|
|
2801
|
+
* @param nodeOrToken - Node or token to get the range of
|
|
2802
|
+
* @returns Range of the node or token
|
|
2803
|
+
*/
|
|
2804
|
+
declare function getRange(nodeOrToken: NodeOrToken): Range;
|
|
2805
|
+
/**
|
|
2806
|
+
* Get the location of the given node or token.
|
|
2807
|
+
* @param nodeOrToken - Node or token to get the location of
|
|
2808
|
+
* @returns Location of the node or token
|
|
2809
|
+
*/
|
|
2810
|
+
declare function getLoc(nodeOrToken: NodeOrToken): Location;
|
|
2811
|
+
/**
|
|
2812
|
+
* Get the deepest node containing a range index.
|
|
2813
|
+
* @param offset - Range index of the desired node
|
|
2814
|
+
* @returns The node if found, or `null` if not found
|
|
2815
|
+
*/
|
|
2816
|
+
declare function getNodeByRangeIndex(offset: number): Node$1 | null;
|
|
2817
|
+
//#endregion
|
|
2818
|
+
//#region src-js/plugins/fix.d.ts
|
|
2819
|
+
type FixFn = (fixer: Fixer) => Fix | Array<Fix | null | undefined> | IterableIterator<Fix | null | undefined> | null | undefined;
|
|
2820
|
+
/**
|
|
2821
|
+
* Fix, as returned by `fix` function.
|
|
2822
|
+
*
|
|
2823
|
+
* `range` offsets are relative to start of the source text.
|
|
2824
|
+
* When the file has a BOM, they are relative to the start of the source text *without* the BOM.
|
|
2825
|
+
*
|
|
2826
|
+
* To represent a position *before* a BOM, -1 is used to mean "before the BOM".
|
|
2827
|
+
* ESLint's `unicode-bom` rule produces a fix `{ range: [-1, 0], text: "" }` to remove a BOM.
|
|
2828
|
+
*/
|
|
2829
|
+
interface Fix {
|
|
2830
|
+
range: Range;
|
|
2831
|
+
text: string;
|
|
2832
|
+
}
|
|
2833
|
+
declare const FIXER: Readonly<{
|
|
2834
|
+
insertTextBefore(nodeOrToken: Ranged, text: string): Fix;
|
|
2835
|
+
insertTextBeforeRange(range: Range, text: string): Fix;
|
|
2836
|
+
insertTextAfter(nodeOrToken: Ranged, text: string): Fix;
|
|
2837
|
+
insertTextAfterRange(range: Range, text: string): Fix;
|
|
2838
|
+
remove(nodeOrToken: Ranged): Fix;
|
|
2839
|
+
removeRange(range: Range): Fix;
|
|
2840
|
+
replaceText(nodeOrToken: Ranged, text: string): Fix;
|
|
2841
|
+
replaceTextRange(range: Range, text: string): Fix;
|
|
2842
|
+
}>;
|
|
2843
|
+
type Fixer = typeof FIXER;
|
|
2844
|
+
//#endregion
|
|
2845
|
+
//#region src-js/plugins/report.d.ts
|
|
2846
|
+
/**
|
|
2847
|
+
* Diagnostic object.
|
|
2848
|
+
* Passed to `Context#report()`.
|
|
2849
|
+
*
|
|
2850
|
+
* - Either `message` or `messageId` property must be provided.
|
|
2851
|
+
* - Either `node` or `loc` property must be provided.
|
|
2852
|
+
*/
|
|
2853
|
+
type Diagnostic = RequireAtLeastOne<RequireAtLeastOne<DiagnosticBase, "node" | "loc">, "message" | "messageId">;
|
|
2854
|
+
interface DiagnosticBase {
|
|
2855
|
+
message?: string | null | undefined;
|
|
2856
|
+
messageId?: string | null | undefined;
|
|
2857
|
+
node?: Ranged;
|
|
2858
|
+
loc?: LocationWithOptionalEnd | LineColumn;
|
|
2859
|
+
data?: DiagnosticData | null | undefined;
|
|
2860
|
+
fix?: FixFn;
|
|
2861
|
+
suggest?: Suggestion[] | null | undefined;
|
|
2862
|
+
}
|
|
2863
|
+
/**
|
|
2864
|
+
* Location with `end` property optional.
|
|
2865
|
+
*/
|
|
2866
|
+
interface LocationWithOptionalEnd {
|
|
2867
|
+
start: LineColumn;
|
|
2868
|
+
end?: LineColumn | null | undefined;
|
|
2869
|
+
}
|
|
2870
|
+
/**
|
|
2871
|
+
* Data to interpolate into a diagnostic message.
|
|
2872
|
+
*/
|
|
2873
|
+
type DiagnosticData = Record<string, string | number | boolean | bigint | null | undefined>;
|
|
2874
|
+
/**
|
|
2875
|
+
* Suggested fix.
|
|
2876
|
+
*/
|
|
2877
|
+
type Suggestion = RequireAtLeastOne<SuggestionBase, "desc" | "messageId">;
|
|
2878
|
+
interface SuggestionBase {
|
|
2879
|
+
desc?: string;
|
|
2880
|
+
messageId?: string;
|
|
2881
|
+
data?: DiagnosticData | null | undefined;
|
|
2882
|
+
fix: FixFn;
|
|
2883
|
+
}
|
|
2884
|
+
/**
|
|
2885
|
+
* Suggested fix in form sent to Rust.
|
|
2886
|
+
*/
|
|
2887
|
+
//#endregion
|
|
2888
|
+
//#region src-js/plugins/settings.d.ts
|
|
2889
|
+
/**
|
|
2890
|
+
* Settings for the file being linted.
|
|
2891
|
+
*
|
|
2892
|
+
* Settings are deserialized from JSON, so can only contain JSON-compatible values.
|
|
2893
|
+
*/
|
|
2894
|
+
type Settings = JsonObject;
|
|
2895
|
+
//#endregion
|
|
2896
|
+
//#region src-js/plugins/comments.d.ts
|
|
2897
|
+
/**
|
|
2898
|
+
* Retrieve an array containing all comments in the source code.
|
|
2899
|
+
* @returns Array of `Comment`s in order they appear in source.
|
|
2900
|
+
*/
|
|
2901
|
+
declare function getAllComments(): Comment[];
|
|
2902
|
+
/**
|
|
2903
|
+
* Get all comments directly before the given node or token.
|
|
2904
|
+
*
|
|
2905
|
+
* "Directly before" means only comments before this node, and after the preceding token.
|
|
2906
|
+
*
|
|
2907
|
+
* ```js
|
|
2908
|
+
* // Define `x`
|
|
2909
|
+
* const x = 1;
|
|
2910
|
+
* // Define `y`
|
|
2911
|
+
* const y = 2;
|
|
2912
|
+
* ```
|
|
2913
|
+
*
|
|
2914
|
+
* `sourceCode.getCommentsBefore(varDeclY)` will only return "Define `y`" comment, not also "Define `x`".
|
|
2915
|
+
*
|
|
2916
|
+
* @param nodeOrToken - The AST node or token to check for adjacent comment tokens.
|
|
2917
|
+
* @returns Array of `Comment`s in occurrence order.
|
|
2918
|
+
*/
|
|
2919
|
+
declare function getCommentsBefore(nodeOrToken: NodeOrToken): Comment[];
|
|
2920
|
+
/**
|
|
2921
|
+
* Get all comment tokens directly after the given node or token.
|
|
2922
|
+
*
|
|
2923
|
+
* "Directly after" means only comments between end of this node, and the next token following it.
|
|
2924
|
+
*
|
|
2925
|
+
* ```js
|
|
2926
|
+
* const x = 1;
|
|
2927
|
+
* // Define `y`
|
|
2928
|
+
* const y = 2;
|
|
2929
|
+
* // Define `z`
|
|
2930
|
+
* const z = 3;
|
|
2931
|
+
* ```
|
|
2932
|
+
*
|
|
2933
|
+
* `sourceCode.getCommentsAfter(varDeclX)` will only return "Define `y`" comment, not also "Define `z`".
|
|
2934
|
+
*
|
|
2935
|
+
* @param nodeOrToken - The AST node or token to check for adjacent comment tokens.
|
|
2936
|
+
* @returns Array of `Comment`s in occurrence order.
|
|
2937
|
+
*/
|
|
2938
|
+
declare function getCommentsAfter(nodeOrToken: NodeOrToken): Comment[];
|
|
2939
|
+
/**
|
|
2940
|
+
* Get all comment tokens inside the given node.
|
|
2941
|
+
* @param node - The AST node to get the comments for.
|
|
2942
|
+
* @returns Array of `Comment`s in occurrence order.
|
|
2943
|
+
*/
|
|
2944
|
+
declare function getCommentsInside(node: Node): Comment[];
|
|
2945
|
+
/**
|
|
2946
|
+
* Check whether any comments exist or not between the given 2 nodes.
|
|
2947
|
+
* @param nodeOrToken1 - Start node/token.
|
|
2948
|
+
* @param nodeOrToken2 - End node/token.
|
|
2949
|
+
* @returns `true` if one or more comments exist between the two.
|
|
2950
|
+
*/
|
|
2951
|
+
declare function commentsExistBetween(nodeOrToken1: NodeOrToken, nodeOrToken2: NodeOrToken): boolean;
|
|
2952
|
+
/**
|
|
2953
|
+
* Retrieve the JSDoc comment for a given node.
|
|
2954
|
+
*
|
|
2955
|
+
* @deprecated
|
|
2956
|
+
*
|
|
2957
|
+
* @param node - The AST node to get the comment for.
|
|
2958
|
+
* @returns The JSDoc comment for the given node, or `null` if not found.
|
|
2959
|
+
*/
|
|
2960
|
+
declare function getJSDocComment(node: Node): Comment | null;
|
|
2961
|
+
//#endregion
|
|
2962
|
+
//#region src-js/plugins/scope.d.ts
|
|
2963
|
+
interface Scope {
|
|
2964
|
+
type: ScopeType;
|
|
2965
|
+
isStrict: boolean;
|
|
2966
|
+
upper: Scope | null;
|
|
2967
|
+
childScopes: Scope[];
|
|
2968
|
+
variableScope: Scope;
|
|
2969
|
+
block: Node$1;
|
|
2970
|
+
variables: Variable[];
|
|
2971
|
+
set: Map<string, Variable>;
|
|
2972
|
+
references: Reference[];
|
|
2973
|
+
through: Reference[];
|
|
2974
|
+
functionExpressionScope: boolean;
|
|
2975
|
+
implicit?: {
|
|
2976
|
+
variables: Variable[];
|
|
2977
|
+
set: Map<string, Variable>;
|
|
2978
|
+
};
|
|
2979
|
+
}
|
|
2980
|
+
type ScopeType = "block" | "catch" | "class" | "class-field-initializer" | "class-static-block" | "for" | "function" | "function-expression-name" | "global" | "module" | "switch" | "with";
|
|
2981
|
+
interface Variable {
|
|
2982
|
+
name: string;
|
|
2983
|
+
scope: Scope;
|
|
2984
|
+
identifiers: Identifier[];
|
|
2985
|
+
references: Reference[];
|
|
2986
|
+
defs: Definition[];
|
|
2987
|
+
}
|
|
2988
|
+
interface Reference {
|
|
2989
|
+
identifier: Identifier;
|
|
2990
|
+
from: Scope;
|
|
2991
|
+
resolved: Variable | null;
|
|
2992
|
+
writeExpr: Expression | null;
|
|
2993
|
+
init: boolean;
|
|
2994
|
+
isWrite(): boolean;
|
|
2995
|
+
isRead(): boolean;
|
|
2996
|
+
isReadOnly(): boolean;
|
|
2997
|
+
isWriteOnly(): boolean;
|
|
2998
|
+
isReadWrite(): boolean;
|
|
2999
|
+
}
|
|
3000
|
+
interface Definition {
|
|
3001
|
+
type: DefinitionType;
|
|
3002
|
+
name: Identifier;
|
|
3003
|
+
node: Node$1;
|
|
3004
|
+
parent: Node$1 | null;
|
|
3005
|
+
}
|
|
3006
|
+
type DefinitionType = "CatchClause" | "ClassName" | "FunctionName" | "ImplicitGlobalVariable" | "ImportBinding" | "Parameter" | "Variable";
|
|
3007
|
+
type Identifier = IdentifierName | IdentifierReference | BindingIdentifier | LabelIdentifier | TSThisParameter | TSIndexSignatureName;
|
|
3008
|
+
/**
|
|
3009
|
+
* Discard TS-ESLint `ScopeManager`, to free memory.
|
|
3010
|
+
*/
|
|
3011
|
+
declare const SCOPE_MANAGER: Readonly<{
|
|
3012
|
+
/**
|
|
3013
|
+
* All scopes.
|
|
3014
|
+
*/
|
|
3015
|
+
readonly scopes: Scope[];
|
|
3016
|
+
/**
|
|
3017
|
+
* The root scope.
|
|
3018
|
+
*/
|
|
3019
|
+
readonly globalScope: Scope | null;
|
|
3020
|
+
/**
|
|
3021
|
+
* Get the variables that a given AST node defines.
|
|
3022
|
+
* The returned variables' `def[].node` / `def[].parent` property is the node.
|
|
3023
|
+
* If the node does not define any variable, this returns an empty array.
|
|
3024
|
+
* @param node AST node to get variables of.
|
|
3025
|
+
*/
|
|
3026
|
+
getDeclaredVariables(node: Node$1): Variable[];
|
|
3027
|
+
/**
|
|
3028
|
+
* Get the scope of a given AST node. The returned scope's `block` property is the node.
|
|
3029
|
+
* This method never returns `function-expression-name` scope.
|
|
3030
|
+
* If the node does not have a scope, returns `null`.
|
|
3031
|
+
*
|
|
3032
|
+
* @param node An AST node to get their scope.
|
|
3033
|
+
* @param inner If the node has multiple scopes, this returns the outermost scope normally.
|
|
3034
|
+
* If `inner` is `true` then this returns the innermost scope.
|
|
3035
|
+
*/
|
|
3036
|
+
acquire(node: Node$1, inner?: boolean): Scope | null;
|
|
3037
|
+
}>;
|
|
3038
|
+
type ScopeManager = typeof SCOPE_MANAGER;
|
|
3039
|
+
/**
|
|
3040
|
+
* Determine whether the given identifier node is a reference to a global variable.
|
|
3041
|
+
* @param node - `Identifier` node to check.
|
|
3042
|
+
* @returns `true` if the identifier is a reference to a global variable.
|
|
3043
|
+
*/
|
|
3044
|
+
declare function isGlobalReference(node: Node$1): boolean;
|
|
3045
|
+
/**
|
|
3046
|
+
* Get the variables that `node` defines.
|
|
3047
|
+
* This is a convenience method that passes through to the same method on the `ScopeManager`.
|
|
3048
|
+
* @param node - The node for which the variables are obtained.
|
|
3049
|
+
* @returns An array of variable nodes representing the variables that `node` defines.
|
|
3050
|
+
*/
|
|
3051
|
+
declare function getDeclaredVariables(node: Node$1): Variable[];
|
|
3052
|
+
/**
|
|
3053
|
+
* Get the scope for the given node.
|
|
3054
|
+
* @param node - The node to get the scope of.
|
|
3055
|
+
* @returns The scope information for this node.
|
|
3056
|
+
*/
|
|
3057
|
+
declare function getScope(node: Node$1): Scope;
|
|
3058
|
+
/**
|
|
3059
|
+
* Marks as used a variable with the given name in a scope indicated by the given reference node.
|
|
3060
|
+
* This affects the `no-unused-vars` rule.
|
|
3061
|
+
* @param name - Variable name
|
|
3062
|
+
* @param refNode - Reference node
|
|
3063
|
+
* @returns `true` if a variable with the given name was found and marked as used, otherwise `false`
|
|
3064
|
+
*/
|
|
3065
|
+
declare function markVariableAsUsed(name: string, refNode: Node$1): boolean;
|
|
3066
|
+
//#endregion
|
|
3067
|
+
//#region src-js/plugins/tokens_methods.d.ts
|
|
3068
|
+
/**
|
|
3069
|
+
* Options for various `SourceCode` methods e.g. `getFirstToken`.
|
|
3070
|
+
*/
|
|
3071
|
+
interface SkipOptions {
|
|
3072
|
+
/** Number of skipping tokens */
|
|
3073
|
+
skip?: number;
|
|
3074
|
+
/** `true` to include comment tokens in the result */
|
|
3075
|
+
includeComments?: boolean;
|
|
3076
|
+
/** Function to filter tokens */
|
|
3077
|
+
filter?: FilterFn | null;
|
|
3078
|
+
}
|
|
3079
|
+
/**
|
|
3080
|
+
* Options for various `SourceCode` methods e.g. `getFirstTokens`.
|
|
3081
|
+
*/
|
|
3082
|
+
interface CountOptions {
|
|
3083
|
+
/** Maximum number of tokens to return */
|
|
3084
|
+
count?: number;
|
|
3085
|
+
/** `true` to include comment tokens in the result */
|
|
3086
|
+
includeComments?: boolean;
|
|
3087
|
+
/** Function to filter tokens */
|
|
3088
|
+
filter?: FilterFn | null;
|
|
3089
|
+
}
|
|
3090
|
+
/**
|
|
3091
|
+
* Options for `getTokenByRangeStart`.
|
|
3092
|
+
*/
|
|
3093
|
+
interface RangeOptions {
|
|
3094
|
+
/** `true` to include comment tokens in the result */
|
|
3095
|
+
includeComments?: boolean;
|
|
3096
|
+
}
|
|
3097
|
+
/**
|
|
3098
|
+
* Filter function, passed as `filter` property of `SkipOptions` and `CountOptions`.
|
|
3099
|
+
*/
|
|
3100
|
+
type FilterFn = (token: TokenOrComment) => boolean;
|
|
3101
|
+
/**
|
|
3102
|
+
* Whether `Options` may include comment tokens in the result.
|
|
3103
|
+
* Resolves to `true` if `Options` has an `includeComments` property whose type includes `true`
|
|
3104
|
+
* (i.e. it's `true`, `boolean`, or `boolean | undefined`), and `false` otherwise.
|
|
3105
|
+
*/
|
|
3106
|
+
type MayIncludeComments<Options> = Options extends {
|
|
3107
|
+
includeComments: false;
|
|
3108
|
+
} ? false : "includeComments" extends keyof Options ? true : false;
|
|
3109
|
+
/**
|
|
3110
|
+
* Resolves to `TokenOrComment` if `Options` may include comments, `Token` otherwise.
|
|
3111
|
+
*/
|
|
3112
|
+
type TokenResult<Options> = MayIncludeComments<Options> extends true ? TokenOrComment : TokenType;
|
|
3113
|
+
/**
|
|
3114
|
+
* Get all tokens that are related to the given node.
|
|
3115
|
+
* @param node - The AST node.
|
|
3116
|
+
* @param countOptions? - Options object. If is a function, equivalent to `{ filter: fn }`.
|
|
3117
|
+
* @returns Array of `Token`s, or array of `Token | Comment`s if `includeComments` is `true`.
|
|
3118
|
+
*/
|
|
3119
|
+
/**
|
|
3120
|
+
* Get all tokens that are related to the given node.
|
|
3121
|
+
* @param node - The AST node.
|
|
3122
|
+
* @param beforeCount? - The number of tokens before the node to retrieve.
|
|
3123
|
+
* @param afterCount? - The number of tokens after the node to retrieve.
|
|
3124
|
+
* @returns Array of `Token`s, or array of `Token | Comment`s if `includeComments` is `true`.
|
|
3125
|
+
*/
|
|
3126
|
+
declare function getTokens<Options extends CountOptions | number | FilterFn | null | undefined>(node: Node, countOptions?: Options, afterCount?: number | null): TokenResult<Options>[];
|
|
3127
|
+
/**
|
|
3128
|
+
* Get the first token of the given node.
|
|
3129
|
+
* @param node - The AST node.
|
|
3130
|
+
* @param skipOptions? - Options object.
|
|
3131
|
+
* If is a number, equivalent to `{ skip: n }`.
|
|
3132
|
+
* If is a function, equivalent to `{ filter: fn }`.
|
|
3133
|
+
* @returns `Token` (or `Token | Comment` if `includeComments` is `true`), or `null` if none found.
|
|
3134
|
+
*/
|
|
3135
|
+
declare function getFirstToken<Options extends SkipOptions | number | FilterFn | null | undefined>(node: Node, skipOptions?: Options): TokenResult<Options> | null;
|
|
3136
|
+
/**
|
|
3137
|
+
* Get the first tokens of the given node.
|
|
3138
|
+
* @param node - The AST node.
|
|
3139
|
+
* @param countOptions? - Options object.
|
|
3140
|
+
* If is a number, equivalent to `{ count: n }`.
|
|
3141
|
+
* If is a function, equivalent to `{ filter: fn }`.
|
|
3142
|
+
* @returns Array of `Token`s, or array of `Token | Comment`s if `includeComments` is `true`.
|
|
3143
|
+
*/
|
|
3144
|
+
declare function getFirstTokens<Options extends CountOptions | number | FilterFn | null | undefined>(node: Node, countOptions?: Options): TokenResult<Options>[];
|
|
3145
|
+
/**
|
|
3146
|
+
* Get the last token of the given node.
|
|
3147
|
+
* @param node - The AST node.
|
|
3148
|
+
* @param skipOptions? - Options object.
|
|
3149
|
+
* If is a number, equivalent to `{ skip: n }`.
|
|
3150
|
+
* If is a function, equivalent to `{ filter: fn }`.
|
|
3151
|
+
* @returns `Token` (or `Token | Comment` if `includeComments` is `true`), or `null` if none found.
|
|
3152
|
+
*/
|
|
3153
|
+
declare function getLastToken<Options extends SkipOptions | number | FilterFn | null | undefined>(node: Node, skipOptions?: Options): TokenResult<Options> | null;
|
|
3154
|
+
/**
|
|
3155
|
+
* Get the last tokens of the given node.
|
|
3156
|
+
* @param node - The AST node.
|
|
3157
|
+
* @param countOptions? - Options object.
|
|
3158
|
+
* If is a number, equivalent to `{ count: n }`.
|
|
3159
|
+
* If is a function, equivalent to `{ filter: fn }`.
|
|
3160
|
+
* @returns Array of `Token`s, or array of `Token | Comment`s if `includeComments` is `true`.
|
|
3161
|
+
*/
|
|
3162
|
+
declare function getLastTokens<Options extends CountOptions | number | FilterFn | null | undefined>(node: Node, countOptions?: Options): TokenResult<Options>[];
|
|
3163
|
+
/**
|
|
3164
|
+
* Get the token that precedes a given node or token.
|
|
3165
|
+
* @param nodeOrToken - The AST node or token.
|
|
3166
|
+
* @param skipOptions? - Options object.
|
|
3167
|
+
* If is a number, equivalent to `{ skip: n }`.
|
|
3168
|
+
* If is a function, equivalent to `{ filter: fn }`.
|
|
3169
|
+
* @returns `Token` (or `Token | Comment` if `includeComments` is `true`), or `null` if none found.
|
|
3170
|
+
*/
|
|
3171
|
+
declare function getTokenBefore<Options extends SkipOptions | number | FilterFn | null | undefined>(nodeOrToken: NodeOrToken, skipOptions?: Options): TokenResult<Options> | null;
|
|
3172
|
+
/**
|
|
3173
|
+
* Get the token that precedes a given node or token.
|
|
3174
|
+
*
|
|
3175
|
+
* @deprecated Use `sourceCode.getTokenBefore` with `includeComments: true` instead.
|
|
3176
|
+
*
|
|
3177
|
+
* @param nodeOrToken The AST node or token.
|
|
3178
|
+
* @param skip - Number of tokens to skip.
|
|
3179
|
+
* @returns `TokenOrComment | null`.
|
|
3180
|
+
*/
|
|
3181
|
+
declare function getTokenOrCommentBefore(nodeOrToken: NodeOrToken, skip?: number): TokenOrComment | null;
|
|
3182
|
+
/**
|
|
3183
|
+
* Get the tokens that precede a given node or token.
|
|
3184
|
+
* @param nodeOrToken - The AST node or token.
|
|
3185
|
+
* @param countOptions? - Options object.
|
|
3186
|
+
* If is a number, equivalent to `{ count: n }`.
|
|
3187
|
+
* If is a function, equivalent to `{ filter: fn }`.
|
|
3188
|
+
* @returns Array of `Token`s, or array of `Token | Comment`s if `includeComments` is `true`.
|
|
3189
|
+
*/
|
|
3190
|
+
declare function getTokensBefore<Options extends CountOptions | number | FilterFn | null | undefined>(nodeOrToken: NodeOrToken, countOptions?: Options): TokenResult<Options>[];
|
|
3191
|
+
/**
|
|
3192
|
+
* Get the token that follows a given node or token.
|
|
3193
|
+
* @param nodeOrToken - The AST node or token.
|
|
3194
|
+
* @param skipOptions? - Options object.
|
|
3195
|
+
* If is a number, equivalent to `{ skip: n }`.
|
|
3196
|
+
* If is a function, equivalent to `{ filter: fn }`.
|
|
3197
|
+
* @returns `Token` (or `Token | Comment` if `includeComments` is `true`), or `null` if none found.
|
|
3198
|
+
*/
|
|
3199
|
+
declare function getTokenAfter<Options extends SkipOptions | number | FilterFn | null | undefined>(nodeOrToken: NodeOrToken, skipOptions?: Options): TokenResult<Options> | null;
|
|
3200
|
+
/**
|
|
3201
|
+
* Get the token that follows a given node or token.
|
|
3202
|
+
*
|
|
3203
|
+
* @deprecated Use `sourceCode.getTokenAfter` with `includeComments: true` instead.
|
|
3204
|
+
*
|
|
3205
|
+
* @param nodeOrToken The AST node or token.
|
|
3206
|
+
* @param skip - Number of tokens to skip.
|
|
3207
|
+
* @returns `TokenOrComment | null`.
|
|
3208
|
+
*/
|
|
3209
|
+
declare function getTokenOrCommentAfter(nodeOrToken: NodeOrToken, skip?: number): TokenOrComment | null;
|
|
3210
|
+
/**
|
|
3211
|
+
* Get the tokens that follow a given node or token.
|
|
3212
|
+
* @param nodeOrToken - The AST node or token.
|
|
3213
|
+
* @param countOptions? - Options object.
|
|
3214
|
+
* If is a number, equivalent to `{ count: n }`.
|
|
3215
|
+
* If is a function, equivalent to `{ filter: fn }`.
|
|
3216
|
+
* @returns Array of `Token`s, or array of `Token | Comment`s if `includeComments` is `true`.
|
|
3217
|
+
*/
|
|
3218
|
+
declare function getTokensAfter<Options extends CountOptions | number | FilterFn | null | undefined>(nodeOrToken: NodeOrToken, countOptions?: Options): TokenResult<Options>[];
|
|
3219
|
+
/**
|
|
3220
|
+
* Get all of the tokens between two non-overlapping nodes.
|
|
3221
|
+
* @param left - Node or token before the desired token range.
|
|
3222
|
+
* @param right - Node or token after the desired token range.
|
|
3223
|
+
* @param countOptions? - Options object. If is a function, equivalent to `{ filter: fn }`.
|
|
3224
|
+
* @returns Array of `Token`s, or array of `Token | Comment`s if `includeComments` is `true`.
|
|
3225
|
+
*/
|
|
3226
|
+
/**
|
|
3227
|
+
* Get all of the tokens between two non-overlapping nodes.
|
|
3228
|
+
* @param left - Node or token before the desired token range.
|
|
3229
|
+
* @param right - Node or token after the desired token range.
|
|
3230
|
+
* @param padding - Number of extra tokens on either side of center.
|
|
3231
|
+
* @returns Array of `Token`s, or array of `Token | Comment`s if `includeComments` is `true`.
|
|
3232
|
+
*/
|
|
3233
|
+
declare function getTokensBetween<Options extends CountOptions | number | FilterFn | null | undefined>(left: NodeOrToken, right: NodeOrToken, countOptions?: Options): TokenResult<Options>[];
|
|
3234
|
+
/**
|
|
3235
|
+
* Get the first token between two non-overlapping nodes.
|
|
3236
|
+
* @param left - Node or token before the desired token range.
|
|
3237
|
+
* @param right - Node or token after the desired token range.
|
|
3238
|
+
* @param skipOptions? - Options object.
|
|
3239
|
+
* If is a number, equivalent to `{ skip: n }`.
|
|
3240
|
+
* If is a function, equivalent to `{ filter: fn }`.
|
|
3241
|
+
* @returns `Token` (or `Token | Comment` if `includeComments` is `true`), or `null` if none found.
|
|
3242
|
+
*/
|
|
3243
|
+
declare function getFirstTokenBetween<Options extends SkipOptions | number | FilterFn | null | undefined>(left: NodeOrToken, right: NodeOrToken, skipOptions?: Options): TokenResult<Options> | null;
|
|
3244
|
+
/**
|
|
3245
|
+
* Get the first tokens between two non-overlapping nodes.
|
|
3246
|
+
* @param left - Node or token before the desired token range.
|
|
3247
|
+
* @param right - Node or token after the desired token range.
|
|
3248
|
+
* @param countOptions? - Options object.
|
|
3249
|
+
* If is a number, equivalent to `{ count: n }`.
|
|
3250
|
+
* If is a function, equivalent to `{ filter: fn }`.
|
|
3251
|
+
* @returns Array of `Token`s, or array of `Token | Comment`s if `includeComments` is `true`.
|
|
3252
|
+
*/
|
|
3253
|
+
declare function getFirstTokensBetween<Options extends CountOptions | number | FilterFn | null | undefined>(left: NodeOrToken, right: NodeOrToken, countOptions?: Options): TokenResult<Options>[];
|
|
3254
|
+
/**
|
|
3255
|
+
* Get the last token between two non-overlapping nodes.
|
|
3256
|
+
* @param left - Node or token before the desired token range.
|
|
3257
|
+
* @param right - Node or token after the desired token range.
|
|
3258
|
+
* @param skipOptions? - Options object.
|
|
3259
|
+
* If is a number, equivalent to `{ skip: n }`.
|
|
3260
|
+
* If is a function, equivalent to `{ filter: fn }`.
|
|
3261
|
+
* @returns `Token` (or `Token | Comment` if `includeComments` is `true`), or `null` if none found.
|
|
3262
|
+
*/
|
|
3263
|
+
declare function getLastTokenBetween<Options extends SkipOptions | number | FilterFn | null | undefined>(left: NodeOrToken, right: NodeOrToken, skipOptions?: Options): TokenResult<Options> | null;
|
|
3264
|
+
/**
|
|
3265
|
+
* Get the last tokens between two non-overlapping nodes.
|
|
3266
|
+
* @param left - Node or token before the desired token range.
|
|
3267
|
+
* @param right - Node or token after the desired token range.
|
|
3268
|
+
* @param countOptions? - Options object.
|
|
3269
|
+
* If is a number, equivalent to `{ count: n }`.
|
|
3270
|
+
* If is a function, equivalent to `{ filter: fn }`.
|
|
3271
|
+
* @returns Array of `Token`s, or array of `Token | Comment`s if `includeComments` is `true`.
|
|
3272
|
+
*/
|
|
3273
|
+
declare function getLastTokensBetween<Options extends CountOptions | number | FilterFn | null | undefined>(left: NodeOrToken, right: NodeOrToken, countOptions?: Options): TokenResult<Options>[];
|
|
3274
|
+
/**
|
|
3275
|
+
* Get the token starting at the specified index.
|
|
3276
|
+
* @param index - Index of the start of the token's range.
|
|
3277
|
+
* @param rangeOptions - Options object.
|
|
3278
|
+
* @returns `Token` (or `Token | Comment` if `includeComments` is `true`), or `null` if none found.
|
|
3279
|
+
*/
|
|
3280
|
+
declare function getTokenByRangeStart<Options extends RangeOptions | null | undefined>(index: number, rangeOptions?: Options): TokenResult<Options> | null;
|
|
3281
|
+
/**
|
|
3282
|
+
* Determine if two nodes or tokens have at least one whitespace character between them.
|
|
3283
|
+
* Order does not matter.
|
|
3284
|
+
*
|
|
3285
|
+
* Returns `false` if the given nodes or tokens overlap.
|
|
3286
|
+
*
|
|
3287
|
+
* Checks for whitespace *between tokens*, not including whitespace *inside tokens*.
|
|
3288
|
+
* e.g. Returns `false` for `isSpaceBetween(x, y)` in `x+" "+y`.
|
|
3289
|
+
*
|
|
3290
|
+
* @param first - The first node or token to check between.
|
|
3291
|
+
* @param second - The second node or token to check between.
|
|
3292
|
+
* @returns `true` if there is a whitespace character between
|
|
3293
|
+
* any of the tokens found between the two given nodes or tokens.
|
|
3294
|
+
*/
|
|
3295
|
+
declare function isSpaceBetween(first: NodeOrToken, second: NodeOrToken): boolean;
|
|
3296
|
+
/**
|
|
3297
|
+
* Determine if two nodes or tokens have at least one whitespace character between them.
|
|
3298
|
+
* Order does not matter.
|
|
3299
|
+
*
|
|
3300
|
+
* Returns `false` if the given nodes or tokens overlap.
|
|
3301
|
+
*
|
|
3302
|
+
* Checks for whitespace *between tokens*, not including whitespace *inside tokens*.
|
|
3303
|
+
* e.g. Returns `false` for `isSpaceBetween(x, y)` in `x+" "+y`.
|
|
3304
|
+
*
|
|
3305
|
+
* Unlike `SourceCode#isSpaceBetween`, this function does return `true` if there is a `JSText` token between the two
|
|
3306
|
+
* input tokens, and it contains whitespace.
|
|
3307
|
+
* e.g. Returns `true` for `isSpaceBetweenTokens(x, slash)` in `<X>a b</X>`.
|
|
3308
|
+
*
|
|
3309
|
+
* @deprecated Use `sourceCode.isSpaceBetween` instead.
|
|
3310
|
+
*
|
|
3311
|
+
* @param first - The first node or token to check between.
|
|
3312
|
+
* @param second - The second node or token to check between.
|
|
3313
|
+
* @returns `true` if there is a whitespace character between
|
|
3314
|
+
* any of the tokens found between the two given nodes or tokens.
|
|
3315
|
+
*/
|
|
3316
|
+
declare function isSpaceBetweenTokens(first: NodeOrToken, second: NodeOrToken): boolean;
|
|
3317
|
+
//#endregion
|
|
3318
|
+
//#region src-js/plugins/source_code.d.ts
|
|
3319
|
+
declare const SOURCE_CODE: Readonly<{
|
|
3320
|
+
/**
|
|
3321
|
+
* Source text.
|
|
3322
|
+
*/
|
|
3323
|
+
readonly text: string;
|
|
3324
|
+
/**
|
|
3325
|
+
* `true` if file has Unicode BOM.
|
|
3326
|
+
*/
|
|
3327
|
+
readonly hasBOM: boolean;
|
|
3328
|
+
/**
|
|
3329
|
+
* AST of the file.
|
|
3330
|
+
*/
|
|
3331
|
+
readonly ast: Program;
|
|
3332
|
+
/**
|
|
3333
|
+
* `true` if the AST is in ESTree format.
|
|
3334
|
+
*/
|
|
3335
|
+
isESTree: true;
|
|
3336
|
+
/**
|
|
3337
|
+
* `ScopeManager` for the file.
|
|
3338
|
+
*/
|
|
3339
|
+
readonly scopeManager: ScopeManager;
|
|
3340
|
+
/**
|
|
3341
|
+
* Visitor keys to traverse this AST.
|
|
3342
|
+
*/
|
|
3343
|
+
readonly visitorKeys: Readonly<Record<string, readonly string[]>>;
|
|
3344
|
+
/**
|
|
3345
|
+
* Parser services for the file.
|
|
3346
|
+
*
|
|
3347
|
+
* Oxlint does not offer any parser services.
|
|
3348
|
+
*/
|
|
3349
|
+
parserServices: Readonly<Record<string, unknown>>;
|
|
3350
|
+
/**
|
|
3351
|
+
* Source text as array of lines, split according to specification's definition of line breaks.
|
|
3352
|
+
*/
|
|
3353
|
+
readonly lines: string[];
|
|
3354
|
+
/**
|
|
3355
|
+
* Character offset of the first character of each line in source text,
|
|
3356
|
+
* split according to specification's definition of line breaks.
|
|
3357
|
+
*/
|
|
3358
|
+
readonly lineStartIndices: number[];
|
|
3359
|
+
/**
|
|
3360
|
+
* Array of all tokens and comments in the file, in source order.
|
|
3361
|
+
*/
|
|
3362
|
+
readonly tokensAndComments: (TokenType | Comment)[];
|
|
3363
|
+
/**
|
|
3364
|
+
* Get the source code for the given node.
|
|
3365
|
+
* @param node? - The AST node to get the text for.
|
|
3366
|
+
* @param beforeCount? - The number of characters before the node to retrieve.
|
|
3367
|
+
* @param afterCount? - The number of characters after the node to retrieve.
|
|
3368
|
+
* @returns Source text representing the AST node.
|
|
3369
|
+
*/
|
|
3370
|
+
getText(node?: Ranged | null, beforeCount?: number | null, afterCount?: number | null): string;
|
|
3371
|
+
/**
|
|
3372
|
+
* Get all the ancestors of a given node.
|
|
3373
|
+
* @param node - AST node
|
|
3374
|
+
* @returns All the ancestor nodes in the AST, not including the provided node,
|
|
3375
|
+
* starting from the root node at index 0 and going inwards to the parent node.
|
|
3376
|
+
*/
|
|
3377
|
+
getAncestors(node: Node): Node[];
|
|
3378
|
+
/**
|
|
3379
|
+
* Get source text as array of lines, split according to specification's definition of line breaks.
|
|
3380
|
+
*/
|
|
3381
|
+
getLines(): string[];
|
|
3382
|
+
getRange: typeof getRange;
|
|
3383
|
+
getLoc: typeof getLoc;
|
|
3384
|
+
getNodeByRangeIndex: typeof getNodeByRangeIndex;
|
|
3385
|
+
getLocFromIndex: typeof getLineColumnFromOffset;
|
|
3386
|
+
getIndexFromLoc: typeof getOffsetFromLineColumn;
|
|
3387
|
+
getAllComments: typeof getAllComments;
|
|
3388
|
+
getCommentsBefore: typeof getCommentsBefore;
|
|
3389
|
+
getCommentsAfter: typeof getCommentsAfter;
|
|
3390
|
+
getCommentsInside: typeof getCommentsInside;
|
|
3391
|
+
commentsExistBetween: typeof commentsExistBetween;
|
|
3392
|
+
getJSDocComment: typeof getJSDocComment;
|
|
3393
|
+
isGlobalReference: typeof isGlobalReference;
|
|
3394
|
+
getDeclaredVariables: typeof getDeclaredVariables;
|
|
3395
|
+
getScope: typeof getScope;
|
|
3396
|
+
markVariableAsUsed: typeof markVariableAsUsed;
|
|
3397
|
+
getTokens: typeof getTokens;
|
|
3398
|
+
getFirstToken: typeof getFirstToken;
|
|
3399
|
+
getFirstTokens: typeof getFirstTokens;
|
|
3400
|
+
getLastToken: typeof getLastToken;
|
|
3401
|
+
getLastTokens: typeof getLastTokens;
|
|
3402
|
+
getTokenBefore: typeof getTokenBefore;
|
|
3403
|
+
getTokenOrCommentBefore: typeof getTokenOrCommentBefore;
|
|
3404
|
+
getTokensBefore: typeof getTokensBefore;
|
|
3405
|
+
getTokenAfter: typeof getTokenAfter;
|
|
3406
|
+
getTokenOrCommentAfter: typeof getTokenOrCommentAfter;
|
|
3407
|
+
getTokensAfter: typeof getTokensAfter;
|
|
3408
|
+
getTokensBetween: typeof getTokensBetween;
|
|
3409
|
+
getFirstTokenBetween: typeof getFirstTokenBetween;
|
|
3410
|
+
getFirstTokensBetween: typeof getFirstTokensBetween;
|
|
3411
|
+
getLastTokenBetween: typeof getLastTokenBetween;
|
|
3412
|
+
getLastTokensBetween: typeof getLastTokensBetween;
|
|
3413
|
+
getTokenByRangeStart: typeof getTokenByRangeStart;
|
|
3414
|
+
isSpaceBetween: typeof isSpaceBetween;
|
|
3415
|
+
isSpaceBetweenTokens: typeof isSpaceBetweenTokens;
|
|
3416
|
+
}>;
|
|
3417
|
+
type SourceCode = typeof SOURCE_CODE;
|
|
3418
|
+
//#endregion
|
|
3419
|
+
//#region src-js/plugins/context.d.ts
|
|
3420
|
+
declare const LANGUAGE_OPTIONS: {
|
|
3421
|
+
/**
|
|
3422
|
+
* Source type of the file being linted.
|
|
3423
|
+
*/
|
|
3424
|
+
readonly sourceType: ModuleKind;
|
|
3425
|
+
/**
|
|
3426
|
+
* ECMAScript version of the file being linted.
|
|
3427
|
+
*/
|
|
3428
|
+
ecmaVersion: number;
|
|
3429
|
+
/**
|
|
3430
|
+
* Parser used to parse the file being linted.
|
|
3431
|
+
*/
|
|
3432
|
+
parser: Readonly<{
|
|
3433
|
+
/**
|
|
3434
|
+
* Parser name.
|
|
3435
|
+
*/
|
|
3436
|
+
name: "oxlint";
|
|
3437
|
+
/**
|
|
3438
|
+
* Parser version.
|
|
3439
|
+
*/
|
|
3440
|
+
version: string;
|
|
3441
|
+
/**
|
|
3442
|
+
* Parse code into an AST.
|
|
3443
|
+
* @param code - Code to parse
|
|
3444
|
+
* @param options? - Parser options
|
|
3445
|
+
* @returns AST
|
|
3446
|
+
*/
|
|
3447
|
+
parse(code: string, options?: Record<string, unknown>): Program;
|
|
3448
|
+
/**
|
|
3449
|
+
* Visitor keys for AST nodes.
|
|
3450
|
+
*/
|
|
3451
|
+
VisitorKeys: Readonly<{
|
|
3452
|
+
DebuggerStatement: readonly never[];
|
|
3453
|
+
EmptyStatement: readonly never[];
|
|
3454
|
+
Literal: readonly never[];
|
|
3455
|
+
PrivateIdentifier: readonly never[];
|
|
3456
|
+
Super: readonly never[];
|
|
3457
|
+
TemplateElement: readonly never[];
|
|
3458
|
+
ThisExpression: readonly never[];
|
|
3459
|
+
JSXClosingFragment: readonly never[];
|
|
3460
|
+
JSXEmptyExpression: readonly never[];
|
|
3461
|
+
JSXIdentifier: readonly never[];
|
|
3462
|
+
JSXOpeningFragment: readonly never[];
|
|
3463
|
+
JSXText: readonly never[];
|
|
3464
|
+
TSAnyKeyword: readonly never[];
|
|
3465
|
+
TSBigIntKeyword: readonly never[];
|
|
3466
|
+
TSBooleanKeyword: readonly never[];
|
|
3467
|
+
TSIntrinsicKeyword: readonly never[];
|
|
3468
|
+
TSJSDocUnknownType: readonly never[];
|
|
3469
|
+
TSNeverKeyword: readonly never[];
|
|
3470
|
+
TSNullKeyword: readonly never[];
|
|
3471
|
+
TSNumberKeyword: readonly never[];
|
|
3472
|
+
TSObjectKeyword: readonly never[];
|
|
3473
|
+
TSStringKeyword: readonly never[];
|
|
3474
|
+
TSSymbolKeyword: readonly never[];
|
|
3475
|
+
TSThisType: readonly never[];
|
|
3476
|
+
TSUndefinedKeyword: readonly never[];
|
|
3477
|
+
TSUnknownKeyword: readonly never[];
|
|
3478
|
+
TSVoidKeyword: readonly never[];
|
|
3479
|
+
AccessorProperty: readonly string[];
|
|
3480
|
+
ArrayExpression: readonly string[];
|
|
3481
|
+
ArrayPattern: readonly string[];
|
|
3482
|
+
ArrowFunctionExpression: readonly string[];
|
|
3483
|
+
AssignmentExpression: readonly string[];
|
|
3484
|
+
AssignmentPattern: readonly string[];
|
|
3485
|
+
AwaitExpression: readonly string[];
|
|
3486
|
+
BinaryExpression: readonly string[];
|
|
3487
|
+
BlockStatement: readonly string[];
|
|
3488
|
+
BreakStatement: readonly string[];
|
|
3489
|
+
CallExpression: readonly string[];
|
|
3490
|
+
CatchClause: readonly string[];
|
|
3491
|
+
ChainExpression: readonly string[];
|
|
3492
|
+
ClassBody: readonly string[];
|
|
3493
|
+
ClassDeclaration: readonly string[];
|
|
3494
|
+
ClassExpression: readonly string[];
|
|
3495
|
+
ConditionalExpression: readonly string[];
|
|
3496
|
+
ContinueStatement: readonly string[];
|
|
3497
|
+
Decorator: readonly string[];
|
|
3498
|
+
DoWhileStatement: readonly string[];
|
|
3499
|
+
ExportAllDeclaration: readonly string[];
|
|
3500
|
+
ExportDefaultDeclaration: readonly string[];
|
|
3501
|
+
ExportNamedDeclaration: readonly string[];
|
|
3502
|
+
ExportSpecifier: readonly string[];
|
|
3503
|
+
ExpressionStatement: readonly string[];
|
|
3504
|
+
ForInStatement: readonly string[];
|
|
3505
|
+
ForOfStatement: readonly string[];
|
|
3506
|
+
ForStatement: readonly string[];
|
|
3507
|
+
FunctionDeclaration: readonly string[];
|
|
3508
|
+
FunctionExpression: readonly string[];
|
|
3509
|
+
Identifier: readonly string[];
|
|
3510
|
+
IfStatement: readonly string[];
|
|
3511
|
+
ImportAttribute: readonly string[];
|
|
3512
|
+
ImportDeclaration: readonly string[];
|
|
3513
|
+
ImportDefaultSpecifier: readonly string[];
|
|
3514
|
+
ImportExpression: readonly string[];
|
|
3515
|
+
ImportNamespaceSpecifier: readonly string[];
|
|
3516
|
+
ImportSpecifier: readonly string[];
|
|
3517
|
+
LabeledStatement: readonly string[];
|
|
3518
|
+
LogicalExpression: readonly string[];
|
|
3519
|
+
MemberExpression: readonly string[];
|
|
3520
|
+
MetaProperty: readonly string[];
|
|
3521
|
+
MethodDefinition: readonly string[];
|
|
3522
|
+
NewExpression: readonly string[];
|
|
3523
|
+
ObjectExpression: readonly string[];
|
|
3524
|
+
ObjectPattern: readonly string[];
|
|
3525
|
+
ParenthesizedExpression: readonly string[];
|
|
3526
|
+
Program: readonly string[];
|
|
3527
|
+
Property: readonly string[];
|
|
3528
|
+
PropertyDefinition: readonly string[];
|
|
3529
|
+
RestElement: readonly string[];
|
|
3530
|
+
ReturnStatement: readonly string[];
|
|
3531
|
+
SequenceExpression: readonly string[];
|
|
3532
|
+
SpreadElement: readonly string[];
|
|
3533
|
+
StaticBlock: readonly string[];
|
|
3534
|
+
SwitchCase: readonly string[];
|
|
3535
|
+
SwitchStatement: readonly string[];
|
|
3536
|
+
TaggedTemplateExpression: readonly string[];
|
|
3537
|
+
TemplateLiteral: readonly string[];
|
|
3538
|
+
ThrowStatement: readonly string[];
|
|
3539
|
+
TryStatement: readonly string[];
|
|
3540
|
+
UnaryExpression: readonly string[];
|
|
3541
|
+
UpdateExpression: readonly string[];
|
|
3542
|
+
V8IntrinsicExpression: readonly string[];
|
|
3543
|
+
VariableDeclaration: readonly string[];
|
|
3544
|
+
VariableDeclarator: readonly string[];
|
|
3545
|
+
WhileStatement: readonly string[];
|
|
3546
|
+
WithStatement: readonly string[];
|
|
3547
|
+
YieldExpression: readonly string[];
|
|
3548
|
+
JSXAttribute: readonly string[];
|
|
3549
|
+
JSXClosingElement: readonly string[];
|
|
3550
|
+
JSXElement: readonly string[];
|
|
3551
|
+
JSXExpressionContainer: readonly string[];
|
|
3552
|
+
JSXFragment: readonly string[];
|
|
3553
|
+
JSXMemberExpression: readonly string[];
|
|
3554
|
+
JSXNamespacedName: readonly string[];
|
|
3555
|
+
JSXOpeningElement: readonly string[];
|
|
3556
|
+
JSXSpreadAttribute: readonly string[];
|
|
3557
|
+
JSXSpreadChild: readonly string[];
|
|
3558
|
+
TSAbstractAccessorProperty: readonly string[];
|
|
3559
|
+
TSAbstractMethodDefinition: readonly string[];
|
|
3560
|
+
TSAbstractPropertyDefinition: readonly string[];
|
|
3561
|
+
TSArrayType: readonly string[];
|
|
3562
|
+
TSAsExpression: readonly string[];
|
|
3563
|
+
TSCallSignatureDeclaration: readonly string[];
|
|
3564
|
+
TSClassImplements: readonly string[];
|
|
3565
|
+
TSConditionalType: readonly string[];
|
|
3566
|
+
TSConstructSignatureDeclaration: readonly string[];
|
|
3567
|
+
TSConstructorType: readonly string[];
|
|
3568
|
+
TSDeclareFunction: readonly string[];
|
|
3569
|
+
TSEmptyBodyFunctionExpression: readonly string[];
|
|
3570
|
+
TSEnumBody: readonly string[];
|
|
3571
|
+
TSEnumDeclaration: readonly string[];
|
|
3572
|
+
TSEnumMember: readonly string[];
|
|
3573
|
+
TSExportAssignment: readonly string[];
|
|
3574
|
+
TSExternalModuleReference: readonly string[];
|
|
3575
|
+
TSFunctionType: readonly string[];
|
|
3576
|
+
TSImportEqualsDeclaration: readonly string[];
|
|
3577
|
+
TSImportType: readonly string[];
|
|
3578
|
+
TSIndexSignature: readonly string[];
|
|
3579
|
+
TSIndexedAccessType: readonly string[];
|
|
3580
|
+
TSInferType: readonly string[];
|
|
3581
|
+
TSInstantiationExpression: readonly string[];
|
|
3582
|
+
TSInterfaceBody: readonly string[];
|
|
3583
|
+
TSInterfaceDeclaration: readonly string[];
|
|
3584
|
+
TSInterfaceHeritage: readonly string[];
|
|
3585
|
+
TSIntersectionType: readonly string[];
|
|
3586
|
+
TSJSDocNonNullableType: readonly string[];
|
|
3587
|
+
TSJSDocNullableType: readonly string[];
|
|
3588
|
+
TSLiteralType: readonly string[];
|
|
3589
|
+
TSMappedType: readonly string[];
|
|
3590
|
+
TSMethodSignature: readonly string[];
|
|
3591
|
+
TSModuleBlock: readonly string[];
|
|
3592
|
+
TSModuleDeclaration: readonly string[];
|
|
3593
|
+
TSNamedTupleMember: readonly string[];
|
|
3594
|
+
TSNamespaceExportDeclaration: readonly string[];
|
|
3595
|
+
TSNonNullExpression: readonly string[];
|
|
3596
|
+
TSOptionalType: readonly string[];
|
|
3597
|
+
TSParameterProperty: readonly string[];
|
|
3598
|
+
TSParenthesizedType: readonly string[];
|
|
3599
|
+
TSPropertySignature: readonly string[];
|
|
3600
|
+
TSQualifiedName: readonly string[];
|
|
3601
|
+
TSRestType: readonly string[];
|
|
3602
|
+
TSSatisfiesExpression: readonly string[];
|
|
3603
|
+
TSTemplateLiteralType: readonly string[];
|
|
3604
|
+
TSTupleType: readonly string[];
|
|
3605
|
+
TSTypeAliasDeclaration: readonly string[];
|
|
3606
|
+
TSTypeAnnotation: readonly string[];
|
|
3607
|
+
TSTypeAssertion: readonly string[];
|
|
3608
|
+
TSTypeLiteral: readonly string[];
|
|
3609
|
+
TSTypeOperator: readonly string[];
|
|
3610
|
+
TSTypeParameter: readonly string[];
|
|
3611
|
+
TSTypeParameterDeclaration: readonly string[];
|
|
3612
|
+
TSTypeParameterInstantiation: readonly string[];
|
|
3613
|
+
TSTypePredicate: readonly string[];
|
|
3614
|
+
TSTypeQuery: readonly string[];
|
|
3615
|
+
TSTypeReference: readonly string[];
|
|
3616
|
+
TSUnionType: readonly string[];
|
|
3617
|
+
}>;
|
|
3618
|
+
/**
|
|
3619
|
+
* Ast node types.
|
|
3620
|
+
*/
|
|
3621
|
+
readonly Syntax: Readonly<Record<string, string>>;
|
|
3622
|
+
/**
|
|
3623
|
+
* Latest ECMAScript version supported by parser.
|
|
3624
|
+
*/
|
|
3625
|
+
latestEcmaVersion: 17;
|
|
3626
|
+
/**
|
|
3627
|
+
* ECMAScript versions supported by parser.
|
|
3628
|
+
*/
|
|
3629
|
+
supportedEcmaVersions: readonly number[];
|
|
3630
|
+
}>;
|
|
3631
|
+
/**
|
|
3632
|
+
* Parser options used to parse the file being linted.
|
|
3633
|
+
*/
|
|
3634
|
+
parserOptions: Readonly<{
|
|
3635
|
+
/**
|
|
3636
|
+
* Source type of the file being linted.
|
|
3637
|
+
*/
|
|
3638
|
+
readonly sourceType: ModuleKind;
|
|
3639
|
+
/**
|
|
3640
|
+
* ECMA features.
|
|
3641
|
+
*/
|
|
3642
|
+
ecmaFeatures: Readonly<{
|
|
3643
|
+
/**
|
|
3644
|
+
* `true` if file was parsed as JSX.
|
|
3645
|
+
*/
|
|
3646
|
+
readonly jsx: boolean;
|
|
3647
|
+
/**
|
|
3648
|
+
* `true` if file was parsed with top-level `return` statements allowed.
|
|
3649
|
+
*/
|
|
3650
|
+
readonly globalReturn: boolean;
|
|
3651
|
+
/**
|
|
3652
|
+
* `true` if file was parsed as strict mode code.
|
|
3653
|
+
*/
|
|
3654
|
+
readonly impliedStrict: boolean;
|
|
3655
|
+
}>;
|
|
3656
|
+
}>;
|
|
3657
|
+
/**
|
|
3658
|
+
* Globals defined for the file being linted.
|
|
3659
|
+
*/
|
|
3660
|
+
readonly globals: Readonly<Globals$1>;
|
|
3661
|
+
/**
|
|
3662
|
+
* Environments defined for the file being linted.
|
|
3663
|
+
*/
|
|
3664
|
+
readonly env: Readonly<Envs$1>;
|
|
3665
|
+
};
|
|
3666
|
+
/**
|
|
3667
|
+
* Language options used when parsing a file.
|
|
3668
|
+
*/
|
|
3669
|
+
type LanguageOptions$1 = Readonly<typeof LANGUAGE_OPTIONS>;
|
|
3670
|
+
declare const FILE_CONTEXT: Readonly<{
|
|
3671
|
+
/**
|
|
3672
|
+
* Absolute path of the file being linted.
|
|
3673
|
+
*/
|
|
3674
|
+
readonly filename: string;
|
|
3675
|
+
/**
|
|
3676
|
+
* Get absolute path of the file being linted.
|
|
3677
|
+
* @returns Absolute path of the file being linted.
|
|
3678
|
+
* @deprecated Use `context.filename` property instead.
|
|
3679
|
+
*/
|
|
3680
|
+
getFilename(): string;
|
|
3681
|
+
/**
|
|
3682
|
+
* Physical absolute path of the file being linted.
|
|
3683
|
+
*/
|
|
3684
|
+
readonly physicalFilename: string;
|
|
3685
|
+
/**
|
|
3686
|
+
* Get physical absolute path of the file being linted.
|
|
3687
|
+
* @returns Physical absolute path of the file being linted.
|
|
3688
|
+
* @deprecated Use `context.physicalFilename` property instead.
|
|
3689
|
+
*/
|
|
3690
|
+
getPhysicalFilename(): string;
|
|
3691
|
+
/**
|
|
3692
|
+
* Current working directory.
|
|
3693
|
+
*/
|
|
3694
|
+
readonly cwd: string;
|
|
3695
|
+
/**
|
|
3696
|
+
* Get current working directory.
|
|
3697
|
+
* @returns The current working directory.
|
|
3698
|
+
* @deprecated Use `context.cwd` property instead.
|
|
3699
|
+
*/
|
|
3700
|
+
getCwd(): string;
|
|
3701
|
+
/**
|
|
3702
|
+
* Source code of the file being linted.
|
|
3703
|
+
*/
|
|
3704
|
+
readonly sourceCode: SourceCode;
|
|
3705
|
+
/**
|
|
3706
|
+
* Get source code of the file being linted.
|
|
3707
|
+
* @returns Source code of the file being linted.
|
|
3708
|
+
* @deprecated Use `context.sourceCode` property instead.
|
|
3709
|
+
*/
|
|
3710
|
+
getSourceCode(): SourceCode;
|
|
3711
|
+
/**
|
|
3712
|
+
* Language options used when parsing this file.
|
|
3713
|
+
*/
|
|
3714
|
+
readonly languageOptions: LanguageOptions$1;
|
|
3715
|
+
/**
|
|
3716
|
+
* Settings for the file being linted.
|
|
3717
|
+
*/
|
|
3718
|
+
readonly settings: Readonly<Settings>;
|
|
3719
|
+
/**
|
|
3720
|
+
* Create a new object with the current object as the prototype and
|
|
3721
|
+
* the specified properties as its own properties.
|
|
3722
|
+
* @param extension - The properties to add to the new object.
|
|
3723
|
+
* @returns A new object with the current object as the prototype
|
|
3724
|
+
* and the specified properties as its own properties.
|
|
3725
|
+
*/
|
|
3726
|
+
extend(this: FileContext, extension: Record<string | number | symbol, unknown>): FileContext;
|
|
3727
|
+
/**
|
|
3728
|
+
* Parser options used to parse the file being linted.
|
|
3729
|
+
* @deprecated Use `languageOptions.parserOptions` instead.
|
|
3730
|
+
*/
|
|
3731
|
+
readonly parserOptions: Record<string, unknown>;
|
|
3732
|
+
/**
|
|
3733
|
+
* The path to the parser used to parse this file.
|
|
3734
|
+
* @deprecated No longer supported.
|
|
3735
|
+
*/
|
|
3736
|
+
readonly parserPath: string | undefined;
|
|
3737
|
+
}>;
|
|
3738
|
+
/**
|
|
3739
|
+
* Context object for a file.
|
|
3740
|
+
* Is the prototype for `Context` objects for each rule.
|
|
3741
|
+
*/
|
|
3742
|
+
type FileContext = typeof FILE_CONTEXT;
|
|
3743
|
+
/**
|
|
3744
|
+
* Context object for a rule.
|
|
3745
|
+
* Passed to `create` and `createOnce` functions.
|
|
3746
|
+
*/
|
|
3747
|
+
interface Context extends FileContext {
|
|
3748
|
+
/**
|
|
3749
|
+
* Rule ID, in form `<plugin>/<rule>`.
|
|
3750
|
+
*/
|
|
3751
|
+
id: string;
|
|
3752
|
+
/**
|
|
3753
|
+
* Rule options for this rule on this file.
|
|
3754
|
+
*/
|
|
3755
|
+
options: Readonly<Options>;
|
|
3756
|
+
/**
|
|
3757
|
+
* Report an error/warning.
|
|
3758
|
+
*/
|
|
3759
|
+
report(this: void, diagnostic: Diagnostic): void;
|
|
3760
|
+
}
|
|
3761
|
+
//#endregion
|
|
3762
|
+
//#region src-js/plugins/rule_meta.d.ts
|
|
3763
|
+
/**
|
|
3764
|
+
* Rule metadata.
|
|
3765
|
+
* `meta` property of `Rule`.
|
|
3766
|
+
*/
|
|
3767
|
+
interface RuleMeta {
|
|
3768
|
+
/**
|
|
3769
|
+
* Type of rule.
|
|
3770
|
+
*
|
|
3771
|
+
* - `problem`: The rule is identifying code that either will cause an error or may cause a confusing behavior.
|
|
3772
|
+
* Developers should consider this a high priority to resolve.
|
|
3773
|
+
* - `suggestion`: The rule is identifying something that could be done in a better way but no errors will occur
|
|
3774
|
+
* if the code isn’t changed.
|
|
3775
|
+
* - `layout`: The rule cares primarily about whitespace, semicolons, commas, and parentheses, all the parts
|
|
3776
|
+
* of the program that determine how the code looks rather than how it executes.
|
|
3777
|
+
* These rules work on parts of the code that aren’t specified in the AST.
|
|
3778
|
+
*/
|
|
3779
|
+
type?: "problem" | "suggestion" | "layout";
|
|
3780
|
+
/**
|
|
3781
|
+
* Rule documentation.
|
|
3782
|
+
*/
|
|
3783
|
+
docs?: RuleDocs;
|
|
3784
|
+
/**
|
|
3785
|
+
* Templates for error/warning messages.
|
|
3786
|
+
*/
|
|
3787
|
+
messages?: Record<string, string>;
|
|
3788
|
+
/**
|
|
3789
|
+
* Type of fixes that the rule provides.
|
|
3790
|
+
* Must be `'code'` or `'whitespace'` if the rule provides fixes.
|
|
3791
|
+
*/
|
|
3792
|
+
fixable?: "code" | "whitespace" | null | undefined;
|
|
3793
|
+
/**
|
|
3794
|
+
* Specifies whether rule can return suggestions.
|
|
3795
|
+
* Must be `true` if the rule provides suggestions.
|
|
3796
|
+
* @default false
|
|
3797
|
+
*/
|
|
3798
|
+
hasSuggestions?: boolean;
|
|
3799
|
+
/**
|
|
3800
|
+
* Shape of options for the rule.
|
|
3801
|
+
* Mandatory if the rule has options.
|
|
3802
|
+
*/
|
|
3803
|
+
schema?: RuleOptionsSchema;
|
|
3804
|
+
/**
|
|
3805
|
+
* Default options for the rule.
|
|
3806
|
+
* If present, any user-provided options in their config will be merged on top of them recursively.
|
|
3807
|
+
*/
|
|
3808
|
+
defaultOptions?: Options;
|
|
3809
|
+
/**
|
|
3810
|
+
* Indicates whether the rule has been deprecated, and info about the deprecation and possible replacements.
|
|
3811
|
+
*/
|
|
3812
|
+
deprecated?: boolean | RuleDeprecatedInfo;
|
|
3813
|
+
/**
|
|
3814
|
+
* Information about available replacements for the rule.
|
|
3815
|
+
* This may be an empty array to explicitly state there is no replacement.
|
|
3816
|
+
* @deprecated Use `deprecated.replacedBy` instead.
|
|
3817
|
+
*/
|
|
3818
|
+
replacedBy?: RuleReplacedByInfo[];
|
|
3819
|
+
}
|
|
3820
|
+
/**
|
|
3821
|
+
* Rule documentation.
|
|
3822
|
+
* `docs` property of `RuleMeta`.
|
|
3823
|
+
*
|
|
3824
|
+
* Often used for documentation generation and tooling.
|
|
3825
|
+
*/
|
|
3826
|
+
interface RuleDocs {
|
|
3827
|
+
/**
|
|
3828
|
+
* Short description of the rule.
|
|
3829
|
+
*/
|
|
3830
|
+
description?: string;
|
|
3831
|
+
/**
|
|
3832
|
+
* Typically a boolean, representing whether the rule is enabled by the recommended config.
|
|
3833
|
+
*/
|
|
3834
|
+
recommended?: unknown;
|
|
3835
|
+
/**
|
|
3836
|
+
* URL for rule documentation.
|
|
3837
|
+
*/
|
|
3838
|
+
url?: string;
|
|
3839
|
+
/**
|
|
3840
|
+
* Other arbitrary user-defined properties.
|
|
3841
|
+
*/
|
|
3842
|
+
[key: string]: unknown;
|
|
3843
|
+
}
|
|
3844
|
+
/**
|
|
3845
|
+
* Info about deprecation of a rule, and possible replacements.
|
|
3846
|
+
* `deprecated` property of `RuleMeta`.
|
|
3847
|
+
*/
|
|
3848
|
+
interface RuleDeprecatedInfo {
|
|
3849
|
+
/**
|
|
3850
|
+
* General message presentable to the user. May contain why this rule is deprecated or how to replace the rule.
|
|
3851
|
+
*/
|
|
3852
|
+
message?: string;
|
|
3853
|
+
/**
|
|
3854
|
+
* URL with more information about this rule deprecation.
|
|
3855
|
+
*/
|
|
3856
|
+
url?: string;
|
|
3857
|
+
/**
|
|
3858
|
+
* Information about available replacements for the rule.
|
|
3859
|
+
* This may be an empty array to explicitly state there is no replacement.
|
|
3860
|
+
*/
|
|
3861
|
+
replacedBy?: RuleReplacedByInfo[];
|
|
3862
|
+
/**
|
|
3863
|
+
* Version (as semver string) deprecating the rule.
|
|
3864
|
+
*/
|
|
3865
|
+
deprecatedSince?: string;
|
|
3866
|
+
/**
|
|
3867
|
+
* Version (as semver string) likely to remove the rule.
|
|
3868
|
+
* e.g. the next major version.
|
|
3869
|
+
*
|
|
3870
|
+
* The special value `null` means the rule will no longer be changed, but will be kept available indefinitely.
|
|
3871
|
+
*/
|
|
3872
|
+
availableUntil?: string | null;
|
|
3873
|
+
}
|
|
3874
|
+
/**
|
|
3875
|
+
* Info about a possible replacement for a rule.
|
|
3876
|
+
*/
|
|
3877
|
+
interface RuleReplacedByInfo {
|
|
3878
|
+
/**
|
|
3879
|
+
* A general message about this rule replacement.
|
|
3880
|
+
*/
|
|
3881
|
+
message?: string;
|
|
3882
|
+
/**
|
|
3883
|
+
* A URL with more information about this rule replacement.
|
|
3884
|
+
*/
|
|
3885
|
+
url?: string;
|
|
3886
|
+
/**
|
|
3887
|
+
* Which plugin has the replacement rule.
|
|
3888
|
+
*
|
|
3889
|
+
* The `name` property should be the package name, and should be:
|
|
3890
|
+
* - `"oxlint"` if the replacement is an Oxlint core rule.
|
|
3891
|
+
* - `"eslint"` if the replacement is an ESLint core rule.
|
|
3892
|
+
*
|
|
3893
|
+
* This property should be omitted if the replacement rule is in the same plugin.
|
|
3894
|
+
*/
|
|
3895
|
+
plugin?: RuleReplacedByExternalSpecifier;
|
|
3896
|
+
/**
|
|
3897
|
+
* Name of replacement rule.
|
|
3898
|
+
* May be omitted if the plugin only contains a single rule, or has the same name as the rule.
|
|
3899
|
+
*/
|
|
3900
|
+
rule?: RuleReplacedByExternalSpecifier;
|
|
3901
|
+
}
|
|
3902
|
+
/**
|
|
3903
|
+
* Details about a plugin or rule that replaces a deprecated rule.
|
|
3904
|
+
*/
|
|
3905
|
+
interface RuleReplacedByExternalSpecifier {
|
|
3906
|
+
/**
|
|
3907
|
+
* For a plugin, the package name.
|
|
3908
|
+
* For a rule, the rule name.
|
|
3909
|
+
*/
|
|
3910
|
+
name?: string;
|
|
3911
|
+
/**
|
|
3912
|
+
* URL pointing to documentation for the plugin / rule.
|
|
3913
|
+
*/
|
|
3914
|
+
url?: string;
|
|
3915
|
+
}
|
|
3916
|
+
//#endregion
|
|
3917
|
+
//#region src-js/plugins/load.d.ts
|
|
3918
|
+
/**
|
|
3919
|
+
* Linter rule.
|
|
3920
|
+
*
|
|
3921
|
+
* `Rule` can have either `create` method, or `createOnce` method.
|
|
3922
|
+
* If `createOnce` method is present, `create` is ignored.
|
|
3923
|
+
*
|
|
3924
|
+
* If defining the rule with `createOnce`, and you want the rule to work with ESLint too,
|
|
3925
|
+
* you need to wrap the plugin containing the rule with `eslintCompatPlugin`.
|
|
3926
|
+
*/
|
|
3927
|
+
type Rule = CreateRule | CreateOnceRule;
|
|
3928
|
+
interface CreateRule {
|
|
3929
|
+
meta?: RuleMeta;
|
|
3930
|
+
create: (context: Context) => VisitorObject;
|
|
3931
|
+
}
|
|
3932
|
+
interface CreateOnceRule {
|
|
3933
|
+
meta?: RuleMeta;
|
|
3934
|
+
create?: (context: Context) => VisitorObject;
|
|
3935
|
+
createOnce: (context: Context) => VisitorWithHooks;
|
|
3936
|
+
}
|
|
3937
|
+
//#endregion
|
|
3938
|
+
//#region src-js/package/rule_tester.d.ts
|
|
3939
|
+
type DescribeFn = (text: string, fn: () => void) => void;
|
|
3940
|
+
type ItFn = ((text: string, fn: () => void) => void) & {
|
|
3941
|
+
only?: ItFn;
|
|
3942
|
+
};
|
|
3943
|
+
/**
|
|
3944
|
+
* Configuration for `RuleTester`.
|
|
3945
|
+
*/
|
|
3946
|
+
interface Config {
|
|
3947
|
+
/**
|
|
3948
|
+
* ESLint compatibility mode.
|
|
3949
|
+
*
|
|
3950
|
+
* Useful if moving test cases over from ESLint's `RuleTester` to Oxlint's.
|
|
3951
|
+
* It is recommended to only use this option as a temporary measure and alter the test cases
|
|
3952
|
+
* so `eslintCompat` is no longer required.
|
|
3953
|
+
*
|
|
3954
|
+
* If `true`:
|
|
3955
|
+
* - Column offsets in diagnostics are incremented by 1.
|
|
3956
|
+
* - Fixes which are adjacent to each other are considered overlapping, and only the first fix is applied.
|
|
3957
|
+
* - Defaults `sourceType` to "module" if not provided (otherwise default is "unambiguous").
|
|
3958
|
+
* - Disallows `sourceType: "unambiguous"`.
|
|
3959
|
+
* - Allows `null` as property value for `globals`.
|
|
3960
|
+
* `globals: { foo: null }` is treated as equivalent to `globals: { foo: "readonly" }`.
|
|
3961
|
+
* ESLint accepts `null`, though this is undocumented. Oxlint does not accept `null`.
|
|
3962
|
+
* - Slightly different behavior when `report` is called with `loc` of form `{ line, column }`.
|
|
3963
|
+
*
|
|
3964
|
+
* All of these match ESLint `RuleTester`'s behavior.
|
|
3965
|
+
*/
|
|
3966
|
+
eslintCompat?: boolean;
|
|
3967
|
+
/**
|
|
3968
|
+
* Language options.
|
|
3969
|
+
*/
|
|
3970
|
+
languageOptions?: LanguageOptions;
|
|
3971
|
+
/**
|
|
3972
|
+
* Current working directory for the linter.
|
|
3973
|
+
* If not provided, defaults to the directory containing the test file.
|
|
3974
|
+
*/
|
|
3975
|
+
cwd?: string;
|
|
3976
|
+
/**
|
|
3977
|
+
* Maximum number of additional fix passes to apply.
|
|
3978
|
+
* After the first fix pass, re-lints the fixed code and applies fixes again,
|
|
3979
|
+
* repeating up to `recursive` additional times (or until no more fixes are produced).
|
|
3980
|
+
*
|
|
3981
|
+
* - `false` / `null` / `undefined`: no recursion (default)
|
|
3982
|
+
* - `true`: 10 extra passes
|
|
3983
|
+
* - `number`: N extra passes
|
|
3984
|
+
*/
|
|
3985
|
+
recursive?: boolean | number | null | undefined;
|
|
3986
|
+
}
|
|
3987
|
+
/**
|
|
3988
|
+
* Language options config.
|
|
3989
|
+
*/
|
|
3990
|
+
interface LanguageOptions {
|
|
3991
|
+
sourceType?: SourceType;
|
|
3992
|
+
globals?: Globals;
|
|
3993
|
+
env?: Envs;
|
|
3994
|
+
parserOptions?: ParserOptions;
|
|
3995
|
+
}
|
|
3996
|
+
/**
|
|
3997
|
+
* Language options config, with `parser` and `ecmaVersion` properties, and extended `parserOptions`.
|
|
3998
|
+
* These properties should not be present in `languageOptions` config,
|
|
3999
|
+
* but could be if test cases are ported from ESLint.
|
|
4000
|
+
* For internal use only.
|
|
4001
|
+
*/
|
|
4002
|
+
/**
|
|
4003
|
+
* Source type.
|
|
4004
|
+
*
|
|
4005
|
+
* `'unambiguous'` is not supported in ESLint compatibility mode.
|
|
4006
|
+
*/
|
|
4007
|
+
type SourceType = "script" | "module" | "commonjs" | "unambiguous";
|
|
4008
|
+
/**
|
|
4009
|
+
* Value of a property in `globals` object.
|
|
4010
|
+
*
|
|
4011
|
+
* Note: `null` only supported in ESLint compatibility mode.
|
|
4012
|
+
*/
|
|
4013
|
+
type GlobalValue = boolean | "true" | "writable" | "writeable" | "false" | "readonly" | "readable" | "off" | null;
|
|
4014
|
+
/**
|
|
4015
|
+
* Globals object.
|
|
4016
|
+
*/
|
|
4017
|
+
type Globals = Record<string, GlobalValue>;
|
|
4018
|
+
/**
|
|
4019
|
+
* Environments for the file being linted.
|
|
4020
|
+
*/
|
|
4021
|
+
type Envs = Record<string, boolean>;
|
|
4022
|
+
/**
|
|
4023
|
+
* Parser options config.
|
|
4024
|
+
*/
|
|
4025
|
+
interface ParserOptions {
|
|
4026
|
+
ecmaFeatures?: EcmaFeatures;
|
|
4027
|
+
/**
|
|
4028
|
+
* Language variant to parse file as.
|
|
4029
|
+
*
|
|
4030
|
+
* If test case provides a filename, that takes precedence over `lang` option.
|
|
4031
|
+
* Language will be inferred from file extension.
|
|
4032
|
+
*/
|
|
4033
|
+
lang?: Language;
|
|
4034
|
+
/**
|
|
4035
|
+
* `true` to ignore non-fatal parsing errors.
|
|
4036
|
+
*/
|
|
4037
|
+
ignoreNonFatalErrors?: boolean;
|
|
4038
|
+
}
|
|
4039
|
+
/**
|
|
4040
|
+
* Parser options config, with extended `ecmaFeatures`.
|
|
4041
|
+
* These properties should not be present in `languageOptions` config,
|
|
4042
|
+
* but could be if test cases are ported from ESLint.
|
|
4043
|
+
* For internal use only.
|
|
4044
|
+
*/
|
|
4045
|
+
/**
|
|
4046
|
+
* ECMA features config.
|
|
4047
|
+
*/
|
|
4048
|
+
interface EcmaFeatures {
|
|
4049
|
+
/**
|
|
4050
|
+
* `true` to enable JSX parsing.
|
|
4051
|
+
*
|
|
4052
|
+
* `parserOptions.lang` takes priority over this option, if `lang` is specified.
|
|
4053
|
+
*/
|
|
4054
|
+
jsx?: boolean;
|
|
4055
|
+
}
|
|
4056
|
+
/**
|
|
4057
|
+
* ECMA features config, with `globalReturn` and `impliedStrict` properties.
|
|
4058
|
+
* These properties should not be present in `ecmaFeatures` config,
|
|
4059
|
+
* but could be if test cases are ported from ESLint.
|
|
4060
|
+
* For internal use only.
|
|
4061
|
+
*/
|
|
4062
|
+
/**
|
|
4063
|
+
* Parser language.
|
|
4064
|
+
*/
|
|
4065
|
+
type Language = "js" | "jsx" | "ts" | "tsx" | "dts";
|
|
4066
|
+
/**
|
|
4067
|
+
* Test case.
|
|
4068
|
+
*/
|
|
4069
|
+
interface TestCase extends Config {
|
|
4070
|
+
code: string;
|
|
4071
|
+
name?: string;
|
|
4072
|
+
only?: boolean;
|
|
4073
|
+
filename?: string;
|
|
4074
|
+
options?: Options;
|
|
4075
|
+
settings?: Settings;
|
|
4076
|
+
before?(this: this): void;
|
|
4077
|
+
after?(this: this): void;
|
|
4078
|
+
}
|
|
4079
|
+
/**
|
|
4080
|
+
* Test case for valid code.
|
|
4081
|
+
*/
|
|
4082
|
+
interface ValidTestCase extends TestCase {}
|
|
4083
|
+
/**
|
|
4084
|
+
* Test case for invalid code.
|
|
4085
|
+
*/
|
|
4086
|
+
interface InvalidTestCase extends TestCase {
|
|
4087
|
+
output?: string | null;
|
|
4088
|
+
errors: number | ErrorEntry[];
|
|
4089
|
+
}
|
|
4090
|
+
type ErrorEntry = Error | string | RegExp;
|
|
4091
|
+
/**
|
|
4092
|
+
* Expected error.
|
|
4093
|
+
*/
|
|
4094
|
+
type Error = RequireAtLeastOne<ErrorBase, "message" | "messageId">;
|
|
4095
|
+
interface ErrorBase {
|
|
4096
|
+
message?: string | RegExp;
|
|
4097
|
+
messageId?: string;
|
|
4098
|
+
data?: DiagnosticData;
|
|
4099
|
+
line?: number;
|
|
4100
|
+
column?: number;
|
|
4101
|
+
endLine?: number | undefined;
|
|
4102
|
+
endColumn?: number | undefined;
|
|
4103
|
+
suggestions?: ErrorSuggestion[] | null;
|
|
4104
|
+
}
|
|
4105
|
+
/**
|
|
4106
|
+
* Expected suggestion in a test case error.
|
|
4107
|
+
*/
|
|
4108
|
+
interface ErrorSuggestion {
|
|
4109
|
+
desc?: string;
|
|
4110
|
+
messageId?: string;
|
|
4111
|
+
data?: DiagnosticData;
|
|
4112
|
+
output: string;
|
|
4113
|
+
}
|
|
4114
|
+
/**
|
|
4115
|
+
* Test cases for a rule.
|
|
4116
|
+
*/
|
|
4117
|
+
interface TestCases {
|
|
4118
|
+
valid: (ValidTestCase | string)[];
|
|
4119
|
+
invalid: InvalidTestCase[];
|
|
4120
|
+
}
|
|
4121
|
+
/**
|
|
4122
|
+
* Utility class for testing rules.
|
|
4123
|
+
*/
|
|
4124
|
+
declare class RuleTester {
|
|
4125
|
+
#private;
|
|
4126
|
+
/**
|
|
4127
|
+
* Creates a new instance of RuleTester.
|
|
4128
|
+
* @param config? - Extra configuration for the tester (optional)
|
|
4129
|
+
*/
|
|
4130
|
+
constructor(config?: Config | null);
|
|
4131
|
+
/**
|
|
4132
|
+
* Set the configuration to use for all future tests.
|
|
4133
|
+
* @param config - The configuration to use
|
|
4134
|
+
* @throws {TypeError} If `config` is not an object
|
|
4135
|
+
*/
|
|
4136
|
+
static setDefaultConfig(config: Config): void;
|
|
4137
|
+
/**
|
|
4138
|
+
* Get the current configuration used for all tests.
|
|
4139
|
+
* @returns The current configuration
|
|
4140
|
+
*/
|
|
4141
|
+
static getDefaultConfig(): Config;
|
|
4142
|
+
/**
|
|
4143
|
+
* Reset the configuration to the initial configuration of the tester removing
|
|
4144
|
+
* any changes made until now.
|
|
4145
|
+
* @returns {void}
|
|
4146
|
+
*/
|
|
4147
|
+
static resetDefaultConfig(): void;
|
|
4148
|
+
static get describe(): DescribeFn;
|
|
4149
|
+
static set describe(value: DescribeFn);
|
|
4150
|
+
static get it(): ItFn;
|
|
4151
|
+
static set it(value: ItFn);
|
|
4152
|
+
static get itOnly(): ItFn;
|
|
4153
|
+
static set itOnly(value: ItFn);
|
|
4154
|
+
/**
|
|
4155
|
+
* Add the `only` property to a test to run it in isolation.
|
|
4156
|
+
* @param item - A single test to run by itself
|
|
4157
|
+
* @returns The test with `only` set
|
|
4158
|
+
*/
|
|
4159
|
+
static only(item: string | TestCase): TestCase;
|
|
4160
|
+
/**
|
|
4161
|
+
* Adds a new rule test to execute.
|
|
4162
|
+
* @param ruleName - Name of the rule to run
|
|
4163
|
+
* @param rule - Rule to test
|
|
4164
|
+
* @param tests - Collection of tests to run
|
|
4165
|
+
* @throws {TypeError|Error} If `rule` is not an object with a `create` method,
|
|
4166
|
+
* or if non-object `test`, or if a required scenario of the given type is missing
|
|
4167
|
+
*/
|
|
4168
|
+
run(ruleName: string, rule: Rule, tests: TestCases): void;
|
|
4169
|
+
}
|
|
4170
|
+
type _Config = Config;
|
|
4171
|
+
type _LanguageOptions = LanguageOptions;
|
|
4172
|
+
type _Globals = Globals;
|
|
4173
|
+
type _Envs = Envs;
|
|
4174
|
+
type _ParserOptions = ParserOptions;
|
|
4175
|
+
type _SourceType = SourceType;
|
|
4176
|
+
type _Language = Language;
|
|
4177
|
+
type _EcmaFeatures = EcmaFeatures;
|
|
4178
|
+
type _DescribeFn = DescribeFn;
|
|
4179
|
+
type _ItFn = ItFn;
|
|
4180
|
+
type _ValidTestCase = ValidTestCase;
|
|
4181
|
+
type _InvalidTestCase = InvalidTestCase;
|
|
4182
|
+
type _TestCases = TestCases;
|
|
4183
|
+
type _Error = Error;
|
|
4184
|
+
type _ErrorSuggestion = ErrorSuggestion;
|
|
4185
|
+
declare namespace RuleTester {
|
|
4186
|
+
type Config = _Config;
|
|
4187
|
+
type LanguageOptions = _LanguageOptions;
|
|
4188
|
+
type Globals = _Globals;
|
|
4189
|
+
type Envs = _Envs;
|
|
4190
|
+
type ParserOptions = _ParserOptions;
|
|
4191
|
+
type SourceType = _SourceType;
|
|
4192
|
+
type Language = _Language;
|
|
4193
|
+
type EcmaFeatures = _EcmaFeatures;
|
|
4194
|
+
type DescribeFn = _DescribeFn;
|
|
4195
|
+
type ItFn = _ItFn;
|
|
4196
|
+
type ValidTestCase = _ValidTestCase;
|
|
4197
|
+
type InvalidTestCase = _InvalidTestCase;
|
|
4198
|
+
type TestCases = _TestCases;
|
|
4199
|
+
type Error = _Error;
|
|
4200
|
+
type ErrorSuggestion = _ErrorSuggestion;
|
|
4201
|
+
}
|
|
4202
|
+
//#endregion
|
|
4203
|
+
export { RuleTester };
|