@oxlint/migrate 1.50.0 → 1.51.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 +14 -14
- package/dist/bin/oxlint-migrate.mjs +19 -7
- package/dist/{settings-D8R7axmT.mjs → settings-R7dCJ7Y3.mjs} +124 -20
- package/dist/src/index.d.mts +85 -2649
- package/dist/src/index.mjs +10 -2
- package/package.json +12 -9
package/dist/src/index.d.mts
CHANGED
|
@@ -1,2671 +1,102 @@
|
|
|
1
|
-
//#region
|
|
2
|
-
// This definition file follows a somewhat unusual format. ESTree allows
|
|
3
|
-
// runtime type checks based on the `type` parameter. In order to explain this
|
|
4
|
-
// to typescript we want to use discriminated union types:
|
|
5
|
-
// https://github.com/Microsoft/TypeScript/pull/9163
|
|
6
|
-
//
|
|
7
|
-
// For ESTree this is a bit tricky because the high level interfaces like
|
|
8
|
-
// Node or Function are pulling double duty. We want to pass common fields down
|
|
9
|
-
// to the interfaces that extend them (like Identifier or
|
|
10
|
-
// ArrowFunctionExpression), but you can't extend a type union or enforce
|
|
11
|
-
// common fields on them. So we've split the high level interfaces into two
|
|
12
|
-
// types, a base type which passes down inherited fields, and a type union of
|
|
13
|
-
// all types which extend the base type. Only the type union is exported, and
|
|
14
|
-
// the union is how other types refer to the collection of inheriting types.
|
|
15
|
-
//
|
|
16
|
-
// This makes the definitions file here somewhat more difficult to maintain,
|
|
17
|
-
// but it has the notable advantage of making ESTree much easier to use as
|
|
18
|
-
// an end user.
|
|
19
|
-
interface BaseNodeWithoutComments {
|
|
20
|
-
// Every leaf interface that extends BaseNode must specify a type property.
|
|
21
|
-
// The type property should be a string literal. For example, Identifier
|
|
22
|
-
// has: `type: "Identifier"`
|
|
23
|
-
type: string;
|
|
24
|
-
loc?: SourceLocation$2 | null | undefined;
|
|
25
|
-
range?: [number, number] | undefined;
|
|
26
|
-
}
|
|
27
|
-
interface BaseNode extends BaseNodeWithoutComments {
|
|
28
|
-
leadingComments?: Comment[] | undefined;
|
|
29
|
-
trailingComments?: Comment[] | undefined;
|
|
30
|
-
}
|
|
31
|
-
interface NodeMap {
|
|
32
|
-
AssignmentProperty: AssignmentProperty;
|
|
33
|
-
CatchClause: CatchClause;
|
|
34
|
-
Class: Class;
|
|
35
|
-
ClassBody: ClassBody;
|
|
36
|
-
Expression: Expression;
|
|
37
|
-
Function: Function;
|
|
38
|
-
Identifier: Identifier;
|
|
39
|
-
Literal: Literal;
|
|
40
|
-
MethodDefinition: MethodDefinition;
|
|
41
|
-
ModuleDeclaration: ModuleDeclaration;
|
|
42
|
-
ModuleSpecifier: ModuleSpecifier;
|
|
43
|
-
Pattern: Pattern;
|
|
44
|
-
PrivateIdentifier: PrivateIdentifier;
|
|
45
|
-
Program: Program;
|
|
46
|
-
Property: Property;
|
|
47
|
-
PropertyDefinition: PropertyDefinition;
|
|
48
|
-
SpreadElement: SpreadElement;
|
|
49
|
-
Statement: Statement;
|
|
50
|
-
Super: Super;
|
|
51
|
-
SwitchCase: SwitchCase;
|
|
52
|
-
TemplateElement: TemplateElement;
|
|
53
|
-
VariableDeclarator: VariableDeclarator;
|
|
54
|
-
}
|
|
55
|
-
type Node$1 = NodeMap[keyof NodeMap];
|
|
56
|
-
interface Comment extends BaseNodeWithoutComments {
|
|
57
|
-
type: "Line" | "Block";
|
|
58
|
-
value: string;
|
|
59
|
-
}
|
|
60
|
-
interface SourceLocation$2 {
|
|
61
|
-
source?: string | null | undefined;
|
|
62
|
-
start: Position$1;
|
|
63
|
-
end: Position$1;
|
|
64
|
-
}
|
|
65
|
-
interface Position$1 {
|
|
66
|
-
/** >= 1 */
|
|
67
|
-
line: number;
|
|
68
|
-
/** >= 0 */
|
|
69
|
-
column: number;
|
|
70
|
-
}
|
|
71
|
-
interface Program extends BaseNode {
|
|
72
|
-
type: "Program";
|
|
73
|
-
sourceType: "script" | "module";
|
|
74
|
-
body: Array<Directive$1 | Statement | ModuleDeclaration>;
|
|
75
|
-
comments?: Comment[] | undefined;
|
|
76
|
-
}
|
|
77
|
-
interface Directive$1 extends BaseNode {
|
|
78
|
-
type: "ExpressionStatement";
|
|
79
|
-
expression: Literal;
|
|
80
|
-
directive: string;
|
|
81
|
-
}
|
|
82
|
-
interface BaseFunction extends BaseNode {
|
|
83
|
-
params: Pattern[];
|
|
84
|
-
generator?: boolean | undefined;
|
|
85
|
-
async?: boolean | undefined; // The body is either BlockStatement or Expression because arrow functions
|
|
86
|
-
// can have a body that's either. FunctionDeclarations and
|
|
87
|
-
// FunctionExpressions have only BlockStatement bodies.
|
|
88
|
-
body: BlockStatement | Expression;
|
|
89
|
-
}
|
|
90
|
-
type Function = FunctionDeclaration | FunctionExpression | ArrowFunctionExpression;
|
|
91
|
-
type Statement = ExpressionStatement | BlockStatement | StaticBlock | EmptyStatement | DebuggerStatement | WithStatement | ReturnStatement | LabeledStatement | BreakStatement | ContinueStatement | IfStatement | SwitchStatement | ThrowStatement | TryStatement | WhileStatement | DoWhileStatement | ForStatement | ForInStatement | ForOfStatement | Declaration;
|
|
92
|
-
interface BaseStatement extends BaseNode {}
|
|
93
|
-
interface EmptyStatement extends BaseStatement {
|
|
94
|
-
type: "EmptyStatement";
|
|
95
|
-
}
|
|
96
|
-
interface BlockStatement extends BaseStatement {
|
|
97
|
-
type: "BlockStatement";
|
|
98
|
-
body: Statement[];
|
|
99
|
-
innerComments?: Comment[] | undefined;
|
|
100
|
-
}
|
|
101
|
-
interface StaticBlock extends Omit<BlockStatement, "type"> {
|
|
102
|
-
type: "StaticBlock";
|
|
103
|
-
}
|
|
104
|
-
interface ExpressionStatement extends BaseStatement {
|
|
105
|
-
type: "ExpressionStatement";
|
|
106
|
-
expression: Expression;
|
|
107
|
-
}
|
|
108
|
-
interface IfStatement extends BaseStatement {
|
|
109
|
-
type: "IfStatement";
|
|
110
|
-
test: Expression;
|
|
111
|
-
consequent: Statement;
|
|
112
|
-
alternate?: Statement | null | undefined;
|
|
113
|
-
}
|
|
114
|
-
interface LabeledStatement extends BaseStatement {
|
|
115
|
-
type: "LabeledStatement";
|
|
116
|
-
label: Identifier;
|
|
117
|
-
body: Statement;
|
|
118
|
-
}
|
|
119
|
-
interface BreakStatement extends BaseStatement {
|
|
120
|
-
type: "BreakStatement";
|
|
121
|
-
label?: Identifier | null | undefined;
|
|
122
|
-
}
|
|
123
|
-
interface ContinueStatement extends BaseStatement {
|
|
124
|
-
type: "ContinueStatement";
|
|
125
|
-
label?: Identifier | null | undefined;
|
|
126
|
-
}
|
|
127
|
-
interface WithStatement extends BaseStatement {
|
|
128
|
-
type: "WithStatement";
|
|
129
|
-
object: Expression;
|
|
130
|
-
body: Statement;
|
|
131
|
-
}
|
|
132
|
-
interface SwitchStatement extends BaseStatement {
|
|
133
|
-
type: "SwitchStatement";
|
|
134
|
-
discriminant: Expression;
|
|
135
|
-
cases: SwitchCase[];
|
|
136
|
-
}
|
|
137
|
-
interface ReturnStatement extends BaseStatement {
|
|
138
|
-
type: "ReturnStatement";
|
|
139
|
-
argument?: Expression | null | undefined;
|
|
140
|
-
}
|
|
141
|
-
interface ThrowStatement extends BaseStatement {
|
|
142
|
-
type: "ThrowStatement";
|
|
143
|
-
argument: Expression;
|
|
144
|
-
}
|
|
145
|
-
interface TryStatement extends BaseStatement {
|
|
146
|
-
type: "TryStatement";
|
|
147
|
-
block: BlockStatement;
|
|
148
|
-
handler?: CatchClause | null | undefined;
|
|
149
|
-
finalizer?: BlockStatement | null | undefined;
|
|
150
|
-
}
|
|
151
|
-
interface WhileStatement extends BaseStatement {
|
|
152
|
-
type: "WhileStatement";
|
|
153
|
-
test: Expression;
|
|
154
|
-
body: Statement;
|
|
155
|
-
}
|
|
156
|
-
interface DoWhileStatement extends BaseStatement {
|
|
157
|
-
type: "DoWhileStatement";
|
|
158
|
-
body: Statement;
|
|
159
|
-
test: Expression;
|
|
160
|
-
}
|
|
161
|
-
interface ForStatement extends BaseStatement {
|
|
162
|
-
type: "ForStatement";
|
|
163
|
-
init?: VariableDeclaration | Expression | null | undefined;
|
|
164
|
-
test?: Expression | null | undefined;
|
|
165
|
-
update?: Expression | null | undefined;
|
|
166
|
-
body: Statement;
|
|
167
|
-
}
|
|
168
|
-
interface BaseForXStatement extends BaseStatement {
|
|
169
|
-
left: VariableDeclaration | Pattern;
|
|
170
|
-
right: Expression;
|
|
171
|
-
body: Statement;
|
|
172
|
-
}
|
|
173
|
-
interface ForInStatement extends BaseForXStatement {
|
|
174
|
-
type: "ForInStatement";
|
|
175
|
-
}
|
|
176
|
-
interface DebuggerStatement extends BaseStatement {
|
|
177
|
-
type: "DebuggerStatement";
|
|
178
|
-
}
|
|
179
|
-
type Declaration = FunctionDeclaration | VariableDeclaration | ClassDeclaration;
|
|
180
|
-
interface BaseDeclaration extends BaseStatement {}
|
|
181
|
-
interface MaybeNamedFunctionDeclaration extends BaseFunction, BaseDeclaration {
|
|
182
|
-
type: "FunctionDeclaration";
|
|
183
|
-
/** It is null when a function declaration is a part of the `export default function` statement */
|
|
184
|
-
id: Identifier | null;
|
|
185
|
-
body: BlockStatement;
|
|
186
|
-
}
|
|
187
|
-
interface FunctionDeclaration extends MaybeNamedFunctionDeclaration {
|
|
188
|
-
id: Identifier;
|
|
189
|
-
}
|
|
190
|
-
interface VariableDeclaration extends BaseDeclaration {
|
|
191
|
-
type: "VariableDeclaration";
|
|
192
|
-
declarations: VariableDeclarator[];
|
|
193
|
-
kind: "var" | "let" | "const" | "using" | "await using";
|
|
194
|
-
}
|
|
195
|
-
interface VariableDeclarator extends BaseNode {
|
|
196
|
-
type: "VariableDeclarator";
|
|
197
|
-
id: Pattern;
|
|
198
|
-
init?: Expression | null | undefined;
|
|
199
|
-
}
|
|
200
|
-
interface ExpressionMap {
|
|
201
|
-
ArrayExpression: ArrayExpression;
|
|
202
|
-
ArrowFunctionExpression: ArrowFunctionExpression;
|
|
203
|
-
AssignmentExpression: AssignmentExpression;
|
|
204
|
-
AwaitExpression: AwaitExpression;
|
|
205
|
-
BinaryExpression: BinaryExpression;
|
|
206
|
-
CallExpression: CallExpression;
|
|
207
|
-
ChainExpression: ChainExpression;
|
|
208
|
-
ClassExpression: ClassExpression;
|
|
209
|
-
ConditionalExpression: ConditionalExpression;
|
|
210
|
-
FunctionExpression: FunctionExpression;
|
|
211
|
-
Identifier: Identifier;
|
|
212
|
-
ImportExpression: ImportExpression;
|
|
213
|
-
Literal: Literal;
|
|
214
|
-
LogicalExpression: LogicalExpression;
|
|
215
|
-
MemberExpression: MemberExpression;
|
|
216
|
-
MetaProperty: MetaProperty;
|
|
217
|
-
NewExpression: NewExpression;
|
|
218
|
-
ObjectExpression: ObjectExpression;
|
|
219
|
-
SequenceExpression: SequenceExpression;
|
|
220
|
-
TaggedTemplateExpression: TaggedTemplateExpression;
|
|
221
|
-
TemplateLiteral: TemplateLiteral;
|
|
222
|
-
ThisExpression: ThisExpression;
|
|
223
|
-
UnaryExpression: UnaryExpression;
|
|
224
|
-
UpdateExpression: UpdateExpression;
|
|
225
|
-
YieldExpression: YieldExpression;
|
|
226
|
-
}
|
|
227
|
-
type Expression = ExpressionMap[keyof ExpressionMap];
|
|
228
|
-
interface BaseExpression extends BaseNode {}
|
|
229
|
-
type ChainElement = SimpleCallExpression | MemberExpression;
|
|
230
|
-
interface ChainExpression extends BaseExpression {
|
|
231
|
-
type: "ChainExpression";
|
|
232
|
-
expression: ChainElement;
|
|
233
|
-
}
|
|
234
|
-
interface ThisExpression extends BaseExpression {
|
|
235
|
-
type: "ThisExpression";
|
|
236
|
-
}
|
|
237
|
-
interface ArrayExpression extends BaseExpression {
|
|
238
|
-
type: "ArrayExpression";
|
|
239
|
-
elements: Array<Expression | SpreadElement | null>;
|
|
240
|
-
}
|
|
241
|
-
interface ObjectExpression extends BaseExpression {
|
|
242
|
-
type: "ObjectExpression";
|
|
243
|
-
properties: Array<Property | SpreadElement>;
|
|
244
|
-
}
|
|
245
|
-
interface PrivateIdentifier extends BaseNode {
|
|
246
|
-
type: "PrivateIdentifier";
|
|
247
|
-
name: string;
|
|
248
|
-
}
|
|
249
|
-
interface Property extends BaseNode {
|
|
250
|
-
type: "Property";
|
|
251
|
-
key: Expression | PrivateIdentifier;
|
|
252
|
-
value: Expression | Pattern; // Could be an AssignmentProperty
|
|
253
|
-
kind: "init" | "get" | "set";
|
|
254
|
-
method: boolean;
|
|
255
|
-
shorthand: boolean;
|
|
256
|
-
computed: boolean;
|
|
257
|
-
}
|
|
258
|
-
interface PropertyDefinition extends BaseNode {
|
|
259
|
-
type: "PropertyDefinition";
|
|
260
|
-
key: Expression | PrivateIdentifier;
|
|
261
|
-
value?: Expression | null | undefined;
|
|
262
|
-
computed: boolean;
|
|
263
|
-
static: boolean;
|
|
264
|
-
}
|
|
265
|
-
interface FunctionExpression extends BaseFunction, BaseExpression {
|
|
266
|
-
id?: Identifier | null | undefined;
|
|
267
|
-
type: "FunctionExpression";
|
|
268
|
-
body: BlockStatement;
|
|
269
|
-
}
|
|
270
|
-
interface SequenceExpression extends BaseExpression {
|
|
271
|
-
type: "SequenceExpression";
|
|
272
|
-
expressions: Expression[];
|
|
273
|
-
}
|
|
274
|
-
interface UnaryExpression extends BaseExpression {
|
|
275
|
-
type: "UnaryExpression";
|
|
276
|
-
operator: UnaryOperator;
|
|
277
|
-
prefix: true;
|
|
278
|
-
argument: Expression;
|
|
279
|
-
}
|
|
280
|
-
interface BinaryExpression extends BaseExpression {
|
|
281
|
-
type: "BinaryExpression";
|
|
282
|
-
operator: BinaryOperator;
|
|
283
|
-
left: Expression | PrivateIdentifier;
|
|
284
|
-
right: Expression;
|
|
285
|
-
}
|
|
286
|
-
interface AssignmentExpression extends BaseExpression {
|
|
287
|
-
type: "AssignmentExpression";
|
|
288
|
-
operator: AssignmentOperator;
|
|
289
|
-
left: Pattern | MemberExpression;
|
|
290
|
-
right: Expression;
|
|
291
|
-
}
|
|
292
|
-
interface UpdateExpression extends BaseExpression {
|
|
293
|
-
type: "UpdateExpression";
|
|
294
|
-
operator: UpdateOperator;
|
|
295
|
-
argument: Expression;
|
|
296
|
-
prefix: boolean;
|
|
297
|
-
}
|
|
298
|
-
interface LogicalExpression extends BaseExpression {
|
|
299
|
-
type: "LogicalExpression";
|
|
300
|
-
operator: LogicalOperator;
|
|
301
|
-
left: Expression;
|
|
302
|
-
right: Expression;
|
|
303
|
-
}
|
|
304
|
-
interface ConditionalExpression extends BaseExpression {
|
|
305
|
-
type: "ConditionalExpression";
|
|
306
|
-
test: Expression;
|
|
307
|
-
alternate: Expression;
|
|
308
|
-
consequent: Expression;
|
|
309
|
-
}
|
|
310
|
-
interface BaseCallExpression extends BaseExpression {
|
|
311
|
-
callee: Expression | Super;
|
|
312
|
-
arguments: Array<Expression | SpreadElement>;
|
|
313
|
-
}
|
|
314
|
-
type CallExpression = SimpleCallExpression | NewExpression;
|
|
315
|
-
interface SimpleCallExpression extends BaseCallExpression {
|
|
316
|
-
type: "CallExpression";
|
|
317
|
-
optional: boolean;
|
|
318
|
-
}
|
|
319
|
-
interface NewExpression extends BaseCallExpression {
|
|
320
|
-
type: "NewExpression";
|
|
321
|
-
}
|
|
322
|
-
interface MemberExpression extends BaseExpression, BasePattern {
|
|
323
|
-
type: "MemberExpression";
|
|
324
|
-
object: Expression | Super;
|
|
325
|
-
property: Expression | PrivateIdentifier;
|
|
326
|
-
computed: boolean;
|
|
327
|
-
optional: boolean;
|
|
328
|
-
}
|
|
329
|
-
type Pattern = Identifier | ObjectPattern | ArrayPattern | RestElement | AssignmentPattern | MemberExpression;
|
|
330
|
-
interface BasePattern extends BaseNode {}
|
|
331
|
-
interface SwitchCase extends BaseNode {
|
|
332
|
-
type: "SwitchCase";
|
|
333
|
-
test?: Expression | null | undefined;
|
|
334
|
-
consequent: Statement[];
|
|
335
|
-
}
|
|
336
|
-
interface CatchClause extends BaseNode {
|
|
337
|
-
type: "CatchClause";
|
|
338
|
-
param: Pattern | null;
|
|
339
|
-
body: BlockStatement;
|
|
340
|
-
}
|
|
341
|
-
interface Identifier extends BaseNode, BaseExpression, BasePattern {
|
|
342
|
-
type: "Identifier";
|
|
343
|
-
name: string;
|
|
344
|
-
}
|
|
345
|
-
type Literal = SimpleLiteral | RegExpLiteral | BigIntLiteral;
|
|
346
|
-
interface SimpleLiteral extends BaseNode, BaseExpression {
|
|
347
|
-
type: "Literal";
|
|
348
|
-
value: string | boolean | number | null;
|
|
349
|
-
raw?: string | undefined;
|
|
350
|
-
}
|
|
351
|
-
interface RegExpLiteral extends BaseNode, BaseExpression {
|
|
352
|
-
type: "Literal";
|
|
353
|
-
value?: RegExp | null | undefined;
|
|
354
|
-
regex: {
|
|
355
|
-
pattern: string;
|
|
356
|
-
flags: string;
|
|
357
|
-
};
|
|
358
|
-
raw?: string | undefined;
|
|
359
|
-
}
|
|
360
|
-
interface BigIntLiteral extends BaseNode, BaseExpression {
|
|
361
|
-
type: "Literal";
|
|
362
|
-
value?: bigint | null | undefined;
|
|
363
|
-
bigint: string;
|
|
364
|
-
raw?: string | undefined;
|
|
365
|
-
}
|
|
366
|
-
type UnaryOperator = "-" | "+" | "!" | "~" | "typeof" | "void" | "delete";
|
|
367
|
-
type BinaryOperator = "==" | "!=" | "===" | "!==" | "<" | "<=" | ">" | ">=" | "<<" | ">>" | ">>>" | "+" | "-" | "*" | "/" | "%" | "**" | "|" | "^" | "&" | "in" | "instanceof";
|
|
368
|
-
type LogicalOperator = "||" | "&&" | "??";
|
|
369
|
-
type AssignmentOperator = "=" | "+=" | "-=" | "*=" | "/=" | "%=" | "**=" | "<<=" | ">>=" | ">>>=" | "|=" | "^=" | "&=" | "||=" | "&&=" | "??=";
|
|
370
|
-
type UpdateOperator = "++" | "--";
|
|
371
|
-
interface ForOfStatement extends BaseForXStatement {
|
|
372
|
-
type: "ForOfStatement";
|
|
373
|
-
await: boolean;
|
|
374
|
-
}
|
|
375
|
-
interface Super extends BaseNode {
|
|
376
|
-
type: "Super";
|
|
377
|
-
}
|
|
378
|
-
interface SpreadElement extends BaseNode {
|
|
379
|
-
type: "SpreadElement";
|
|
380
|
-
argument: Expression;
|
|
381
|
-
}
|
|
382
|
-
interface ArrowFunctionExpression extends BaseExpression, BaseFunction {
|
|
383
|
-
type: "ArrowFunctionExpression";
|
|
384
|
-
expression: boolean;
|
|
385
|
-
body: BlockStatement | Expression;
|
|
386
|
-
}
|
|
387
|
-
interface YieldExpression extends BaseExpression {
|
|
388
|
-
type: "YieldExpression";
|
|
389
|
-
argument?: Expression | null | undefined;
|
|
390
|
-
delegate: boolean;
|
|
391
|
-
}
|
|
392
|
-
interface TemplateLiteral extends BaseExpression {
|
|
393
|
-
type: "TemplateLiteral";
|
|
394
|
-
quasis: TemplateElement[];
|
|
395
|
-
expressions: Expression[];
|
|
396
|
-
}
|
|
397
|
-
interface TaggedTemplateExpression extends BaseExpression {
|
|
398
|
-
type: "TaggedTemplateExpression";
|
|
399
|
-
tag: Expression;
|
|
400
|
-
quasi: TemplateLiteral;
|
|
401
|
-
}
|
|
402
|
-
interface TemplateElement extends BaseNode {
|
|
403
|
-
type: "TemplateElement";
|
|
404
|
-
tail: boolean;
|
|
405
|
-
value: {
|
|
406
|
-
/** It is null when the template literal is tagged and the text has an invalid escape (e.g. - tag`\unicode and \u{55}`) */cooked?: string | null | undefined;
|
|
407
|
-
raw: string;
|
|
408
|
-
};
|
|
409
|
-
}
|
|
410
|
-
interface AssignmentProperty extends Property {
|
|
411
|
-
value: Pattern;
|
|
412
|
-
kind: "init";
|
|
413
|
-
method: boolean; // false
|
|
414
|
-
}
|
|
415
|
-
interface ObjectPattern extends BasePattern {
|
|
416
|
-
type: "ObjectPattern";
|
|
417
|
-
properties: Array<AssignmentProperty | RestElement>;
|
|
418
|
-
}
|
|
419
|
-
interface ArrayPattern extends BasePattern {
|
|
420
|
-
type: "ArrayPattern";
|
|
421
|
-
elements: Array<Pattern | null>;
|
|
422
|
-
}
|
|
423
|
-
interface RestElement extends BasePattern {
|
|
424
|
-
type: "RestElement";
|
|
425
|
-
argument: Pattern;
|
|
426
|
-
}
|
|
427
|
-
interface AssignmentPattern extends BasePattern {
|
|
428
|
-
type: "AssignmentPattern";
|
|
429
|
-
left: Pattern;
|
|
430
|
-
right: Expression;
|
|
431
|
-
}
|
|
432
|
-
type Class = ClassDeclaration | ClassExpression;
|
|
433
|
-
interface BaseClass extends BaseNode {
|
|
434
|
-
superClass?: Expression | null | undefined;
|
|
435
|
-
body: ClassBody;
|
|
436
|
-
}
|
|
437
|
-
interface ClassBody extends BaseNode {
|
|
438
|
-
type: "ClassBody";
|
|
439
|
-
body: Array<MethodDefinition | PropertyDefinition | StaticBlock>;
|
|
440
|
-
}
|
|
441
|
-
interface MethodDefinition extends BaseNode {
|
|
442
|
-
type: "MethodDefinition";
|
|
443
|
-
key: Expression | PrivateIdentifier;
|
|
444
|
-
value: FunctionExpression;
|
|
445
|
-
kind: "constructor" | "method" | "get" | "set";
|
|
446
|
-
computed: boolean;
|
|
447
|
-
static: boolean;
|
|
448
|
-
}
|
|
449
|
-
interface MaybeNamedClassDeclaration extends BaseClass, BaseDeclaration {
|
|
450
|
-
type: "ClassDeclaration";
|
|
451
|
-
/** It is null when a class declaration is a part of the `export default class` statement */
|
|
452
|
-
id: Identifier | null;
|
|
453
|
-
}
|
|
454
|
-
interface ClassDeclaration extends MaybeNamedClassDeclaration {
|
|
455
|
-
id: Identifier;
|
|
456
|
-
}
|
|
457
|
-
interface ClassExpression extends BaseClass, BaseExpression {
|
|
458
|
-
type: "ClassExpression";
|
|
459
|
-
id?: Identifier | null | undefined;
|
|
460
|
-
}
|
|
461
|
-
interface MetaProperty extends BaseExpression {
|
|
462
|
-
type: "MetaProperty";
|
|
463
|
-
meta: Identifier;
|
|
464
|
-
property: Identifier;
|
|
465
|
-
}
|
|
466
|
-
type ModuleDeclaration = ImportDeclaration | ExportNamedDeclaration | ExportDefaultDeclaration | ExportAllDeclaration;
|
|
467
|
-
interface BaseModuleDeclaration extends BaseNode {}
|
|
468
|
-
type ModuleSpecifier = ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier | ExportSpecifier;
|
|
469
|
-
interface BaseModuleSpecifier extends BaseNode {
|
|
470
|
-
local: Identifier;
|
|
471
|
-
}
|
|
472
|
-
interface ImportDeclaration extends BaseModuleDeclaration {
|
|
473
|
-
type: "ImportDeclaration";
|
|
474
|
-
specifiers: Array<ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier>;
|
|
475
|
-
attributes: ImportAttribute[];
|
|
476
|
-
source: Literal;
|
|
477
|
-
}
|
|
478
|
-
interface ImportSpecifier extends BaseModuleSpecifier {
|
|
479
|
-
type: "ImportSpecifier";
|
|
480
|
-
imported: Identifier | Literal;
|
|
481
|
-
}
|
|
482
|
-
interface ImportAttribute extends BaseNode {
|
|
483
|
-
type: "ImportAttribute";
|
|
484
|
-
key: Identifier | Literal;
|
|
485
|
-
value: Literal;
|
|
486
|
-
}
|
|
487
|
-
interface ImportExpression extends BaseExpression {
|
|
488
|
-
type: "ImportExpression";
|
|
489
|
-
source: Expression;
|
|
490
|
-
options?: Expression | null | undefined;
|
|
491
|
-
}
|
|
492
|
-
interface ImportDefaultSpecifier extends BaseModuleSpecifier {
|
|
493
|
-
type: "ImportDefaultSpecifier";
|
|
494
|
-
}
|
|
495
|
-
interface ImportNamespaceSpecifier extends BaseModuleSpecifier {
|
|
496
|
-
type: "ImportNamespaceSpecifier";
|
|
497
|
-
}
|
|
498
|
-
interface ExportNamedDeclaration extends BaseModuleDeclaration {
|
|
499
|
-
type: "ExportNamedDeclaration";
|
|
500
|
-
declaration?: Declaration | null | undefined;
|
|
501
|
-
specifiers: ExportSpecifier[];
|
|
502
|
-
attributes: ImportAttribute[];
|
|
503
|
-
source?: Literal | null | undefined;
|
|
504
|
-
}
|
|
505
|
-
interface ExportSpecifier extends Omit<BaseModuleSpecifier, "local"> {
|
|
506
|
-
type: "ExportSpecifier";
|
|
507
|
-
local: Identifier | Literal;
|
|
508
|
-
exported: Identifier | Literal;
|
|
509
|
-
}
|
|
510
|
-
interface ExportDefaultDeclaration extends BaseModuleDeclaration {
|
|
511
|
-
type: "ExportDefaultDeclaration";
|
|
512
|
-
declaration: MaybeNamedFunctionDeclaration | MaybeNamedClassDeclaration | Expression;
|
|
513
|
-
}
|
|
514
|
-
interface ExportAllDeclaration extends BaseModuleDeclaration {
|
|
515
|
-
type: "ExportAllDeclaration";
|
|
516
|
-
exported: Identifier | Literal | null;
|
|
517
|
-
attributes: ImportAttribute[];
|
|
518
|
-
source: Literal;
|
|
519
|
-
}
|
|
520
|
-
interface AwaitExpression extends BaseExpression {
|
|
521
|
-
type: "AwaitExpression";
|
|
522
|
-
argument: Expression;
|
|
523
|
-
}
|
|
524
|
-
//#endregion
|
|
525
|
-
//#region node_modules/.pnpm/@types+json-schema@7.0.15/node_modules/@types/json-schema/index.d.ts
|
|
526
|
-
// ==================================================================================================
|
|
527
|
-
// JSON Schema Draft 04
|
|
528
|
-
// ==================================================================================================
|
|
529
|
-
/**
|
|
530
|
-
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.1
|
|
531
|
-
*/
|
|
532
|
-
type JSONSchema4TypeName = "string" //
|
|
533
|
-
| "number" | "integer" | "boolean" | "object" | "array" | "null" | "any";
|
|
534
|
-
/**
|
|
535
|
-
* @see https://tools.ietf.org/html/draft-zyp-json-schema-04#section-3.5
|
|
536
|
-
*/
|
|
537
|
-
type JSONSchema4Type = string //
|
|
538
|
-
| number | boolean | JSONSchema4Object | JSONSchema4Array | null;
|
|
539
|
-
// Workaround for infinite type recursion
|
|
540
|
-
interface JSONSchema4Object {
|
|
541
|
-
[key: string]: JSONSchema4Type;
|
|
542
|
-
}
|
|
543
|
-
// Workaround for infinite type recursion
|
|
544
|
-
// https://github.com/Microsoft/TypeScript/issues/3496#issuecomment-128553540
|
|
545
|
-
interface JSONSchema4Array extends Array<JSONSchema4Type> {}
|
|
546
|
-
/**
|
|
547
|
-
* Meta schema
|
|
548
|
-
*
|
|
549
|
-
* Recommended values:
|
|
550
|
-
* - 'http://json-schema.org/schema#'
|
|
551
|
-
* - 'http://json-schema.org/hyper-schema#'
|
|
552
|
-
* - 'http://json-schema.org/draft-04/schema#'
|
|
553
|
-
* - 'http://json-schema.org/draft-04/hyper-schema#'
|
|
554
|
-
* - 'http://json-schema.org/draft-03/schema#'
|
|
555
|
-
* - 'http://json-schema.org/draft-03/hyper-schema#'
|
|
556
|
-
*
|
|
557
|
-
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-5
|
|
558
|
-
*/
|
|
559
|
-
type JSONSchema4Version = string;
|
|
560
|
-
/**
|
|
561
|
-
* JSON Schema V4
|
|
562
|
-
* @see https://tools.ietf.org/html/draft-zyp-json-schema-04
|
|
563
|
-
*/
|
|
564
|
-
interface JSONSchema4 {
|
|
565
|
-
id?: string | undefined;
|
|
566
|
-
$ref?: string | undefined;
|
|
567
|
-
$schema?: JSONSchema4Version | undefined;
|
|
568
|
-
/**
|
|
569
|
-
* This attribute is a string that provides a short description of the
|
|
570
|
-
* instance property.
|
|
571
|
-
*
|
|
572
|
-
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.21
|
|
573
|
-
*/
|
|
574
|
-
title?: string | undefined;
|
|
575
|
-
/**
|
|
576
|
-
* This attribute is a string that provides a full description of the of
|
|
577
|
-
* purpose the instance property.
|
|
578
|
-
*
|
|
579
|
-
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.22
|
|
580
|
-
*/
|
|
581
|
-
description?: string | undefined;
|
|
582
|
-
default?: JSONSchema4Type | undefined;
|
|
583
|
-
multipleOf?: number | undefined;
|
|
584
|
-
maximum?: number | undefined;
|
|
585
|
-
exclusiveMaximum?: boolean | undefined;
|
|
586
|
-
minimum?: number | undefined;
|
|
587
|
-
exclusiveMinimum?: boolean | undefined;
|
|
588
|
-
maxLength?: number | undefined;
|
|
589
|
-
minLength?: number | undefined;
|
|
590
|
-
pattern?: string | undefined;
|
|
591
|
-
/**
|
|
592
|
-
* May only be defined when "items" is defined, and is a tuple of JSONSchemas.
|
|
593
|
-
*
|
|
594
|
-
* This provides a definition for additional items in an array instance
|
|
595
|
-
* when tuple definitions of the items is provided. This can be false
|
|
596
|
-
* to indicate additional items in the array are not allowed, or it can
|
|
597
|
-
* be a schema that defines the schema of the additional items.
|
|
598
|
-
*
|
|
599
|
-
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.6
|
|
600
|
-
*/
|
|
601
|
-
additionalItems?: boolean | JSONSchema4 | undefined;
|
|
602
|
-
/**
|
|
603
|
-
* This attribute defines the allowed items in an instance array, and
|
|
604
|
-
* MUST be a schema or an array of schemas. The default value is an
|
|
605
|
-
* empty schema which allows any value for items in the instance array.
|
|
606
|
-
*
|
|
607
|
-
* When this attribute value is a schema and the instance value is an
|
|
608
|
-
* array, then all the items in the array MUST be valid according to the
|
|
609
|
-
* schema.
|
|
610
|
-
*
|
|
611
|
-
* When this attribute value is an array of schemas and the instance
|
|
612
|
-
* value is an array, each position in the instance array MUST conform
|
|
613
|
-
* to the schema in the corresponding position for this array. This
|
|
614
|
-
* called tuple typing. When tuple typing is used, additional items are
|
|
615
|
-
* allowed, disallowed, or constrained by the "additionalItems"
|
|
616
|
-
* (Section 5.6) attribute using the same rules as
|
|
617
|
-
* "additionalProperties" (Section 5.4) for objects.
|
|
618
|
-
*
|
|
619
|
-
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.5
|
|
620
|
-
*/
|
|
621
|
-
items?: JSONSchema4 | JSONSchema4[] | undefined;
|
|
622
|
-
maxItems?: number | undefined;
|
|
623
|
-
minItems?: number | undefined;
|
|
624
|
-
uniqueItems?: boolean | undefined;
|
|
625
|
-
maxProperties?: number | undefined;
|
|
626
|
-
minProperties?: number | undefined;
|
|
627
|
-
/**
|
|
628
|
-
* This attribute indicates if the instance must have a value, and not
|
|
629
|
-
* be undefined. This is false by default, making the instance
|
|
630
|
-
* optional.
|
|
631
|
-
*
|
|
632
|
-
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.7
|
|
633
|
-
*/
|
|
634
|
-
required?: boolean | string[] | undefined;
|
|
635
|
-
/**
|
|
636
|
-
* This attribute defines a schema for all properties that are not
|
|
637
|
-
* explicitly defined in an object type definition. If specified, the
|
|
638
|
-
* value MUST be a schema or a boolean. If false is provided, no
|
|
639
|
-
* additional properties are allowed beyond the properties defined in
|
|
640
|
-
* the schema. The default value is an empty schema which allows any
|
|
641
|
-
* value for additional properties.
|
|
642
|
-
*
|
|
643
|
-
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.4
|
|
644
|
-
*/
|
|
645
|
-
additionalProperties?: boolean | JSONSchema4 | undefined;
|
|
646
|
-
definitions?: {
|
|
647
|
-
[k: string]: JSONSchema4;
|
|
648
|
-
} | undefined;
|
|
649
|
-
/**
|
|
650
|
-
* This attribute is an object with property definitions that define the
|
|
651
|
-
* valid values of instance object property values. When the instance
|
|
652
|
-
* value is an object, the property values of the instance object MUST
|
|
653
|
-
* conform to the property definitions in this object. In this object,
|
|
654
|
-
* each property definition's value MUST be a schema, and the property's
|
|
655
|
-
* name MUST be the name of the instance property that it defines. The
|
|
656
|
-
* instance property value MUST be valid according to the schema from
|
|
657
|
-
* the property definition. Properties are considered unordered, the
|
|
658
|
-
* order of the instance properties MAY be in any order.
|
|
659
|
-
*
|
|
660
|
-
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.2
|
|
661
|
-
*/
|
|
662
|
-
properties?: {
|
|
663
|
-
[k: string]: JSONSchema4;
|
|
664
|
-
} | undefined;
|
|
665
|
-
/**
|
|
666
|
-
* This attribute is an object that defines the schema for a set of
|
|
667
|
-
* property names of an object instance. The name of each property of
|
|
668
|
-
* this attribute's object is a regular expression pattern in the ECMA
|
|
669
|
-
* 262/Perl 5 format, while the value is a schema. If the pattern
|
|
670
|
-
* matches the name of a property on the instance object, the value of
|
|
671
|
-
* the instance's property MUST be valid against the pattern name's
|
|
672
|
-
* schema value.
|
|
673
|
-
*
|
|
674
|
-
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.3
|
|
675
|
-
*/
|
|
676
|
-
patternProperties?: {
|
|
677
|
-
[k: string]: JSONSchema4;
|
|
678
|
-
} | undefined;
|
|
679
|
-
dependencies?: {
|
|
680
|
-
[k: string]: JSONSchema4 | string[];
|
|
681
|
-
} | undefined;
|
|
682
|
-
/**
|
|
683
|
-
* This provides an enumeration of all possible values that are valid
|
|
684
|
-
* for the instance property. This MUST be an array, and each item in
|
|
685
|
-
* the array represents a possible value for the instance value. If
|
|
686
|
-
* this attribute is defined, the instance value MUST be one of the
|
|
687
|
-
* values in the array in order for the schema to be valid.
|
|
688
|
-
*
|
|
689
|
-
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.19
|
|
690
|
-
*/
|
|
691
|
-
enum?: JSONSchema4Type[] | undefined;
|
|
692
|
-
/**
|
|
693
|
-
* A single type, or a union of simple types
|
|
694
|
-
*/
|
|
695
|
-
type?: JSONSchema4TypeName | JSONSchema4TypeName[] | undefined;
|
|
696
|
-
allOf?: JSONSchema4[] | undefined;
|
|
697
|
-
anyOf?: JSONSchema4[] | undefined;
|
|
698
|
-
oneOf?: JSONSchema4[] | undefined;
|
|
699
|
-
not?: JSONSchema4 | undefined;
|
|
700
|
-
/**
|
|
701
|
-
* The value of this property MUST be another schema which will provide
|
|
702
|
-
* a base schema which the current schema will inherit from. The
|
|
703
|
-
* inheritance rules are such that any instance that is valid according
|
|
704
|
-
* to the current schema MUST be valid according to the referenced
|
|
705
|
-
* schema. This MAY also be an array, in which case, the instance MUST
|
|
706
|
-
* be valid for all the schemas in the array. A schema that extends
|
|
707
|
-
* another schema MAY define additional attributes, constrain existing
|
|
708
|
-
* attributes, or add other constraints.
|
|
709
|
-
*
|
|
710
|
-
* Conceptually, the behavior of extends can be seen as validating an
|
|
711
|
-
* instance against all constraints in the extending schema as well as
|
|
712
|
-
* the extended schema(s).
|
|
713
|
-
*
|
|
714
|
-
* @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.26
|
|
715
|
-
*/
|
|
716
|
-
extends?: string | string[] | undefined;
|
|
717
|
-
/**
|
|
718
|
-
* @see https://tools.ietf.org/html/draft-zyp-json-schema-04#section-5.6
|
|
719
|
-
*/
|
|
720
|
-
[k: string]: any;
|
|
721
|
-
format?: string | undefined;
|
|
722
|
-
}
|
|
723
|
-
//#endregion
|
|
724
|
-
//#region node_modules/.pnpm/@eslint+core@0.17.0/node_modules/@eslint/core/dist/esm/types.d.ts
|
|
725
|
-
/**
|
|
726
|
-
* Represents an error inside of a file.
|
|
727
|
-
*/
|
|
728
|
-
interface FileError {
|
|
729
|
-
message: string;
|
|
730
|
-
line: number;
|
|
731
|
-
column: number;
|
|
732
|
-
endLine?: number;
|
|
733
|
-
endColumn?: number;
|
|
734
|
-
}
|
|
735
|
-
/**
|
|
736
|
-
* Represents a problem found in a file.
|
|
737
|
-
*/
|
|
738
|
-
interface FileProblem {
|
|
739
|
-
ruleId: string | null;
|
|
740
|
-
message: string;
|
|
741
|
-
loc: SourceLocation$1;
|
|
742
|
-
}
|
|
743
|
-
/**
|
|
744
|
-
* Represents the start and end coordinates of a node inside the source.
|
|
745
|
-
*/
|
|
746
|
-
interface SourceLocation$1 {
|
|
747
|
-
start: Position;
|
|
748
|
-
end: Position;
|
|
749
|
-
}
|
|
750
|
-
/**
|
|
751
|
-
* Represents a location coordinate inside the source. ESLint-style formats
|
|
752
|
-
* have just `line` and `column` while others may have `offset` as well.
|
|
753
|
-
*/
|
|
754
|
-
interface Position {
|
|
755
|
-
line: number;
|
|
756
|
-
column: number;
|
|
757
|
-
}
|
|
758
|
-
/**
|
|
759
|
-
* Represents a range of characters in the source.
|
|
760
|
-
*/
|
|
761
|
-
type SourceRange = [number, number];
|
|
762
|
-
/**
|
|
763
|
-
* What the rule is responsible for finding:
|
|
764
|
-
* - `problem` means the rule has noticed a potential error.
|
|
765
|
-
* - `suggestion` means the rule suggests an alternate or better approach.
|
|
766
|
-
* - `layout` means the rule is looking at spacing, indentation, etc.
|
|
767
|
-
*/
|
|
768
|
-
type RuleType = "problem" | "suggestion" | "layout";
|
|
769
|
-
/**
|
|
770
|
-
* The type of fix the rule can provide:
|
|
771
|
-
* - `code` means the rule can fix syntax.
|
|
772
|
-
* - `whitespace` means the rule can fix spacing and indentation.
|
|
773
|
-
*/
|
|
774
|
-
type RuleFixType = "code" | "whitespace";
|
|
775
|
-
/**
|
|
776
|
-
* An object containing visitor information for a rule. Each method is either the
|
|
777
|
-
* name of a node type or a selector, or is a method that will be called at specific
|
|
778
|
-
* times during the traversal.
|
|
779
|
-
*/
|
|
780
|
-
type RuleVisitor = Record<string, ((...args: any[]) => void) | undefined>;
|
|
781
|
-
/**
|
|
782
|
-
* Rule meta information used for documentation.
|
|
783
|
-
*/
|
|
784
|
-
interface RulesMetaDocs {
|
|
785
|
-
/**
|
|
786
|
-
* A short description of the rule.
|
|
787
|
-
*/
|
|
788
|
-
description?: string | undefined;
|
|
789
|
-
/**
|
|
790
|
-
* The URL to the documentation for the rule.
|
|
791
|
-
*/
|
|
792
|
-
url?: string | undefined;
|
|
793
|
-
/**
|
|
794
|
-
* The category the rule falls under.
|
|
795
|
-
* @deprecated No longer used.
|
|
796
|
-
*/
|
|
797
|
-
category?: string | undefined;
|
|
798
|
-
/**
|
|
799
|
-
* Indicates if the rule is generally recommended for all users.
|
|
800
|
-
*
|
|
801
|
-
* Note - this will always be a boolean for core rules, but may be used in any way by plugins.
|
|
802
|
-
*/
|
|
803
|
-
recommended?: unknown;
|
|
804
|
-
/**
|
|
805
|
-
* Indicates if the rule is frozen (no longer accepting feature requests).
|
|
806
|
-
*/
|
|
807
|
-
frozen?: boolean | undefined;
|
|
808
|
-
}
|
|
809
|
-
/**
|
|
810
|
-
* Meta information about a rule.
|
|
811
|
-
*/
|
|
812
|
-
interface RulesMeta<MessageIds extends string = string, RuleOptions = unknown[], ExtRuleDocs = unknown> {
|
|
813
|
-
/**
|
|
814
|
-
* Properties that are used when documenting the rule.
|
|
815
|
-
*/
|
|
816
|
-
docs?: (RulesMetaDocs & ExtRuleDocs) | undefined;
|
|
817
|
-
/**
|
|
818
|
-
* The type of rule.
|
|
819
|
-
*/
|
|
820
|
-
type?: RuleType | undefined;
|
|
821
|
-
/**
|
|
822
|
-
* The schema for the rule options. Required if the rule has options.
|
|
823
|
-
*/
|
|
824
|
-
schema?: JSONSchema4 | JSONSchema4[] | false | undefined;
|
|
825
|
-
/**
|
|
826
|
-
* Any default options to be recursively merged on top of any user-provided options.
|
|
827
|
-
*/
|
|
828
|
-
defaultOptions?: RuleOptions;
|
|
829
|
-
/**
|
|
830
|
-
* The messages that the rule can report.
|
|
831
|
-
*/
|
|
832
|
-
messages?: Record<MessageIds, string>;
|
|
833
|
-
/**
|
|
834
|
-
* Indicates whether the rule has been deprecated or provides additional metadata about the deprecation. Omit if not deprecated.
|
|
835
|
-
*/
|
|
836
|
-
deprecated?: boolean | DeprecatedInfo | undefined;
|
|
837
|
-
/**
|
|
838
|
-
* @deprecated Use deprecated.replacedBy instead.
|
|
839
|
-
* The name of the rule(s) this rule was replaced by, if it was deprecated.
|
|
840
|
-
*/
|
|
841
|
-
replacedBy?: readonly string[] | undefined;
|
|
842
|
-
/**
|
|
843
|
-
* Indicates if the rule is fixable, and if so, what type of fix it provides.
|
|
844
|
-
*/
|
|
845
|
-
fixable?: RuleFixType | undefined;
|
|
846
|
-
/**
|
|
847
|
-
* Indicates if the rule may provide suggestions.
|
|
848
|
-
*/
|
|
849
|
-
hasSuggestions?: boolean | undefined;
|
|
850
|
-
/**
|
|
851
|
-
* The language the rule is intended to lint.
|
|
852
|
-
*/
|
|
853
|
-
language?: string;
|
|
854
|
-
/**
|
|
855
|
-
* The dialects of `language` that the rule is intended to lint.
|
|
856
|
-
*/
|
|
857
|
-
dialects?: string[];
|
|
858
|
-
}
|
|
859
|
-
/**
|
|
860
|
-
* Provides additional metadata about a deprecation.
|
|
861
|
-
*/
|
|
862
|
-
interface DeprecatedInfo {
|
|
863
|
-
/**
|
|
864
|
-
* General message presented to the user, e.g. for the key rule why the rule
|
|
865
|
-
* is deprecated or for info how to replace the rule.
|
|
866
|
-
*/
|
|
867
|
-
message?: string;
|
|
868
|
-
/**
|
|
869
|
-
* URL to more information about this deprecation in general.
|
|
870
|
-
*/
|
|
871
|
-
url?: string;
|
|
872
|
-
/**
|
|
873
|
-
* An empty array explicitly states that there is no replacement.
|
|
874
|
-
*/
|
|
875
|
-
replacedBy?: ReplacedByInfo[];
|
|
876
|
-
/**
|
|
877
|
-
* The package version since when the rule is deprecated (should use full
|
|
878
|
-
* semver without a leading "v").
|
|
879
|
-
*/
|
|
880
|
-
deprecatedSince?: string;
|
|
881
|
-
/**
|
|
882
|
-
* The estimated version when the rule is removed (probably the next major
|
|
883
|
-
* version). null means the rule is "frozen" (will be available but will not
|
|
884
|
-
* be changed).
|
|
885
|
-
*/
|
|
886
|
-
availableUntil?: string | null;
|
|
887
|
-
}
|
|
888
|
-
/**
|
|
889
|
-
* Provides metadata about a replacement
|
|
890
|
-
*/
|
|
891
|
-
interface ReplacedByInfo {
|
|
892
|
-
/**
|
|
893
|
-
* General message presented to the user, e.g. how to replace the rule
|
|
894
|
-
*/
|
|
895
|
-
message?: string;
|
|
896
|
-
/**
|
|
897
|
-
* URL to more information about this replacement in general
|
|
898
|
-
*/
|
|
899
|
-
url?: string;
|
|
900
|
-
/**
|
|
901
|
-
* Name should be "eslint" if the replacement is an ESLint core rule. Omit
|
|
902
|
-
* the property if the replacement is in the same plugin.
|
|
903
|
-
*/
|
|
904
|
-
plugin?: ExternalSpecifier;
|
|
905
|
-
/**
|
|
906
|
-
* Name and documentation of the replacement rule
|
|
907
|
-
*/
|
|
908
|
-
rule?: ExternalSpecifier;
|
|
909
|
-
}
|
|
910
|
-
/**
|
|
911
|
-
* Specifies the name and url of an external resource. At least one property
|
|
912
|
-
* should be set.
|
|
913
|
-
*/
|
|
914
|
-
interface ExternalSpecifier {
|
|
915
|
-
/**
|
|
916
|
-
* Name of the referenced plugin / rule.
|
|
917
|
-
*/
|
|
918
|
-
name?: string;
|
|
919
|
-
/**
|
|
920
|
-
* URL pointing to documentation for the plugin / rule.
|
|
921
|
-
*/
|
|
922
|
-
url?: string;
|
|
923
|
-
}
|
|
924
|
-
/**
|
|
925
|
-
* Generic type for `RuleContext`.
|
|
926
|
-
*/
|
|
927
|
-
interface RuleContextTypeOptions {
|
|
928
|
-
LangOptions: LanguageOptions;
|
|
929
|
-
Code: SourceCode$1;
|
|
930
|
-
RuleOptions: unknown[];
|
|
931
|
-
Node: unknown;
|
|
932
|
-
MessageIds: string;
|
|
933
|
-
}
|
|
934
|
-
/**
|
|
935
|
-
* Represents the context object that is passed to a rule. This object contains
|
|
936
|
-
* information about the current state of the linting process and is the rule's
|
|
937
|
-
* view into the outside world.
|
|
938
|
-
*/
|
|
939
|
-
interface RuleContext$1<Options extends RuleContextTypeOptions = RuleContextTypeOptions> {
|
|
940
|
-
/**
|
|
941
|
-
* The current working directory for the session.
|
|
942
|
-
*/
|
|
943
|
-
cwd: string;
|
|
944
|
-
/**
|
|
945
|
-
* Returns the current working directory for the session.
|
|
946
|
-
* @deprecated Use `cwd` instead.
|
|
947
|
-
*/
|
|
948
|
-
getCwd(): string;
|
|
949
|
-
/**
|
|
950
|
-
* The filename of the file being linted.
|
|
951
|
-
*/
|
|
952
|
-
filename: string;
|
|
953
|
-
/**
|
|
954
|
-
* Returns the filename of the file being linted.
|
|
955
|
-
* @deprecated Use `filename` instead.
|
|
956
|
-
*/
|
|
957
|
-
getFilename(): string;
|
|
958
|
-
/**
|
|
959
|
-
* The physical filename of the file being linted.
|
|
960
|
-
*/
|
|
961
|
-
physicalFilename: string;
|
|
962
|
-
/**
|
|
963
|
-
* Returns the physical filename of the file being linted.
|
|
964
|
-
* @deprecated Use `physicalFilename` instead.
|
|
965
|
-
*/
|
|
966
|
-
getPhysicalFilename(): string;
|
|
967
|
-
/**
|
|
968
|
-
* The source code object that the rule is running on.
|
|
969
|
-
*/
|
|
970
|
-
sourceCode: Options["Code"];
|
|
971
|
-
/**
|
|
972
|
-
* Returns the source code object that the rule is running on.
|
|
973
|
-
* @deprecated Use `sourceCode` instead.
|
|
974
|
-
*/
|
|
975
|
-
getSourceCode(): Options["Code"];
|
|
976
|
-
/**
|
|
977
|
-
* Shared settings for the configuration.
|
|
978
|
-
*/
|
|
979
|
-
settings: SettingsConfig;
|
|
980
|
-
/**
|
|
981
|
-
* Parser-specific options for the configuration.
|
|
982
|
-
* @deprecated Use `languageOptions.parserOptions` instead.
|
|
983
|
-
*/
|
|
984
|
-
parserOptions: Record<string, unknown>;
|
|
985
|
-
/**
|
|
986
|
-
* The language options for the configuration.
|
|
987
|
-
*/
|
|
988
|
-
languageOptions: Options["LangOptions"];
|
|
989
|
-
/**
|
|
990
|
-
* The CommonJS path to the parser used while parsing this file.
|
|
991
|
-
* @deprecated No longer used.
|
|
992
|
-
*/
|
|
993
|
-
parserPath: string | undefined;
|
|
994
|
-
/**
|
|
995
|
-
* The rule ID.
|
|
996
|
-
*/
|
|
997
|
-
id: string;
|
|
998
|
-
/**
|
|
999
|
-
* The rule's configured options.
|
|
1000
|
-
*/
|
|
1001
|
-
options: Options["RuleOptions"];
|
|
1002
|
-
/**
|
|
1003
|
-
* The report function that the rule should use to report problems.
|
|
1004
|
-
* @param violation The violation to report.
|
|
1005
|
-
*/
|
|
1006
|
-
report(violation: ViolationReport<Options["Node"], Options["MessageIds"]>): void;
|
|
1007
|
-
}
|
|
1008
|
-
/**
|
|
1009
|
-
* Manager of text edits for a rule fix.
|
|
1010
|
-
*/
|
|
1011
|
-
interface RuleTextEditor<EditableSyntaxElement = unknown> {
|
|
1012
|
-
/**
|
|
1013
|
-
* Inserts text after the specified node or token.
|
|
1014
|
-
* @param syntaxElement The node or token to insert after.
|
|
1015
|
-
* @param text The edit to insert after the node or token.
|
|
1016
|
-
*/
|
|
1017
|
-
insertTextAfter(syntaxElement: EditableSyntaxElement, text: string): RuleTextEdit;
|
|
1018
|
-
/**
|
|
1019
|
-
* Inserts text after the specified range.
|
|
1020
|
-
* @param range The range to insert after.
|
|
1021
|
-
* @param text The edit to insert after the range.
|
|
1022
|
-
*/
|
|
1023
|
-
insertTextAfterRange(range: SourceRange, text: string): RuleTextEdit;
|
|
1024
|
-
/**
|
|
1025
|
-
* Inserts text before the specified node or token.
|
|
1026
|
-
* @param syntaxElement A syntax element with location information to insert before.
|
|
1027
|
-
* @param text The edit to insert before the node or token.
|
|
1028
|
-
*/
|
|
1029
|
-
insertTextBefore(syntaxElement: EditableSyntaxElement, text: string): RuleTextEdit;
|
|
1030
|
-
/**
|
|
1031
|
-
* Inserts text before the specified range.
|
|
1032
|
-
* @param range The range to insert before.
|
|
1033
|
-
* @param text The edit to insert before the range.
|
|
1034
|
-
*/
|
|
1035
|
-
insertTextBeforeRange(range: SourceRange, text: string): RuleTextEdit;
|
|
1036
|
-
/**
|
|
1037
|
-
* Removes the specified node or token.
|
|
1038
|
-
* @param syntaxElement A syntax element with location information to remove.
|
|
1039
|
-
* @returns The edit to remove the node or token.
|
|
1040
|
-
*/
|
|
1041
|
-
remove(syntaxElement: EditableSyntaxElement): RuleTextEdit;
|
|
1042
|
-
/**
|
|
1043
|
-
* Removes the specified range.
|
|
1044
|
-
* @param range The range to remove.
|
|
1045
|
-
* @returns The edit to remove the range.
|
|
1046
|
-
*/
|
|
1047
|
-
removeRange(range: SourceRange): RuleTextEdit;
|
|
1048
|
-
/**
|
|
1049
|
-
* Replaces the specified node or token with the given text.
|
|
1050
|
-
* @param syntaxElement A syntax element with location information to replace.
|
|
1051
|
-
* @param text The text to replace the node or token with.
|
|
1052
|
-
* @returns The edit to replace the node or token.
|
|
1053
|
-
*/
|
|
1054
|
-
replaceText(syntaxElement: EditableSyntaxElement, text: string): RuleTextEdit;
|
|
1055
|
-
/**
|
|
1056
|
-
* Replaces the specified range with the given text.
|
|
1057
|
-
* @param range The range to replace.
|
|
1058
|
-
* @param text The text to replace the range with.
|
|
1059
|
-
* @returns The edit to replace the range.
|
|
1060
|
-
*/
|
|
1061
|
-
replaceTextRange(range: SourceRange, text: string): RuleTextEdit;
|
|
1062
|
-
}
|
|
1063
|
-
/**
|
|
1064
|
-
* Represents a fix for a rule violation implemented as a text edit.
|
|
1065
|
-
*/
|
|
1066
|
-
interface RuleTextEdit {
|
|
1067
|
-
/**
|
|
1068
|
-
* The range to replace.
|
|
1069
|
-
*/
|
|
1070
|
-
range: SourceRange;
|
|
1071
|
-
/**
|
|
1072
|
-
* The text to insert.
|
|
1073
|
-
*/
|
|
1074
|
-
text: string;
|
|
1075
|
-
}
|
|
1076
|
-
/**
|
|
1077
|
-
* Fixes a violation.
|
|
1078
|
-
* @param fixer The text editor to apply the fix.
|
|
1079
|
-
* @returns The fix(es) for the violation.
|
|
1080
|
-
*/
|
|
1081
|
-
type RuleFixer = (fixer: RuleTextEditor) => RuleTextEdit | Iterable<RuleTextEdit> | null;
|
|
1082
|
-
interface ViolationReportBase {
|
|
1083
|
-
/**
|
|
1084
|
-
* The data to insert into the message.
|
|
1085
|
-
*/
|
|
1086
|
-
data?: Record<string, unknown> | undefined;
|
|
1087
|
-
/**
|
|
1088
|
-
* The fix to be applied for the violation.
|
|
1089
|
-
*/
|
|
1090
|
-
fix?: RuleFixer | null | undefined;
|
|
1091
|
-
/**
|
|
1092
|
-
* An array of suggested fixes for the problem. These fixes may change the
|
|
1093
|
-
* behavior of the code, so they are not applied automatically.
|
|
1094
|
-
*/
|
|
1095
|
-
suggest?: SuggestedEdit[] | null | undefined;
|
|
1096
|
-
}
|
|
1097
|
-
type ViolationMessage<MessageIds = string> = {
|
|
1098
|
-
message: string;
|
|
1099
|
-
} | {
|
|
1100
|
-
messageId: MessageIds;
|
|
1101
|
-
};
|
|
1102
|
-
type ViolationLocation<Node> = {
|
|
1103
|
-
loc: SourceLocation$1 | Position;
|
|
1104
|
-
} | {
|
|
1105
|
-
node: Node;
|
|
1106
|
-
};
|
|
1107
|
-
type ViolationReport<Node = unknown, MessageIds = string> = ViolationReportBase & ViolationMessage<MessageIds> & ViolationLocation<Node>;
|
|
1108
|
-
interface SuggestedEditBase {
|
|
1109
|
-
/**
|
|
1110
|
-
* The data to insert into the message.
|
|
1111
|
-
*/
|
|
1112
|
-
data?: Record<string, unknown> | undefined;
|
|
1113
|
-
/**
|
|
1114
|
-
* The fix to be applied for the suggestion.
|
|
1115
|
-
*/
|
|
1116
|
-
fix: RuleFixer;
|
|
1117
|
-
}
|
|
1118
|
-
type SuggestionMessage = {
|
|
1119
|
-
desc: string;
|
|
1120
|
-
} | {
|
|
1121
|
-
messageId: string;
|
|
1122
|
-
};
|
|
1123
|
-
/**
|
|
1124
|
-
* A suggested edit for a rule violation.
|
|
1125
|
-
*/
|
|
1126
|
-
type SuggestedEdit = SuggestedEditBase & SuggestionMessage;
|
|
1127
|
-
/**
|
|
1128
|
-
* The normalized version of a lint suggestion.
|
|
1129
|
-
*/
|
|
1130
|
-
interface LintSuggestion {
|
|
1131
|
-
/** A short description. */
|
|
1132
|
-
desc: string;
|
|
1133
|
-
/** Fix result info. */
|
|
1134
|
-
fix: RuleTextEdit;
|
|
1135
|
-
/** Id referencing a message for the description. */
|
|
1136
|
-
messageId?: string | undefined;
|
|
1137
|
-
}
|
|
1138
|
-
/**
|
|
1139
|
-
* The normalized version of a lint violation message.
|
|
1140
|
-
*/
|
|
1141
|
-
interface LintMessage$1 {
|
|
1142
|
-
/** The 1-based column number. */
|
|
1143
|
-
column: number;
|
|
1144
|
-
/** The 1-based line number. */
|
|
1145
|
-
line: number;
|
|
1146
|
-
/** The 1-based column number of the end location. */
|
|
1147
|
-
endColumn?: number | undefined;
|
|
1148
|
-
/** The 1-based line number of the end location. */
|
|
1149
|
-
endLine?: number | undefined;
|
|
1150
|
-
/** The ID of the rule which makes this message. */
|
|
1151
|
-
ruleId: string | null;
|
|
1152
|
-
/** The reported message. */
|
|
1153
|
-
message: string;
|
|
1154
|
-
/** The ID of the message in the rule's meta. */
|
|
1155
|
-
messageId?: string | undefined;
|
|
1156
|
-
/**
|
|
1157
|
-
* Type of node.
|
|
1158
|
-
* @deprecated `nodeType` is deprecated and will be removed in the next major version.
|
|
1159
|
-
*/
|
|
1160
|
-
nodeType?: string | undefined;
|
|
1161
|
-
/** If `true` then this is a fatal error. */
|
|
1162
|
-
fatal?: true | undefined;
|
|
1163
|
-
/** The severity of this message. */
|
|
1164
|
-
severity: Exclude<SeverityLevel, 0>;
|
|
1165
|
-
/** Information for autofix. */
|
|
1166
|
-
fix?: RuleTextEdit | undefined;
|
|
1167
|
-
/** Information for suggestions. */
|
|
1168
|
-
suggestions?: LintSuggestion[] | undefined;
|
|
1169
|
-
}
|
|
1170
|
-
/**
|
|
1171
|
-
* Generic options for the `RuleDefinition` type.
|
|
1172
|
-
*/
|
|
1173
|
-
interface RuleDefinitionTypeOptions {
|
|
1174
|
-
LangOptions: LanguageOptions;
|
|
1175
|
-
Code: SourceCode$1;
|
|
1176
|
-
RuleOptions: unknown[];
|
|
1177
|
-
Visitor: RuleVisitor;
|
|
1178
|
-
Node: unknown;
|
|
1179
|
-
MessageIds: string;
|
|
1180
|
-
ExtRuleDocs: unknown;
|
|
1181
|
-
}
|
|
1182
|
-
/**
|
|
1183
|
-
* The definition of an ESLint rule.
|
|
1184
|
-
*/
|
|
1185
|
-
interface RuleDefinition<Options extends RuleDefinitionTypeOptions = RuleDefinitionTypeOptions> {
|
|
1186
|
-
/**
|
|
1187
|
-
* The meta information for the rule.
|
|
1188
|
-
*/
|
|
1189
|
-
meta?: RulesMeta<Options["MessageIds"], Options["RuleOptions"], Options["ExtRuleDocs"]>;
|
|
1190
|
-
/**
|
|
1191
|
-
* Creates the visitor that ESLint uses to apply the rule during traversal.
|
|
1192
|
-
* @param context The rule context.
|
|
1193
|
-
* @returns The rule visitor.
|
|
1194
|
-
*/
|
|
1195
|
-
create(context: RuleContext$1<{
|
|
1196
|
-
LangOptions: Options["LangOptions"];
|
|
1197
|
-
Code: Options["Code"];
|
|
1198
|
-
RuleOptions: Options["RuleOptions"];
|
|
1199
|
-
Node: Options["Node"];
|
|
1200
|
-
MessageIds: Options["MessageIds"];
|
|
1201
|
-
}>): Options["Visitor"];
|
|
1202
|
-
}
|
|
1203
|
-
/**
|
|
1204
|
-
* The human readable severity level used in a configuration.
|
|
1205
|
-
*/
|
|
1206
|
-
type SeverityName = "off" | "warn" | "error";
|
|
1207
|
-
/**
|
|
1208
|
-
* The numeric severity level for a rule.
|
|
1209
|
-
*
|
|
1210
|
-
* - `0` means off.
|
|
1211
|
-
* - `1` means warn.
|
|
1212
|
-
* - `2` means error.
|
|
1213
|
-
*/
|
|
1214
|
-
type SeverityLevel = 0 | 1 | 2;
|
|
1215
|
-
/**
|
|
1216
|
-
* The severity of a rule in a configuration.
|
|
1217
|
-
*/
|
|
1218
|
-
type Severity = SeverityName | SeverityLevel;
|
|
1219
|
-
/**
|
|
1220
|
-
* Represents the metadata for an object, such as a plugin or processor.
|
|
1221
|
-
*/
|
|
1222
|
-
interface ObjectMetaProperties {
|
|
1223
|
-
/** @deprecated Use `meta.name` instead. */
|
|
1224
|
-
name?: string | undefined;
|
|
1225
|
-
/** @deprecated Use `meta.version` instead. */
|
|
1226
|
-
version?: string | undefined;
|
|
1227
|
-
meta?: {
|
|
1228
|
-
name?: string | undefined;
|
|
1229
|
-
version?: string | undefined;
|
|
1230
|
-
};
|
|
1231
|
-
}
|
|
1232
|
-
/**
|
|
1233
|
-
* Represents the configuration options for the core linter.
|
|
1234
|
-
*/
|
|
1235
|
-
interface LinterOptionsConfig {
|
|
1236
|
-
/**
|
|
1237
|
-
* Indicates whether or not inline configuration is evaluated.
|
|
1238
|
-
*/
|
|
1239
|
-
noInlineConfig?: boolean;
|
|
1240
|
-
/**
|
|
1241
|
-
* Indicates what to do when an unused disable directive is found.
|
|
1242
|
-
*/
|
|
1243
|
-
reportUnusedDisableDirectives?: boolean | Severity;
|
|
1244
|
-
/**
|
|
1245
|
-
* A severity value indicating if and how unused inline configs should be
|
|
1246
|
-
* tracked and reported.
|
|
1247
|
-
*/
|
|
1248
|
-
reportUnusedInlineConfigs?: Severity;
|
|
1249
|
-
}
|
|
1250
|
-
/**
|
|
1251
|
-
* The configuration for a rule.
|
|
1252
|
-
*/
|
|
1253
|
-
type RuleConfig<RuleOptions extends unknown[] = unknown[]> = Severity | [Severity, ...Partial<RuleOptions>];
|
|
1254
|
-
/**
|
|
1255
|
-
* A collection of rules and their configurations.
|
|
1256
|
-
*/
|
|
1257
|
-
interface RulesConfig {
|
|
1258
|
-
[key: string]: RuleConfig;
|
|
1259
|
-
}
|
|
1260
|
-
/**
|
|
1261
|
-
* A collection of settings.
|
|
1262
|
-
*/
|
|
1263
|
-
interface SettingsConfig {
|
|
1264
|
-
[key: string]: unknown;
|
|
1265
|
-
}
|
|
1266
|
-
/**
|
|
1267
|
-
* The configuration for a set of files.
|
|
1268
|
-
*/
|
|
1269
|
-
interface ConfigObject<Rules extends RulesConfig = RulesConfig> {
|
|
1270
|
-
/**
|
|
1271
|
-
* A string to identify the configuration object. Used in error messages and
|
|
1272
|
-
* inspection tools.
|
|
1273
|
-
*/
|
|
1274
|
-
name?: string;
|
|
1275
|
-
/**
|
|
1276
|
-
* Path to the directory where the configuration object should apply.
|
|
1277
|
-
* `files` and `ignores` patterns in the configuration object are
|
|
1278
|
-
* interpreted as relative to this path.
|
|
1279
|
-
*/
|
|
1280
|
-
basePath?: string;
|
|
1281
|
-
/**
|
|
1282
|
-
* An array of glob patterns indicating the files that the configuration
|
|
1283
|
-
* object should apply to. If not specified, the configuration object applies
|
|
1284
|
-
* to all files
|
|
1285
|
-
*/
|
|
1286
|
-
files?: (string | string[])[];
|
|
1287
|
-
/**
|
|
1288
|
-
* An array of glob patterns indicating the files that the configuration
|
|
1289
|
-
* object should not apply to. If not specified, the configuration object
|
|
1290
|
-
* applies to all files matched by files
|
|
1291
|
-
*/
|
|
1292
|
-
ignores?: string[];
|
|
1293
|
-
/**
|
|
1294
|
-
* The name of the language used for linting. This is used to determine the
|
|
1295
|
-
* parser and other language-specific settings.
|
|
1296
|
-
* @since 9.7.0
|
|
1297
|
-
*/
|
|
1298
|
-
language?: string;
|
|
1299
|
-
/**
|
|
1300
|
-
* An object containing settings related to how the language is configured for
|
|
1301
|
-
* linting.
|
|
1302
|
-
*/
|
|
1303
|
-
languageOptions?: LanguageOptions;
|
|
1304
|
-
/**
|
|
1305
|
-
* An object containing settings related to the linting process
|
|
1306
|
-
*/
|
|
1307
|
-
linterOptions?: LinterOptionsConfig;
|
|
1308
|
-
/**
|
|
1309
|
-
* Either an object containing preprocess() and postprocess() methods or a
|
|
1310
|
-
* string indicating the name of a processor inside of a plugin
|
|
1311
|
-
* (i.e., "pluginName/processorName").
|
|
1312
|
-
*/
|
|
1313
|
-
processor?: string | Processor;
|
|
1314
|
-
/**
|
|
1315
|
-
* An object containing a name-value mapping of plugin names to plugin objects.
|
|
1316
|
-
* When files is specified, these plugins are only available to the matching files.
|
|
1317
|
-
*/
|
|
1318
|
-
plugins?: Record<string, Plugin$1>;
|
|
1319
|
-
/**
|
|
1320
|
-
* An object containing the configured rules. When files or ignores are specified,
|
|
1321
|
-
* these rule configurations are only available to the matching files.
|
|
1322
|
-
*/
|
|
1323
|
-
rules?: Partial<Rules>;
|
|
1324
|
-
/**
|
|
1325
|
-
* An object containing name-value pairs of information that should be
|
|
1326
|
-
* available to all rules.
|
|
1327
|
-
*/
|
|
1328
|
-
settings?: Record<string, unknown>;
|
|
1329
|
-
}
|
|
1330
|
-
/** @deprecated Only supported in legacy eslintrc config format. */
|
|
1331
|
-
type GlobalAccess = boolean | "off" | "readable" | "readonly" | "writable" | "writeable";
|
|
1332
|
-
/** @deprecated Only supported in legacy eslintrc config format. */
|
|
1333
|
-
interface GlobalsConfig {
|
|
1334
|
-
[name: string]: GlobalAccess;
|
|
1335
|
-
}
|
|
1336
|
-
/**
|
|
1337
|
-
* The ECMAScript version of the code being linted.
|
|
1338
|
-
* @deprecated Only supported in legacy eslintrc config format.
|
|
1339
|
-
*/
|
|
1340
|
-
type EcmaVersion$1 = 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 2015 | 2016 | 2017 | 2018 | 2019 | 2020 | 2021 | 2022 | 2023 | 2024 | 2025 | 2026 | "latest";
|
|
1341
|
-
/**
|
|
1342
|
-
* The type of JavaScript source code.
|
|
1343
|
-
* @deprecated Only supported in legacy eslintrc config format.
|
|
1344
|
-
*/
|
|
1345
|
-
type JavaScriptSourceType = "script" | "module" | "commonjs";
|
|
1346
|
-
/**
|
|
1347
|
-
* Parser options.
|
|
1348
|
-
* @deprecated Only supported in legacy eslintrc config format.
|
|
1349
|
-
* @see [Specifying Parser Options](https://eslint.org/docs/latest/use/configure/language-options#specifying-parser-options)
|
|
1350
|
-
*/
|
|
1351
|
-
interface JavaScriptParserOptionsConfig {
|
|
1352
|
-
/**
|
|
1353
|
-
* Allow the use of reserved words as identifiers (if `ecmaVersion` is 3).
|
|
1354
|
-
*
|
|
1355
|
-
* @default false
|
|
1356
|
-
*/
|
|
1357
|
-
allowReserved?: boolean | undefined;
|
|
1358
|
-
/**
|
|
1359
|
-
* Accepts any valid ECMAScript version number or `'latest'`:
|
|
1360
|
-
*
|
|
1361
|
-
* - A version: es3, es5, es6, es7, es8, es9, es10, es11, es12, es13, es14, ..., or
|
|
1362
|
-
* - A year: es2015, es2016, es2017, es2018, es2019, es2020, es2021, es2022, es2023, ..., or
|
|
1363
|
-
* - `'latest'`
|
|
1364
|
-
*
|
|
1365
|
-
* When it's a version or a year, the value must be a number - so do not include the `es` prefix.
|
|
1366
|
-
*
|
|
1367
|
-
* Specifies the version of ECMAScript syntax you want to use. This is used by the parser to determine how to perform scope analysis, and it affects the default
|
|
1368
|
-
*
|
|
1369
|
-
* @default 5
|
|
1370
|
-
*/
|
|
1371
|
-
ecmaVersion?: EcmaVersion$1 | undefined;
|
|
1372
|
-
/**
|
|
1373
|
-
* The type of JavaScript source code. Possible values are "script" for
|
|
1374
|
-
* traditional script files, "module" for ECMAScript modules (ESM), and
|
|
1375
|
-
* "commonjs" for CommonJS files.
|
|
1376
|
-
*
|
|
1377
|
-
* @default 'script'
|
|
1378
|
-
*
|
|
1379
|
-
* @see https://eslint.org/docs/latest/use/configure/language-options-deprecated#specifying-parser-options
|
|
1380
|
-
*/
|
|
1381
|
-
sourceType?: JavaScriptSourceType | undefined;
|
|
1382
|
-
/**
|
|
1383
|
-
* An object indicating which additional language features you'd like to use.
|
|
1384
|
-
*
|
|
1385
|
-
* @see https://eslint.org/docs/latest/use/configure/language-options-deprecated#specifying-parser-options
|
|
1386
|
-
*/
|
|
1387
|
-
ecmaFeatures?: {
|
|
1388
|
-
globalReturn?: boolean | undefined;
|
|
1389
|
-
impliedStrict?: boolean | undefined;
|
|
1390
|
-
jsx?: boolean | undefined;
|
|
1391
|
-
experimentalObjectRestSpread?: boolean | undefined;
|
|
1392
|
-
[key: string]: any;
|
|
1393
|
-
} | undefined;
|
|
1394
|
-
[key: string]: any;
|
|
1395
|
-
}
|
|
1396
|
-
/** @deprecated Only supported in legacy eslintrc config format. */
|
|
1397
|
-
interface EnvironmentConfig {
|
|
1398
|
-
/** The definition of global variables. */
|
|
1399
|
-
globals?: GlobalsConfig | undefined;
|
|
1400
|
-
/** The parser options that will be enabled under this environment. */
|
|
1401
|
-
parserOptions?: JavaScriptParserOptionsConfig | undefined;
|
|
1402
|
-
}
|
|
1403
|
-
/**
|
|
1404
|
-
* A configuration object that may have a `rules` block.
|
|
1405
|
-
*/
|
|
1406
|
-
interface HasRules<Rules extends RulesConfig = RulesConfig> {
|
|
1407
|
-
rules?: Partial<Rules> | undefined;
|
|
1408
|
-
}
|
|
1409
|
-
/**
|
|
1410
|
-
* ESLint legacy configuration.
|
|
1411
|
-
*
|
|
1412
|
-
* @see [ESLint Legacy Configuration](https://eslint.org/docs/latest/use/configure/)
|
|
1413
|
-
*/
|
|
1414
|
-
interface BaseConfig<Rules extends RulesConfig = RulesConfig, OverrideRules extends RulesConfig = Rules> extends HasRules<Rules> {
|
|
1415
|
-
$schema?: string | undefined;
|
|
1416
|
-
/**
|
|
1417
|
-
* An environment provides predefined global variables.
|
|
1418
|
-
*
|
|
1419
|
-
* @see [Environments](https://eslint.org/docs/latest/use/configure/language-options-deprecated#specifying-environments)
|
|
1420
|
-
*/
|
|
1421
|
-
env?: {
|
|
1422
|
-
[name: string]: boolean;
|
|
1423
|
-
} | undefined;
|
|
1424
|
-
/**
|
|
1425
|
-
* Extending configuration files.
|
|
1426
|
-
*
|
|
1427
|
-
* @see [Extends](https://eslint.org/docs/latest/use/configure/configuration-files-deprecated#extending-configuration-files)
|
|
1428
|
-
*/
|
|
1429
|
-
extends?: string | string[] | undefined;
|
|
1430
|
-
/**
|
|
1431
|
-
* Specifying globals.
|
|
1432
|
-
*
|
|
1433
|
-
* @see [Globals](https://eslint.org/docs/latest/use/configure/language-options-deprecated#specifying-globals)
|
|
1434
|
-
*/
|
|
1435
|
-
globals?: GlobalsConfig | undefined;
|
|
1436
|
-
/**
|
|
1437
|
-
* Disable processing of inline comments.
|
|
1438
|
-
*
|
|
1439
|
-
* @see [Disabling Inline Comments](https://eslint.org/docs/latest/use/configure/rules-deprecated#disabling-inline-comments)
|
|
1440
|
-
*/
|
|
1441
|
-
noInlineConfig?: boolean | undefined;
|
|
1442
|
-
/**
|
|
1443
|
-
* Overrides can be used to use a differing configuration for matching sub-directories and files.
|
|
1444
|
-
*
|
|
1445
|
-
* @see [How do overrides work](https://eslint.org/docs/latest/use/configure/configuration-files-deprecated#how-do-overrides-work)
|
|
1446
|
-
*/
|
|
1447
|
-
overrides?: ConfigOverride<OverrideRules>[] | undefined;
|
|
1448
|
-
/**
|
|
1449
|
-
* Parser.
|
|
1450
|
-
*
|
|
1451
|
-
* @see [Working with Custom Parsers](https://eslint.org/docs/latest/extend/custom-parsers)
|
|
1452
|
-
* @see [Specifying Parser](https://eslint.org/docs/latest/use/configure/parser-deprecated)
|
|
1453
|
-
*/
|
|
1454
|
-
parser?: string | undefined;
|
|
1455
|
-
/**
|
|
1456
|
-
* Parser options.
|
|
1457
|
-
*
|
|
1458
|
-
* @see [Working with Custom Parsers](https://eslint.org/docs/latest/extend/custom-parsers)
|
|
1459
|
-
* @see [Specifying Parser Options](https://eslint.org/docs/latest/use/configure/language-options-deprecated#specifying-parser-options)
|
|
1460
|
-
*/
|
|
1461
|
-
parserOptions?: JavaScriptParserOptionsConfig | undefined;
|
|
1462
|
-
/**
|
|
1463
|
-
* Which third-party plugins define additional rules, environments, configs, etc. for ESLint to use.
|
|
1464
|
-
*
|
|
1465
|
-
* @see [Configuring Plugins](https://eslint.org/docs/latest/use/configure/plugins-deprecated#configure-plugins)
|
|
1466
|
-
*/
|
|
1467
|
-
plugins?: string[] | undefined;
|
|
1468
|
-
/**
|
|
1469
|
-
* Specifying processor.
|
|
1470
|
-
*
|
|
1471
|
-
* @see [processor](https://eslint.org/docs/latest/use/configure/plugins-deprecated#specify-a-processor)
|
|
1472
|
-
*/
|
|
1473
|
-
processor?: string | undefined;
|
|
1474
|
-
/**
|
|
1475
|
-
* Report unused eslint-disable comments as warning.
|
|
1476
|
-
*
|
|
1477
|
-
* @see [Report unused eslint-disable comments](https://eslint.org/docs/latest/use/configure/rules-deprecated#report-unused-eslint-disable-comments)
|
|
1478
|
-
*/
|
|
1479
|
-
reportUnusedDisableDirectives?: boolean | undefined;
|
|
1480
|
-
/**
|
|
1481
|
-
* Settings.
|
|
1482
|
-
*
|
|
1483
|
-
* @see [Settings](https://eslint.org/docs/latest/use/configure/configuration-files-deprecated#adding-shared-settings)
|
|
1484
|
-
*/
|
|
1485
|
-
settings?: SettingsConfig | undefined;
|
|
1486
|
-
}
|
|
1487
|
-
/**
|
|
1488
|
-
* The overwrites that apply more differing configuration to specific files or directories.
|
|
1489
|
-
*/
|
|
1490
|
-
interface ConfigOverride<Rules extends RulesConfig = RulesConfig> extends BaseConfig<Rules> {
|
|
1491
|
-
/**
|
|
1492
|
-
* The glob patterns for excluded files.
|
|
1493
|
-
*/
|
|
1494
|
-
excludedFiles?: string | string[] | undefined;
|
|
1495
|
-
/**
|
|
1496
|
-
* The glob patterns for target files.
|
|
1497
|
-
*/
|
|
1498
|
-
files: string | string[];
|
|
1499
|
-
}
|
|
1
|
+
//#region src/types.d.ts
|
|
1500
2
|
/**
|
|
1501
|
-
* ESLint
|
|
3
|
+
* ESLint type definitions compatible with ESLint 9 and 10.
|
|
4
|
+
* Based on @eslint/core types to avoid direct eslint dependency.
|
|
1502
5
|
*
|
|
1503
|
-
*
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
/**
|
|
1507
|
-
* Tell ESLint to ignore specific files and directories.
|
|
1508
|
-
*
|
|
1509
|
-
* @see [Ignore Patterns](https://eslint.org/docs/latest/use/configure/ignore-deprecated#ignorepatterns-in-config-files)
|
|
1510
|
-
*/
|
|
1511
|
-
ignorePatterns?: string | string[] | undefined;
|
|
1512
|
-
/**
|
|
1513
|
-
* @see [Using Configuration Files](https://eslint.org/docs/latest/use/configure/configuration-files-deprecated#using-configuration-files)
|
|
1514
|
-
*/
|
|
1515
|
-
root?: boolean | undefined;
|
|
1516
|
-
}
|
|
1517
|
-
/**
|
|
1518
|
-
* File information passed to a processor.
|
|
1519
|
-
*/
|
|
1520
|
-
interface ProcessorFile$1 {
|
|
1521
|
-
text: string;
|
|
1522
|
-
filename: string;
|
|
1523
|
-
}
|
|
1524
|
-
/**
|
|
1525
|
-
* A processor is an object that can preprocess and postprocess files.
|
|
1526
|
-
*/
|
|
1527
|
-
interface Processor<T extends string | ProcessorFile$1 = string | ProcessorFile$1> extends ObjectMetaProperties {
|
|
1528
|
-
/** If `true` then it means the processor supports autofix. */
|
|
1529
|
-
supportsAutofix?: boolean | undefined;
|
|
1530
|
-
/** The function to extract code blocks. */
|
|
1531
|
-
preprocess?(text: string, filename: string): T[];
|
|
1532
|
-
/** The function to merge messages. */
|
|
1533
|
-
postprocess?(messages: LintMessage$1[][], filename: string): LintMessage$1[];
|
|
1534
|
-
}
|
|
1535
|
-
interface Plugin$1 extends ObjectMetaProperties {
|
|
1536
|
-
meta?: ObjectMetaProperties["meta"] & {
|
|
1537
|
-
namespace?: string | undefined;
|
|
1538
|
-
};
|
|
1539
|
-
configs?: Record<string, LegacyConfigObject | ConfigObject | ConfigObject[]> | undefined;
|
|
1540
|
-
environments?: Record<string, EnvironmentConfig> | undefined;
|
|
1541
|
-
languages?: Record<string, Language> | undefined;
|
|
1542
|
-
processors?: Record<string, Processor> | undefined;
|
|
1543
|
-
rules?: Record<string, RuleDefinition> | undefined;
|
|
1544
|
-
}
|
|
1545
|
-
/**
|
|
1546
|
-
* Generic options for the `Language` type.
|
|
1547
|
-
*/
|
|
1548
|
-
interface LanguageTypeOptions {
|
|
1549
|
-
LangOptions: LanguageOptions;
|
|
1550
|
-
Code: SourceCode$1;
|
|
1551
|
-
RootNode: unknown;
|
|
1552
|
-
Node: unknown;
|
|
1553
|
-
}
|
|
1554
|
-
/**
|
|
1555
|
-
* Represents a plugin language.
|
|
1556
|
-
*/
|
|
1557
|
-
interface Language<Options extends LanguageTypeOptions = {
|
|
1558
|
-
LangOptions: LanguageOptions;
|
|
1559
|
-
Code: SourceCode$1;
|
|
1560
|
-
RootNode: unknown;
|
|
1561
|
-
Node: unknown;
|
|
1562
|
-
}> {
|
|
1563
|
-
/**
|
|
1564
|
-
* Indicates how ESLint should read the file.
|
|
1565
|
-
*/
|
|
1566
|
-
fileType: "text";
|
|
1567
|
-
/**
|
|
1568
|
-
* First line number returned from the parser (text mode only).
|
|
1569
|
-
*/
|
|
1570
|
-
lineStart: 0 | 1;
|
|
1571
|
-
/**
|
|
1572
|
-
* First column number returned from the parser (text mode only).
|
|
1573
|
-
*/
|
|
1574
|
-
columnStart: 0 | 1;
|
|
1575
|
-
/**
|
|
1576
|
-
* The property to read the node type from. Used in selector querying.
|
|
1577
|
-
*/
|
|
1578
|
-
nodeTypeKey: string;
|
|
1579
|
-
/**
|
|
1580
|
-
* The traversal path that tools should take when evaluating the AST
|
|
1581
|
-
*/
|
|
1582
|
-
visitorKeys?: Record<string, string[]>;
|
|
1583
|
-
/**
|
|
1584
|
-
* Default language options. User-defined options are merged with this object.
|
|
1585
|
-
*/
|
|
1586
|
-
defaultLanguageOptions?: LanguageOptions;
|
|
1587
|
-
/**
|
|
1588
|
-
* Validates languageOptions for this language.
|
|
1589
|
-
*/
|
|
1590
|
-
validateLanguageOptions(languageOptions: Options["LangOptions"]): void;
|
|
1591
|
-
/**
|
|
1592
|
-
* Normalizes languageOptions for this language.
|
|
1593
|
-
*/
|
|
1594
|
-
normalizeLanguageOptions?(languageOptions: Options["LangOptions"]): Options["LangOptions"];
|
|
1595
|
-
/**
|
|
1596
|
-
* Helper for esquery that allows languages to match nodes against
|
|
1597
|
-
* class. esquery currently has classes like `function` that will
|
|
1598
|
-
* match all the various function nodes. This method allows languages
|
|
1599
|
-
* to implement similar shorthands.
|
|
1600
|
-
*/
|
|
1601
|
-
matchesSelectorClass?(className: string, node: Options["Node"], ancestry: Options["Node"][]): boolean;
|
|
1602
|
-
/**
|
|
1603
|
-
* Parses the given file input into its component parts. This file should not
|
|
1604
|
-
* throws errors for parsing errors but rather should return any parsing
|
|
1605
|
-
* errors as parse of the ParseResult object.
|
|
1606
|
-
*/
|
|
1607
|
-
parse(file: File, context: LanguageContext<Options["LangOptions"]>): ParseResult<Options["RootNode"]>;
|
|
1608
|
-
/**
|
|
1609
|
-
* Creates SourceCode object that ESLint uses to work with a file.
|
|
1610
|
-
*/
|
|
1611
|
-
createSourceCode(file: File, input: OkParseResult<Options["RootNode"]>, context: LanguageContext<Options["LangOptions"]>): Options["Code"];
|
|
1612
|
-
}
|
|
1613
|
-
/**
|
|
1614
|
-
* Plugin-defined options for the language.
|
|
1615
|
-
*/
|
|
1616
|
-
type LanguageOptions = Record<string, unknown>;
|
|
1617
|
-
/**
|
|
1618
|
-
* The context object that is passed to the language plugin methods.
|
|
1619
|
-
*/
|
|
1620
|
-
interface LanguageContext<LangOptions = LanguageOptions> {
|
|
1621
|
-
languageOptions: LangOptions;
|
|
1622
|
-
}
|
|
1623
|
-
/**
|
|
1624
|
-
* Represents a file read by ESLint.
|
|
1625
|
-
*/
|
|
1626
|
-
interface File {
|
|
1627
|
-
/**
|
|
1628
|
-
* The path that ESLint uses for this file. May be a virtual path
|
|
1629
|
-
* if it was returned by a processor.
|
|
1630
|
-
*/
|
|
1631
|
-
path: string;
|
|
1632
|
-
/**
|
|
1633
|
-
* The path to the file on disk. This always maps directly to a file
|
|
1634
|
-
* regardless of whether it was returned from a processor.
|
|
1635
|
-
*/
|
|
1636
|
-
physicalPath: string;
|
|
1637
|
-
/**
|
|
1638
|
-
* Indicates if the original source contained a byte-order marker.
|
|
1639
|
-
* ESLint strips the BOM from the `body`, but this info is needed
|
|
1640
|
-
* to correctly apply autofixing.
|
|
1641
|
-
*/
|
|
1642
|
-
bom: boolean;
|
|
1643
|
-
/**
|
|
1644
|
-
* The body of the file to parse.
|
|
1645
|
-
*/
|
|
1646
|
-
body: string | Uint8Array;
|
|
1647
|
-
}
|
|
1648
|
-
/**
|
|
1649
|
-
* Represents the successful result of parsing a file.
|
|
1650
|
-
*/
|
|
1651
|
-
interface OkParseResult<RootNode = unknown> {
|
|
1652
|
-
/**
|
|
1653
|
-
* Indicates if the parse was successful. If true, the parse was successful
|
|
1654
|
-
* and ESLint should continue on to create a SourceCode object and run rules;
|
|
1655
|
-
* if false, ESLint should just report the error(s) without doing anything
|
|
1656
|
-
* else.
|
|
1657
|
-
*/
|
|
1658
|
-
ok: true;
|
|
1659
|
-
/**
|
|
1660
|
-
* The abstract syntax tree created by the parser. (only when ok: true)
|
|
1661
|
-
*/
|
|
1662
|
-
ast: RootNode;
|
|
1663
|
-
/**
|
|
1664
|
-
* Any additional data that the parser wants to provide.
|
|
1665
|
-
*/
|
|
1666
|
-
[key: string]: any;
|
|
1667
|
-
}
|
|
1668
|
-
/**
|
|
1669
|
-
* Represents the unsuccessful result of parsing a file.
|
|
1670
|
-
*/
|
|
1671
|
-
interface NotOkParseResult {
|
|
1672
|
-
/**
|
|
1673
|
-
* Indicates if the parse was successful. If true, the parse was successful
|
|
1674
|
-
* and ESLint should continue on to create a SourceCode object and run rules;
|
|
1675
|
-
* if false, ESLint should just report the error(s) without doing anything
|
|
1676
|
-
* else.
|
|
1677
|
-
*/
|
|
1678
|
-
ok: false;
|
|
1679
|
-
/**
|
|
1680
|
-
* Any parsing errors, whether fatal or not. (only when ok: false)
|
|
1681
|
-
*/
|
|
1682
|
-
errors: FileError[];
|
|
1683
|
-
/**
|
|
1684
|
-
* Any additional data that the parser wants to provide.
|
|
1685
|
-
*/
|
|
1686
|
-
[key: string]: any;
|
|
1687
|
-
}
|
|
1688
|
-
type ParseResult<RootNode = unknown> = OkParseResult<RootNode> | NotOkParseResult;
|
|
1689
|
-
/**
|
|
1690
|
-
* Represents inline configuration found in the source code.
|
|
1691
|
-
*/
|
|
1692
|
-
interface InlineConfigElement {
|
|
1693
|
-
/**
|
|
1694
|
-
* The location of the inline config element.
|
|
1695
|
-
*/
|
|
1696
|
-
loc: SourceLocation$1;
|
|
1697
|
-
/**
|
|
1698
|
-
* The interpreted configuration from the inline config element.
|
|
1699
|
-
*/
|
|
1700
|
-
config: {
|
|
1701
|
-
rules: RulesConfig;
|
|
1702
|
-
};
|
|
1703
|
-
}
|
|
1704
|
-
/**
|
|
1705
|
-
* Generic options for the `SourceCodeBase` type.
|
|
1706
|
-
*/
|
|
1707
|
-
interface SourceCodeBaseTypeOptions {
|
|
1708
|
-
LangOptions: LanguageOptions;
|
|
1709
|
-
RootNode: unknown;
|
|
1710
|
-
SyntaxElementWithLoc: unknown;
|
|
1711
|
-
ConfigNode: unknown;
|
|
1712
|
-
}
|
|
1713
|
-
/**
|
|
1714
|
-
* Represents the basic interface for a source code object.
|
|
1715
|
-
*/
|
|
1716
|
-
interface SourceCodeBase<Options extends SourceCodeBaseTypeOptions = {
|
|
1717
|
-
LangOptions: LanguageOptions;
|
|
1718
|
-
RootNode: unknown;
|
|
1719
|
-
SyntaxElementWithLoc: unknown;
|
|
1720
|
-
ConfigNode: unknown;
|
|
1721
|
-
}> {
|
|
1722
|
-
/**
|
|
1723
|
-
* Root of the AST.
|
|
1724
|
-
*/
|
|
1725
|
-
ast: Options["RootNode"];
|
|
1726
|
-
/**
|
|
1727
|
-
* The traversal path that tools should take when evaluating the AST.
|
|
1728
|
-
* When present, this overrides the `visitorKeys` on the language for
|
|
1729
|
-
* just this source code object.
|
|
1730
|
-
*/
|
|
1731
|
-
visitorKeys?: Record<string, string[]>;
|
|
1732
|
-
/**
|
|
1733
|
-
* Retrieves the equivalent of `loc` for a given node or token.
|
|
1734
|
-
* @param syntaxElement The node or token to get the location for.
|
|
1735
|
-
* @returns The location of the node or token.
|
|
1736
|
-
*/
|
|
1737
|
-
getLoc(syntaxElement: Options["SyntaxElementWithLoc"]): SourceLocation$1;
|
|
1738
|
-
/**
|
|
1739
|
-
* Retrieves the equivalent of `range` for a given node or token.
|
|
1740
|
-
* @param syntaxElement The node or token to get the range for.
|
|
1741
|
-
* @returns The range of the node or token.
|
|
1742
|
-
*/
|
|
1743
|
-
getRange(syntaxElement: Options["SyntaxElementWithLoc"]): SourceRange;
|
|
1744
|
-
/**
|
|
1745
|
-
* Traversal of AST.
|
|
1746
|
-
*/
|
|
1747
|
-
traverse(): Iterable<TraversalStep>;
|
|
1748
|
-
/**
|
|
1749
|
-
* Applies language options passed in from the ESLint core.
|
|
1750
|
-
*/
|
|
1751
|
-
applyLanguageOptions?(languageOptions: Options["LangOptions"]): void;
|
|
1752
|
-
/**
|
|
1753
|
-
* Return all of the inline areas where ESLint should be disabled/enabled
|
|
1754
|
-
* along with any problems found in evaluating the directives.
|
|
1755
|
-
*/
|
|
1756
|
-
getDisableDirectives?(): {
|
|
1757
|
-
directives: Directive[];
|
|
1758
|
-
problems: FileProblem[];
|
|
1759
|
-
};
|
|
1760
|
-
/**
|
|
1761
|
-
* Returns an array of all inline configuration nodes found in the
|
|
1762
|
-
* source code.
|
|
1763
|
-
*/
|
|
1764
|
-
getInlineConfigNodes?(): Options["ConfigNode"][];
|
|
1765
|
-
/**
|
|
1766
|
-
* Applies configuration found inside of the source code. This method is only
|
|
1767
|
-
* called when ESLint is running with inline configuration allowed.
|
|
1768
|
-
*/
|
|
1769
|
-
applyInlineConfig?(): {
|
|
1770
|
-
configs: InlineConfigElement[];
|
|
1771
|
-
problems: FileProblem[];
|
|
1772
|
-
};
|
|
1773
|
-
/**
|
|
1774
|
-
* Called by ESLint core to indicate that it has finished providing
|
|
1775
|
-
* information. We now add in all the missing variables and ensure that
|
|
1776
|
-
* state-changing methods cannot be called by rules.
|
|
1777
|
-
* @returns {void}
|
|
1778
|
-
*/
|
|
1779
|
-
finalize?(): void;
|
|
1780
|
-
}
|
|
1781
|
-
/**
|
|
1782
|
-
* Represents the source of a text file being linted.
|
|
1783
|
-
*/
|
|
1784
|
-
interface TextSourceCode<Options extends SourceCodeBaseTypeOptions = {
|
|
1785
|
-
LangOptions: LanguageOptions;
|
|
1786
|
-
RootNode: unknown;
|
|
1787
|
-
SyntaxElementWithLoc: unknown;
|
|
1788
|
-
ConfigNode: unknown;
|
|
1789
|
-
}> extends SourceCodeBase<Options> {
|
|
1790
|
-
/**
|
|
1791
|
-
* The body of the file that you'd like rule developers to access.
|
|
1792
|
-
*/
|
|
1793
|
-
text: string;
|
|
1794
|
-
}
|
|
1795
|
-
/**
|
|
1796
|
-
* Represents the source of a binary file being linted.
|
|
1797
|
-
*/
|
|
1798
|
-
interface BinarySourceCode<Options extends SourceCodeBaseTypeOptions = {
|
|
1799
|
-
LangOptions: LanguageOptions;
|
|
1800
|
-
RootNode: unknown;
|
|
1801
|
-
SyntaxElementWithLoc: unknown;
|
|
1802
|
-
ConfigNode: unknown;
|
|
1803
|
-
}> extends SourceCodeBase<Options> {
|
|
1804
|
-
/**
|
|
1805
|
-
* The body of the file that you'd like rule developers to access.
|
|
1806
|
-
*/
|
|
1807
|
-
body: Uint8Array;
|
|
1808
|
-
}
|
|
1809
|
-
type SourceCode$1<Options extends SourceCodeBaseTypeOptions = {
|
|
1810
|
-
LangOptions: LanguageOptions;
|
|
1811
|
-
RootNode: unknown;
|
|
1812
|
-
SyntaxElementWithLoc: unknown;
|
|
1813
|
-
ConfigNode: unknown;
|
|
1814
|
-
}> = TextSourceCode<Options> | BinarySourceCode<Options>;
|
|
1815
|
-
/**
|
|
1816
|
-
* Represents a traversal step visiting the AST.
|
|
1817
|
-
*/
|
|
1818
|
-
interface VisitTraversalStep {
|
|
1819
|
-
kind: 1;
|
|
1820
|
-
target: unknown;
|
|
1821
|
-
phase: 1 | 2;
|
|
1822
|
-
args: unknown[];
|
|
1823
|
-
}
|
|
1824
|
-
/**
|
|
1825
|
-
* Represents a traversal step calling a function.
|
|
1826
|
-
*/
|
|
1827
|
-
interface CallTraversalStep {
|
|
1828
|
-
kind: 2;
|
|
1829
|
-
target: string;
|
|
1830
|
-
phase?: string;
|
|
1831
|
-
args: unknown[];
|
|
1832
|
-
}
|
|
1833
|
-
type TraversalStep = VisitTraversalStep | CallTraversalStep;
|
|
1834
|
-
/**
|
|
1835
|
-
* The type of disable directive. This determines how ESLint will disable rules.
|
|
1836
|
-
*/
|
|
1837
|
-
type DirectiveType = "disable" | "enable" | "disable-line" | "disable-next-line";
|
|
1838
|
-
/**
|
|
1839
|
-
* Represents a disable directive.
|
|
6
|
+
* This namespace contains type definitions that mirror ESLint's Linter types,
|
|
7
|
+
* allowing the codebase to be independent of the eslint package while maintaining
|
|
8
|
+
* compatibility with both ESLint 9 and 10.
|
|
1840
9
|
*/
|
|
1841
|
-
|
|
1842
|
-
/**
|
|
1843
|
-
* The type of directive.
|
|
1844
|
-
*/
|
|
1845
|
-
type: DirectiveType;
|
|
1846
|
-
/**
|
|
1847
|
-
* The node of the directive. May be in the AST or a comment/token.
|
|
1848
|
-
*/
|
|
1849
|
-
node: unknown;
|
|
1850
|
-
/**
|
|
1851
|
-
* The value of the directive.
|
|
1852
|
-
*/
|
|
1853
|
-
value: string;
|
|
1854
|
-
/**
|
|
1855
|
-
* The justification for the directive.
|
|
1856
|
-
*/
|
|
1857
|
-
justification?: string;
|
|
1858
|
-
}
|
|
1859
|
-
//#endregion
|
|
1860
|
-
//#region node_modules/.pnpm/eslint@9.39.2_jiti@2.6.1/node_modules/eslint/lib/types/index.d.ts
|
|
1861
|
-
//------------------------------------------------------------------------------
|
|
1862
|
-
// Helpers
|
|
1863
|
-
//------------------------------------------------------------------------------
|
|
1864
|
-
/** Adds matching `:exit` selectors for all properties of a `RuleVisitor`. */
|
|
1865
|
-
type WithExit<RuleVisitorType extends RuleVisitor> = { [Key in keyof RuleVisitorType as Key | `${Key & string}:exit`]: RuleVisitorType[Key] }; //------------------------------------------------------------------------------
|
|
1866
|
-
// Exports
|
|
1867
|
-
//------------------------------------------------------------------------------
|
|
1868
|
-
declare namespace AST {
|
|
1869
|
-
type TokenType = "Boolean" | "Null" | "Identifier" | "PrivateIdentifier" | "Keyword" | "Punctuator" | "JSXIdentifier" | "JSXText" | "Numeric" | "String" | "Template" | "RegularExpression";
|
|
1870
|
-
interface Token {
|
|
1871
|
-
type: TokenType;
|
|
1872
|
-
value: string;
|
|
1873
|
-
range: Range;
|
|
1874
|
-
loc: SourceLocation;
|
|
1875
|
-
}
|
|
1876
|
-
interface SourceLocation {
|
|
1877
|
-
start: Position$1;
|
|
1878
|
-
end: Position$1;
|
|
1879
|
-
}
|
|
1880
|
-
type Range = [number, number];
|
|
1881
|
-
interface Program extends Program {
|
|
1882
|
-
comments: Comment[];
|
|
1883
|
-
tokens: Token[];
|
|
1884
|
-
loc: SourceLocation;
|
|
1885
|
-
range: Range;
|
|
1886
|
-
}
|
|
1887
|
-
}
|
|
1888
|
-
declare namespace Scope {
|
|
1889
|
-
interface ScopeManager {
|
|
1890
|
-
scopes: Scope[];
|
|
1891
|
-
globalScope: Scope | null;
|
|
1892
|
-
acquire(node: Node$1, inner?: boolean): Scope | null;
|
|
1893
|
-
getDeclaredVariables(node: Node$1): Variable[];
|
|
1894
|
-
}
|
|
1895
|
-
interface Scope {
|
|
1896
|
-
type: "block" | "catch" | "class" | "class-field-initializer" | "class-static-block" | "for" | "function" | "function-expression-name" | "global" | "module" | "switch" | "with" | "TDZ";
|
|
1897
|
-
isStrict: boolean;
|
|
1898
|
-
upper: Scope | null;
|
|
1899
|
-
childScopes: Scope[];
|
|
1900
|
-
variableScope: Scope;
|
|
1901
|
-
block: Node$1;
|
|
1902
|
-
variables: Variable[];
|
|
1903
|
-
set: Map<string, Variable>;
|
|
1904
|
-
references: Reference[];
|
|
1905
|
-
through: Reference[];
|
|
1906
|
-
functionExpressionScope: boolean;
|
|
1907
|
-
implicit?: {
|
|
1908
|
-
variables: Variable[];
|
|
1909
|
-
set: Map<string, Variable>;
|
|
1910
|
-
};
|
|
1911
|
-
}
|
|
1912
|
-
interface Variable {
|
|
1913
|
-
name: string;
|
|
1914
|
-
scope: Scope;
|
|
1915
|
-
identifiers: Identifier[];
|
|
1916
|
-
references: Reference[];
|
|
1917
|
-
defs: Definition[];
|
|
1918
|
-
}
|
|
1919
|
-
interface Reference {
|
|
1920
|
-
identifier: Identifier;
|
|
1921
|
-
from: Scope;
|
|
1922
|
-
resolved: Variable | null;
|
|
1923
|
-
writeExpr: Node$1 | null;
|
|
1924
|
-
init: boolean;
|
|
1925
|
-
isWrite(): boolean;
|
|
1926
|
-
isRead(): boolean;
|
|
1927
|
-
isWriteOnly(): boolean;
|
|
1928
|
-
isReadOnly(): boolean;
|
|
1929
|
-
isReadWrite(): boolean;
|
|
1930
|
-
}
|
|
1931
|
-
type DefinitionType = {
|
|
1932
|
-
type: "CatchClause";
|
|
1933
|
-
node: CatchClause;
|
|
1934
|
-
parent: null;
|
|
1935
|
-
} | {
|
|
1936
|
-
type: "ClassName";
|
|
1937
|
-
node: ClassDeclaration | ClassExpression;
|
|
1938
|
-
parent: null;
|
|
1939
|
-
} | {
|
|
1940
|
-
type: "FunctionName";
|
|
1941
|
-
node: FunctionDeclaration | FunctionExpression;
|
|
1942
|
-
parent: null;
|
|
1943
|
-
} | {
|
|
1944
|
-
type: "ImplicitGlobalVariable";
|
|
1945
|
-
node: AssignmentExpression | ForInStatement | ForOfStatement;
|
|
1946
|
-
parent: null;
|
|
1947
|
-
} | {
|
|
1948
|
-
type: "ImportBinding";
|
|
1949
|
-
node: ImportSpecifier | ImportDefaultSpecifier | ImportNamespaceSpecifier;
|
|
1950
|
-
parent: ImportDeclaration;
|
|
1951
|
-
} | {
|
|
1952
|
-
type: "Parameter";
|
|
1953
|
-
node: FunctionDeclaration | FunctionExpression | ArrowFunctionExpression;
|
|
1954
|
-
parent: null;
|
|
1955
|
-
} | {
|
|
1956
|
-
type: "TDZ";
|
|
1957
|
-
node: any;
|
|
1958
|
-
parent: null;
|
|
1959
|
-
} | {
|
|
1960
|
-
type: "Variable";
|
|
1961
|
-
node: VariableDeclarator;
|
|
1962
|
-
parent: VariableDeclaration;
|
|
1963
|
-
};
|
|
1964
|
-
type Definition = DefinitionType & {
|
|
1965
|
-
name: Identifier;
|
|
1966
|
-
};
|
|
1967
|
-
}
|
|
1968
|
-
// #region SourceCode
|
|
1969
|
-
declare class SourceCode implements TextSourceCode<{
|
|
1970
|
-
LangOptions: Linter.LanguageOptions;
|
|
1971
|
-
RootNode: AST.Program;
|
|
1972
|
-
SyntaxElementWithLoc: AST.Token | Node$1;
|
|
1973
|
-
ConfigNode: Comment;
|
|
1974
|
-
}> {
|
|
1975
|
-
text: string;
|
|
1976
|
-
ast: AST.Program;
|
|
1977
|
-
lines: string[];
|
|
1978
|
-
hasBOM: boolean;
|
|
1979
|
-
parserServices: SourceCode.ParserServices;
|
|
1980
|
-
scopeManager: Scope.ScopeManager;
|
|
1981
|
-
visitorKeys: SourceCode.VisitorKeys;
|
|
1982
|
-
constructor(text: string, ast: AST.Program);
|
|
1983
|
-
constructor(config: SourceCode.Config);
|
|
1984
|
-
static splitLines(text: string): string[];
|
|
1985
|
-
getLoc(syntaxElement: AST.Token | Node$1): SourceLocation$2;
|
|
1986
|
-
getRange(syntaxElement: AST.Token | Node$1): SourceRange;
|
|
1987
|
-
getText(node?: Node$1, beforeCount?: number, afterCount?: number): string;
|
|
1988
|
-
getLines(): string[];
|
|
1989
|
-
getAllComments(): Comment[];
|
|
1990
|
-
getAncestors(node: Node$1): Node$1[];
|
|
1991
|
-
getDeclaredVariables(node: Node$1): Scope.Variable[];
|
|
1992
|
-
/** @deprecated */
|
|
1993
|
-
getJSDocComment(node: Node$1): Comment | null;
|
|
1994
|
-
getNodeByRangeIndex(index: number): Node$1 | null;
|
|
1995
|
-
/** @deprecated Use `isSpaceBetween()` instead. */
|
|
1996
|
-
isSpaceBetweenTokens(first: Node$1 | AST.Token, second: Node$1 | AST.Token): boolean;
|
|
1997
|
-
getLocFromIndex(index: number): Position$1;
|
|
1998
|
-
getIndexFromLoc(location: Position$1): number; // Inherited methods from TokenStore
|
|
1999
|
-
// ---------------------------------
|
|
2000
|
-
getTokenByRangeStart(offset: number, options?: {
|
|
2001
|
-
includeComments: false;
|
|
2002
|
-
}): AST.Token | null;
|
|
2003
|
-
getTokenByRangeStart(offset: number, options: {
|
|
2004
|
-
includeComments: boolean;
|
|
2005
|
-
}): AST.Token | Comment | null;
|
|
2006
|
-
getFirstToken: SourceCode.UnaryNodeCursorWithSkipOptions;
|
|
2007
|
-
getFirstTokens: SourceCode.UnaryNodeCursorWithCountOptions;
|
|
2008
|
-
getLastToken: SourceCode.UnaryNodeCursorWithSkipOptions;
|
|
2009
|
-
getLastTokens: SourceCode.UnaryNodeCursorWithCountOptions;
|
|
2010
|
-
getTokenBefore: SourceCode.UnaryCursorWithSkipOptions;
|
|
2011
|
-
getTokensBefore: SourceCode.UnaryCursorWithCountOptions;
|
|
2012
|
-
getTokenAfter: SourceCode.UnaryCursorWithSkipOptions;
|
|
2013
|
-
getTokensAfter: SourceCode.UnaryCursorWithCountOptions;
|
|
2014
|
-
/** @deprecated Use `getTokenBefore()` instead. */
|
|
2015
|
-
getTokenOrCommentBefore(node: Node$1 | AST.Token | Comment, skip?: number | undefined): AST.Token | Comment | null;
|
|
2016
|
-
/** @deprecated Use `getTokenAfter()` instead. */
|
|
2017
|
-
getTokenOrCommentAfter(node: Node$1 | AST.Token | Comment, skip?: number | undefined): AST.Token | Comment | null;
|
|
2018
|
-
getFirstTokenBetween: SourceCode.BinaryCursorWithSkipOptions;
|
|
2019
|
-
getFirstTokensBetween: SourceCode.BinaryCursorWithCountOptions;
|
|
2020
|
-
getLastTokenBetween: SourceCode.BinaryCursorWithSkipOptions;
|
|
2021
|
-
getLastTokensBetween: SourceCode.BinaryCursorWithCountOptions;
|
|
2022
|
-
getTokensBetween: SourceCode.BinaryCursorWithCountOptions;
|
|
2023
|
-
getTokens: ((node: Node$1, beforeCount?: number, afterCount?: number) => AST.Token[]) & SourceCode.UnaryNodeCursorWithCountOptions;
|
|
2024
|
-
commentsExistBetween(left: Node$1 | AST.Token | Comment, right: Node$1 | AST.Token | Comment): boolean;
|
|
2025
|
-
getCommentsBefore(nodeOrToken: Node$1 | AST.Token): Comment[];
|
|
2026
|
-
getCommentsAfter(nodeOrToken: Node$1 | AST.Token): Comment[];
|
|
2027
|
-
getCommentsInside(node: Node$1): Comment[];
|
|
2028
|
-
getScope(node: Node$1): Scope.Scope;
|
|
2029
|
-
isSpaceBetween(first: Node$1 | AST.Token, second: Node$1 | AST.Token): boolean;
|
|
2030
|
-
isGlobalReference(node: Identifier): boolean;
|
|
2031
|
-
markVariableAsUsed(name: string, refNode?: Node$1): boolean;
|
|
2032
|
-
traverse(): Iterable<TraversalStep>;
|
|
2033
|
-
}
|
|
2034
|
-
declare namespace SourceCode {
|
|
2035
|
-
interface Config {
|
|
2036
|
-
text: string;
|
|
2037
|
-
ast: AST.Program;
|
|
2038
|
-
hasBOM?: boolean | undefined;
|
|
2039
|
-
parserServices?: ParserServices | null | undefined;
|
|
2040
|
-
scopeManager?: Scope.ScopeManager | null | undefined;
|
|
2041
|
-
visitorKeys?: VisitorKeys | null | undefined;
|
|
2042
|
-
}
|
|
2043
|
-
type ParserServices = any;
|
|
2044
|
-
interface VisitorKeys {
|
|
2045
|
-
[nodeType: string]: string[];
|
|
2046
|
-
}
|
|
2047
|
-
interface UnaryNodeCursorWithSkipOptions {
|
|
2048
|
-
<T extends AST.Token>(node: Node$1, options: ((token: AST.Token) => token is T) | {
|
|
2049
|
-
filter: (token: AST.Token) => token is T;
|
|
2050
|
-
includeComments?: false | undefined;
|
|
2051
|
-
skip?: number | undefined;
|
|
2052
|
-
}): T | null;
|
|
2053
|
-
<T extends AST.Token | Comment>(node: Node$1, options: {
|
|
2054
|
-
filter: (tokenOrComment: AST.Token | Comment) => tokenOrComment is T;
|
|
2055
|
-
includeComments: boolean;
|
|
2056
|
-
skip?: number | undefined;
|
|
2057
|
-
}): T | null;
|
|
2058
|
-
(node: Node$1, options?: {
|
|
2059
|
-
filter?: ((token: AST.Token) => boolean) | undefined;
|
|
2060
|
-
includeComments?: false | undefined;
|
|
2061
|
-
skip?: number | undefined;
|
|
2062
|
-
} | ((token: AST.Token) => boolean) | number): AST.Token | null;
|
|
2063
|
-
(node: Node$1, options: {
|
|
2064
|
-
filter?: ((token: AST.Token | Comment) => boolean) | undefined;
|
|
2065
|
-
includeComments: boolean;
|
|
2066
|
-
skip?: number | undefined;
|
|
2067
|
-
}): AST.Token | Comment | null;
|
|
2068
|
-
}
|
|
2069
|
-
interface UnaryNodeCursorWithCountOptions {
|
|
2070
|
-
<T extends AST.Token>(node: Node$1, options: ((token: AST.Token) => token is T) | {
|
|
2071
|
-
filter: (token: AST.Token) => token is T;
|
|
2072
|
-
includeComments?: false | undefined;
|
|
2073
|
-
count?: number | undefined;
|
|
2074
|
-
}): T[];
|
|
2075
|
-
<T extends AST.Token | Comment>(node: Node$1, options: {
|
|
2076
|
-
filter: (tokenOrComment: AST.Token | Comment) => tokenOrComment is T;
|
|
2077
|
-
includeComments: boolean;
|
|
2078
|
-
count?: number | undefined;
|
|
2079
|
-
}): T[];
|
|
2080
|
-
(node: Node$1, options?: {
|
|
2081
|
-
filter?: ((token: AST.Token) => boolean) | undefined;
|
|
2082
|
-
includeComments?: false | undefined;
|
|
2083
|
-
count?: number | undefined;
|
|
2084
|
-
} | ((token: AST.Token) => boolean) | number): AST.Token[];
|
|
2085
|
-
(node: Node$1, options: {
|
|
2086
|
-
filter?: ((token: AST.Token | Comment) => boolean) | undefined;
|
|
2087
|
-
includeComments: boolean;
|
|
2088
|
-
count?: number | undefined;
|
|
2089
|
-
}): Array<AST.Token | Comment>;
|
|
2090
|
-
}
|
|
2091
|
-
interface UnaryCursorWithSkipOptions {
|
|
2092
|
-
<T extends AST.Token>(node: Node$1 | AST.Token | Comment, options: ((token: AST.Token) => token is T) | {
|
|
2093
|
-
filter: (token: AST.Token) => token is T;
|
|
2094
|
-
includeComments?: false | undefined;
|
|
2095
|
-
skip?: number | undefined;
|
|
2096
|
-
}): T | null;
|
|
2097
|
-
<T extends AST.Token | Comment>(node: Node$1 | AST.Token | Comment, options: {
|
|
2098
|
-
filter: (tokenOrComment: AST.Token | Comment) => tokenOrComment is T;
|
|
2099
|
-
includeComments: boolean;
|
|
2100
|
-
skip?: number | undefined;
|
|
2101
|
-
}): T | null;
|
|
2102
|
-
(node: Node$1 | AST.Token | Comment, options?: {
|
|
2103
|
-
filter?: ((token: AST.Token) => boolean) | undefined;
|
|
2104
|
-
includeComments?: false | undefined;
|
|
2105
|
-
skip?: number | undefined;
|
|
2106
|
-
} | ((token: AST.Token) => boolean) | number): AST.Token | null;
|
|
2107
|
-
(node: Node$1 | AST.Token | Comment, options: {
|
|
2108
|
-
filter?: ((token: AST.Token | Comment) => boolean) | undefined;
|
|
2109
|
-
includeComments: boolean;
|
|
2110
|
-
skip?: number | undefined;
|
|
2111
|
-
}): AST.Token | Comment | null;
|
|
2112
|
-
}
|
|
2113
|
-
interface UnaryCursorWithCountOptions {
|
|
2114
|
-
<T extends AST.Token>(node: Node$1 | AST.Token | Comment, options: ((token: AST.Token) => token is T) | {
|
|
2115
|
-
filter: (token: AST.Token) => token is T;
|
|
2116
|
-
includeComments?: false | undefined;
|
|
2117
|
-
count?: number | undefined;
|
|
2118
|
-
}): T[];
|
|
2119
|
-
<T extends AST.Token | Comment>(node: Node$1 | AST.Token | Comment, options: {
|
|
2120
|
-
filter: (tokenOrComment: AST.Token | Comment) => tokenOrComment is T;
|
|
2121
|
-
includeComments: boolean;
|
|
2122
|
-
count?: number | undefined;
|
|
2123
|
-
}): T[];
|
|
2124
|
-
(node: Node$1 | AST.Token | Comment, options?: {
|
|
2125
|
-
filter?: ((token: AST.Token) => boolean) | undefined;
|
|
2126
|
-
includeComments?: false | undefined;
|
|
2127
|
-
count?: number | undefined;
|
|
2128
|
-
} | ((token: AST.Token) => boolean) | number): AST.Token[];
|
|
2129
|
-
(node: Node$1 | AST.Token | Comment, options: {
|
|
2130
|
-
filter?: ((token: AST.Token | Comment) => boolean) | undefined;
|
|
2131
|
-
includeComments: boolean;
|
|
2132
|
-
count?: number | undefined;
|
|
2133
|
-
}): Array<AST.Token | Comment>;
|
|
2134
|
-
}
|
|
2135
|
-
interface BinaryCursorWithSkipOptions {
|
|
2136
|
-
<T extends AST.Token>(left: Node$1 | AST.Token | Comment, right: Node$1 | AST.Token | Comment, options: ((token: AST.Token) => token is T) | {
|
|
2137
|
-
filter: (token: AST.Token) => token is T;
|
|
2138
|
-
includeComments?: false | undefined;
|
|
2139
|
-
skip?: number | undefined;
|
|
2140
|
-
}): T | null;
|
|
2141
|
-
<T extends AST.Token | Comment>(left: Node$1 | AST.Token | Comment, right: Node$1 | AST.Token | Comment, options: {
|
|
2142
|
-
filter: (tokenOrComment: AST.Token | Comment) => tokenOrComment is T;
|
|
2143
|
-
includeComments: boolean;
|
|
2144
|
-
skip?: number | undefined;
|
|
2145
|
-
}): T | null;
|
|
2146
|
-
(left: Node$1 | AST.Token | Comment, right: Node$1 | AST.Token | Comment, options?: {
|
|
2147
|
-
filter?: ((token: AST.Token) => boolean) | undefined;
|
|
2148
|
-
includeComments?: false | undefined;
|
|
2149
|
-
skip?: number | undefined;
|
|
2150
|
-
} | ((token: AST.Token) => boolean) | number): AST.Token | null;
|
|
2151
|
-
(left: Node$1 | AST.Token | Comment, right: Node$1 | AST.Token | Comment, options: {
|
|
2152
|
-
filter?: ((token: AST.Token | Comment) => boolean) | undefined;
|
|
2153
|
-
includeComments: boolean;
|
|
2154
|
-
skip?: number | undefined;
|
|
2155
|
-
}): AST.Token | Comment | null;
|
|
2156
|
-
}
|
|
2157
|
-
interface BinaryCursorWithCountOptions {
|
|
2158
|
-
<T extends AST.Token>(left: Node$1 | AST.Token | Comment, right: Node$1 | AST.Token | Comment, options: ((token: AST.Token) => token is T) | {
|
|
2159
|
-
filter: (token: AST.Token) => token is T;
|
|
2160
|
-
includeComments?: false | undefined;
|
|
2161
|
-
count?: number | undefined;
|
|
2162
|
-
}): T[];
|
|
2163
|
-
<T extends AST.Token | Comment>(left: Node$1 | AST.Token | Comment, right: Node$1 | AST.Token | Comment, options: {
|
|
2164
|
-
filter: (tokenOrComment: AST.Token | Comment) => tokenOrComment is T;
|
|
2165
|
-
includeComments: boolean;
|
|
2166
|
-
count?: number | undefined;
|
|
2167
|
-
}): T[];
|
|
2168
|
-
(left: Node$1 | AST.Token | Comment, right: Node$1 | AST.Token | Comment, options?: {
|
|
2169
|
-
filter?: ((token: AST.Token) => boolean) | undefined;
|
|
2170
|
-
includeComments?: false | undefined;
|
|
2171
|
-
count?: number | undefined;
|
|
2172
|
-
} | ((token: AST.Token) => boolean) | number): AST.Token[];
|
|
2173
|
-
(left: Node$1 | AST.Token | Comment, right: Node$1 | AST.Token | Comment, options: {
|
|
2174
|
-
filter?: ((token: AST.Token | Comment) => boolean) | undefined;
|
|
2175
|
-
includeComments: boolean;
|
|
2176
|
-
count?: number | undefined;
|
|
2177
|
-
}): Array<AST.Token | Comment>;
|
|
2178
|
-
}
|
|
2179
|
-
}
|
|
2180
|
-
// #endregion
|
|
2181
|
-
type JSSyntaxElement = {
|
|
2182
|
-
type: string;
|
|
2183
|
-
loc?: SourceLocation$2 | null | undefined;
|
|
2184
|
-
};
|
|
2185
|
-
declare namespace Rule {
|
|
2186
|
-
interface RuleModule extends RuleDefinition<{
|
|
2187
|
-
LangOptions: Linter.LanguageOptions;
|
|
2188
|
-
Code: SourceCode;
|
|
2189
|
-
RuleOptions: any[];
|
|
2190
|
-
Visitor: RuleListener;
|
|
2191
|
-
Node: JSSyntaxElement;
|
|
2192
|
-
MessageIds: string;
|
|
2193
|
-
ExtRuleDocs: {};
|
|
2194
|
-
}> {
|
|
2195
|
-
create(context: RuleContext): RuleListener;
|
|
2196
|
-
}
|
|
2197
|
-
type NodeTypes = Node$1["type"];
|
|
2198
|
-
interface NodeListener extends WithExit<{ [Node in Rule.Node as Node["type"]]?: ((node: Node) => void) | undefined } & {
|
|
2199
|
-
// A `Program` visitor's node type has no `parent` property.
|
|
2200
|
-
Program?: ((node: AST.Program) => void) | undefined;
|
|
2201
|
-
}> {}
|
|
2202
|
-
interface NodeParentExtension {
|
|
2203
|
-
parent: Node;
|
|
2204
|
-
}
|
|
2205
|
-
type Node = (AST.Program & {
|
|
2206
|
-
parent: null;
|
|
2207
|
-
}) | (Exclude<Node$1, Program> & NodeParentExtension);
|
|
2208
|
-
interface RuleListener extends NodeListener {
|
|
2209
|
-
onCodePathStart?(codePath: CodePath, node: Node): void;
|
|
2210
|
-
onCodePathEnd?(codePath: CodePath, node: Node): void;
|
|
2211
|
-
onCodePathSegmentStart?(segment: CodePathSegment, node: Node): void;
|
|
2212
|
-
onCodePathSegmentEnd?(segment: CodePathSegment, node: Node): void;
|
|
2213
|
-
onUnreachableCodePathSegmentStart?(segment: CodePathSegment, node: Node): void;
|
|
2214
|
-
onUnreachableCodePathSegmentEnd?(segment: CodePathSegment, node: Node): void;
|
|
2215
|
-
onCodePathSegmentLoop?(fromSegment: CodePathSegment, toSegment: CodePathSegment, node: Node): void;
|
|
2216
|
-
[key: string]: ((codePath: CodePath, node: Node) => void) | ((segment: CodePathSegment, node: Node) => void) | ((fromSegment: CodePathSegment, toSegment: CodePathSegment, node: Node) => void) | ((node: Node) => void) | NodeListener[keyof NodeListener] | undefined;
|
|
2217
|
-
}
|
|
2218
|
-
type CodePathOrigin = "program" | "function" | "class-field-initializer" | "class-static-block";
|
|
2219
|
-
interface CodePath {
|
|
2220
|
-
id: string;
|
|
2221
|
-
origin: CodePathOrigin;
|
|
2222
|
-
initialSegment: CodePathSegment;
|
|
2223
|
-
finalSegments: CodePathSegment[];
|
|
2224
|
-
returnedSegments: CodePathSegment[];
|
|
2225
|
-
thrownSegments: CodePathSegment[];
|
|
2226
|
-
upper: CodePath | null;
|
|
2227
|
-
childCodePaths: CodePath[];
|
|
2228
|
-
}
|
|
2229
|
-
interface CodePathSegment {
|
|
2230
|
-
id: string;
|
|
2231
|
-
nextSegments: CodePathSegment[];
|
|
2232
|
-
prevSegments: CodePathSegment[];
|
|
2233
|
-
reachable: boolean;
|
|
2234
|
-
}
|
|
2235
|
-
type RuleMetaData = RulesMeta;
|
|
2236
|
-
interface RuleContext extends RuleContext$1<{
|
|
2237
|
-
LangOptions: Linter.LanguageOptions;
|
|
2238
|
-
Code: SourceCode;
|
|
2239
|
-
RuleOptions: any[];
|
|
2240
|
-
Node: JSSyntaxElement;
|
|
2241
|
-
MessageIds: string;
|
|
2242
|
-
}> {}
|
|
2243
|
-
type ReportFixer = RuleFixer;
|
|
2244
|
-
/** @deprecated Use `ReportDescriptorOptions` instead. */
|
|
2245
|
-
type ReportDescriptorOptionsBase = ViolationReportBase;
|
|
2246
|
-
type SuggestionReportOptions = SuggestedEditBase;
|
|
2247
|
-
type SuggestionDescriptorMessage = SuggestionMessage;
|
|
2248
|
-
type SuggestionReportDescriptor = SuggestedEdit; // redundant with ReportDescriptorOptionsBase but kept for clarity
|
|
2249
|
-
type ReportDescriptorOptions = ViolationReportBase;
|
|
2250
|
-
type ReportDescriptor = ViolationReport<Node$1>;
|
|
2251
|
-
type ReportDescriptorMessage = ViolationMessage;
|
|
2252
|
-
type ReportDescriptorLocation = ViolationLocation<Node$1>;
|
|
2253
|
-
type RuleFixer = RuleTextEditor<Node$1 | AST.Token>;
|
|
2254
|
-
type Fix = RuleTextEdit;
|
|
2255
|
-
}
|
|
2256
|
-
// #region Linter
|
|
2257
|
-
declare class Linter {
|
|
2258
|
-
static readonly version: string;
|
|
2259
|
-
version: string;
|
|
2260
|
-
constructor(options?: {
|
|
2261
|
-
cwd?: string | undefined;
|
|
2262
|
-
configType?: "flat" | "eslintrc";
|
|
2263
|
-
});
|
|
2264
|
-
verify(code: SourceCode | string, config: Linter.LegacyConfig | Linter.Config | Linter.Config[], filename?: string): Linter.LintMessage[];
|
|
2265
|
-
verify(code: SourceCode | string, config: Linter.LegacyConfig | Linter.Config | Linter.Config[], options: Linter.LintOptions): Linter.LintMessage[];
|
|
2266
|
-
verifyAndFix(code: string, config: Linter.LegacyConfig | Linter.Config | Linter.Config[], filename?: string): Linter.FixReport;
|
|
2267
|
-
verifyAndFix(code: string, config: Linter.LegacyConfig | Linter.Config | Linter.Config[], options: Linter.FixOptions): Linter.FixReport;
|
|
2268
|
-
getSourceCode(): SourceCode;
|
|
2269
|
-
defineRule(name: string, rule: Rule.RuleModule): void;
|
|
2270
|
-
defineRules(rules: {
|
|
2271
|
-
[name: string]: Rule.RuleModule;
|
|
2272
|
-
}): void;
|
|
2273
|
-
getRules(): Map<string, Rule.RuleModule>;
|
|
2274
|
-
defineParser(name: string, parser: Linter.Parser): void;
|
|
2275
|
-
getTimes(): Linter.Stats["times"];
|
|
2276
|
-
getFixPassCount(): Linter.Stats["fixPasses"];
|
|
2277
|
-
}
|
|
2278
|
-
declare namespace Linter {
|
|
10
|
+
declare namespace ESLint {
|
|
2279
11
|
/**
|
|
2280
|
-
*
|
|
2281
|
-
*
|
|
2282
|
-
* - `
|
|
2283
|
-
* - `
|
|
2284
|
-
* - `2` means error.
|
|
2285
|
-
*
|
|
2286
|
-
* @see [Rule Severities](https://eslint.org/docs/latest/use/configure/rules#rule-severities)
|
|
12
|
+
* Represents the severity level for a rule as a number.
|
|
13
|
+
* - `0` means off
|
|
14
|
+
* - `1` means warn
|
|
15
|
+
* - `2` means error
|
|
2287
16
|
*/
|
|
2288
|
-
type
|
|
17
|
+
type SeverityLevel = 0 | 1 | 2;
|
|
2289
18
|
/**
|
|
2290
|
-
*
|
|
2291
|
-
*
|
|
2292
|
-
* @see [Rule Severities](https://eslint.org/docs/latest/use/configure/rules#rule-severities)
|
|
19
|
+
* Represents the severity level for a rule as a string.
|
|
2293
20
|
*/
|
|
2294
|
-
type
|
|
21
|
+
type SeverityName = 'off' | 'warn' | 'error';
|
|
2295
22
|
/**
|
|
2296
23
|
* The numeric or human readable severity level for a rule.
|
|
2297
|
-
*
|
|
2298
|
-
* @see [Rule Severities](https://eslint.org/docs/latest/use/configure/rules#rule-severities)
|
|
2299
|
-
*/
|
|
2300
|
-
type RuleSeverity = Severity;
|
|
2301
|
-
/**
|
|
2302
|
-
* An array containing the rule severity level, followed by the rule options.
|
|
2303
|
-
*
|
|
2304
|
-
* @see [Rules](https://eslint.org/docs/latest/use/configure/rules)
|
|
2305
24
|
*/
|
|
2306
|
-
type
|
|
25
|
+
type Severity = SeverityName | SeverityLevel;
|
|
2307
26
|
/**
|
|
2308
|
-
* The
|
|
2309
|
-
*
|
|
2310
|
-
* @see [Rules](https://eslint.org/docs/latest/use/configure/rules)
|
|
27
|
+
* The configuration for a rule.
|
|
28
|
+
* Can be a severity level or an array with severity and options.
|
|
2311
29
|
*/
|
|
2312
|
-
type
|
|
30
|
+
type RuleConfig<RuleOptions extends unknown[] = unknown[]> = Severity | [Severity, ...Partial<RuleOptions>];
|
|
2313
31
|
/**
|
|
2314
|
-
*
|
|
32
|
+
* A collection of rules and their configurations.
|
|
2315
33
|
*/
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
*/
|
|
2320
|
-
type HasRules<Rules extends RulesConfig = RulesConfig> = HasRules<Rules>;
|
|
2321
|
-
/**
|
|
2322
|
-
* The ECMAScript version of the code being linted.
|
|
2323
|
-
*/
|
|
2324
|
-
type EcmaVersion = EcmaVersion$1;
|
|
2325
|
-
/**
|
|
2326
|
-
* The type of JavaScript source code.
|
|
2327
|
-
*/
|
|
2328
|
-
type SourceType = JavaScriptSourceType;
|
|
2329
|
-
/**
|
|
2330
|
-
* ESLint legacy configuration.
|
|
2331
|
-
*
|
|
2332
|
-
* @see [ESLint Legacy Configuration](https://eslint.org/docs/latest/use/configure/)
|
|
2333
|
-
*/
|
|
2334
|
-
type BaseConfig<Rules extends RulesConfig = RulesConfig, OverrideRules extends RulesConfig = Rules> = BaseConfig<Rules, OverrideRules>;
|
|
2335
|
-
/**
|
|
2336
|
-
* The overwrites that apply more differing configuration to specific files or directories.
|
|
2337
|
-
*/
|
|
2338
|
-
type ConfigOverride<Rules extends RulesConfig = RulesConfig> = ConfigOverride<Rules>;
|
|
2339
|
-
/**
|
|
2340
|
-
* ESLint legacy configuration.
|
|
2341
|
-
*
|
|
2342
|
-
* @see [ESLint Legacy Configuration](https://eslint.org/docs/latest/use/configure/)
|
|
2343
|
-
*/
|
|
2344
|
-
// https://github.com/eslint/eslint/blob/v8.57.0/conf/config-schema.js
|
|
2345
|
-
type LegacyConfig<Rules extends RulesConfig = RulesConfig, OverrideRules extends RulesConfig = Rules> = LegacyConfigObject<Rules, OverrideRules>;
|
|
2346
|
-
/**
|
|
2347
|
-
* Parser options.
|
|
2348
|
-
*
|
|
2349
|
-
* @see [Specifying Parser Options](https://eslint.org/docs/latest/use/configure/language-options#specifying-parser-options)
|
|
2350
|
-
*/
|
|
2351
|
-
type ParserOptions = JavaScriptParserOptionsConfig;
|
|
34
|
+
interface RulesRecord {
|
|
35
|
+
[key: string]: RuleConfig;
|
|
36
|
+
}
|
|
2352
37
|
/**
|
|
2353
|
-
*
|
|
38
|
+
* Global variable access configuration.
|
|
2354
39
|
*/
|
|
2355
|
-
|
|
2356
|
-
filename?: string | undefined;
|
|
2357
|
-
preprocess?: ((code: string) => string[]) | undefined;
|
|
2358
|
-
postprocess?: ((problemLists: LintMessage[][]) => LintMessage[]) | undefined;
|
|
2359
|
-
filterCodeBlock?: ((filename: string, text: string) => boolean) | undefined;
|
|
2360
|
-
disableFixes?: boolean | undefined;
|
|
2361
|
-
allowInlineConfig?: boolean | undefined;
|
|
2362
|
-
reportUnusedDisableDirectives?: boolean | undefined;
|
|
2363
|
-
}
|
|
2364
|
-
type LintSuggestion = LintSuggestion;
|
|
2365
|
-
type LintMessage = LintMessage$1;
|
|
2366
|
-
interface LintSuppression {
|
|
2367
|
-
kind: string;
|
|
2368
|
-
justification: string;
|
|
2369
|
-
}
|
|
2370
|
-
interface SuppressedLintMessage extends LintMessage {
|
|
2371
|
-
/** The suppression info. */
|
|
2372
|
-
suppressions: LintSuppression[];
|
|
2373
|
-
}
|
|
2374
|
-
interface FixOptions extends LintOptions {
|
|
2375
|
-
fix?: boolean | undefined;
|
|
2376
|
-
}
|
|
2377
|
-
interface FixReport {
|
|
2378
|
-
fixed: boolean;
|
|
2379
|
-
output: string;
|
|
2380
|
-
messages: LintMessage[];
|
|
2381
|
-
} // Temporarily loosen type for just flat config files (see https://github.com/DefinitelyTyped/DefinitelyTyped/pull/68232)
|
|
2382
|
-
type NonESTreeParser = ESLint.ObjectMetaProperties & ({
|
|
2383
|
-
parse(text: string, options?: any): unknown;
|
|
2384
|
-
} | {
|
|
2385
|
-
parseForESLint(text: string, options?: any): Omit<ESLintParseResult, "ast" | "scopeManager"> & {
|
|
2386
|
-
ast: unknown;
|
|
2387
|
-
scopeManager?: unknown;
|
|
2388
|
-
};
|
|
2389
|
-
});
|
|
2390
|
-
type ESTreeParser = ESLint.ObjectMetaProperties & ({
|
|
2391
|
-
parse(text: string, options?: any): AST.Program;
|
|
2392
|
-
} | {
|
|
2393
|
-
parseForESLint(text: string, options?: any): ESLintParseResult;
|
|
2394
|
-
});
|
|
2395
|
-
type Parser = NonESTreeParser | ESTreeParser;
|
|
2396
|
-
interface ESLintParseResult {
|
|
2397
|
-
/** The AST object. */
|
|
2398
|
-
ast: AST.Program;
|
|
2399
|
-
/** The services that the parser provides. */
|
|
2400
|
-
services?: SourceCode.ParserServices | undefined;
|
|
2401
|
-
/** The scope manager of the AST. */
|
|
2402
|
-
scopeManager?: Scope.ScopeManager | undefined;
|
|
2403
|
-
/** The visitor keys of the AST. */
|
|
2404
|
-
visitorKeys?: SourceCode.VisitorKeys | undefined;
|
|
2405
|
-
}
|
|
2406
|
-
type ProcessorFile = ProcessorFile$1; // https://eslint.org/docs/latest/extend/plugins#processors-in-plugins
|
|
2407
|
-
type Processor<T extends string | ProcessorFile = string | ProcessorFile> = Processor<T>;
|
|
2408
|
-
type Config<Rules extends RulesConfig = RulesConfig> = ConfigObject<Rules>;
|
|
2409
|
-
/** @deprecated Use `Config` instead of `FlatConfig` */
|
|
2410
|
-
type FlatConfig<Rules extends RulesConfig = RulesConfig> = Config<Rules>;
|
|
2411
|
-
type GlobalConf = GlobalAccess;
|
|
2412
|
-
type Globals = GlobalsConfig;
|
|
2413
|
-
interface LanguageOptions extends LanguageOptions {
|
|
2414
|
-
/**
|
|
2415
|
-
* The version of ECMAScript to support. May be any year (i.e., 2022) or
|
|
2416
|
-
* version (i.e., 5). Set to "latest" for the most recent supported version.
|
|
2417
|
-
* @default "latest"
|
|
2418
|
-
*/
|
|
2419
|
-
ecmaVersion?: EcmaVersion | undefined;
|
|
2420
|
-
/**
|
|
2421
|
-
* The type of JavaScript source code. Possible values are "script" for
|
|
2422
|
-
* traditional script files, "module" for ECMAScript modules (ESM), and
|
|
2423
|
-
* "commonjs" for CommonJS files. (default: "module" for .js and .mjs
|
|
2424
|
-
* files; "commonjs" for .cjs files)
|
|
2425
|
-
*/
|
|
2426
|
-
sourceType?: SourceType | undefined;
|
|
2427
|
-
/**
|
|
2428
|
-
* An object specifying additional objects that should be added to the
|
|
2429
|
-
* global scope during linting.
|
|
2430
|
-
*/
|
|
2431
|
-
globals?: Globals | undefined;
|
|
2432
|
-
/**
|
|
2433
|
-
* An object containing a parse() or parseForESLint() method.
|
|
2434
|
-
* If not configured, the default ESLint parser (Espree) will be used.
|
|
2435
|
-
*/
|
|
2436
|
-
parser?: Parser | undefined;
|
|
2437
|
-
/**
|
|
2438
|
-
* An object specifying additional options that are passed directly to the
|
|
2439
|
-
* parser() method on the parser. The available options are parser-dependent
|
|
2440
|
-
*/
|
|
2441
|
-
parserOptions?: Linter.ParserOptions | undefined;
|
|
2442
|
-
}
|
|
2443
|
-
type LinterOptions = LinterOptionsConfig;
|
|
40
|
+
type GlobalAccess = boolean | 'off' | 'readable' | 'readonly' | 'writable' | 'writeable';
|
|
2444
41
|
/**
|
|
2445
|
-
*
|
|
42
|
+
* Configuration for global variables.
|
|
2446
43
|
*/
|
|
2447
|
-
interface
|
|
2448
|
-
|
|
2449
|
-
* The number of times ESLint has applied at least one fix after linting.
|
|
2450
|
-
*/
|
|
2451
|
-
fixPasses: number;
|
|
2452
|
-
/**
|
|
2453
|
-
* The times spent on (parsing, fixing, linting) a file, where the linting refers to the timing information for each rule.
|
|
2454
|
-
*/
|
|
2455
|
-
times: {
|
|
2456
|
-
passes: TimePass[];
|
|
2457
|
-
};
|
|
44
|
+
interface GlobalsConfig {
|
|
45
|
+
[name: string]: GlobalAccess;
|
|
2458
46
|
}
|
|
2459
|
-
interface
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
*/
|
|
2463
|
-
parse: {
|
|
2464
|
-
total: number;
|
|
47
|
+
interface Plugin {
|
|
48
|
+
meta?: {
|
|
49
|
+
name?: string;
|
|
2465
50
|
};
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
51
|
+
configs?: Record<string, unknown[]> | undefined;
|
|
52
|
+
environments?: Record<string, unknown> | undefined;
|
|
53
|
+
languages?: Record<string, unknown> | undefined;
|
|
54
|
+
processors?: Record<string, unknown> | undefined;
|
|
55
|
+
rules?: RulesRecord | undefined;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* ESLint flat configuration object compatible with ESLint 9 and 10.
|
|
59
|
+
* Uses index signature to allow additional properties from various ESLint configurations.
|
|
60
|
+
*/
|
|
61
|
+
interface Config<Rules extends RulesRecord = RulesRecord> {
|
|
62
|
+
/** A string to identify the configuration object */
|
|
63
|
+
name?: string;
|
|
64
|
+
/** Path to the directory where the configuration should apply */
|
|
65
|
+
basePath?: string;
|
|
66
|
+
/** Glob patterns indicating files this config applies to */
|
|
67
|
+
files?: (string | string[])[];
|
|
68
|
+
/** Glob patterns indicating files this config doesn't apply to */
|
|
69
|
+
ignores?: string[];
|
|
70
|
+
/** Language options including globals, parser, etc */
|
|
71
|
+
languageOptions?: {
|
|
72
|
+
/** Global variables */globals?: GlobalsConfig; /** Parser options */
|
|
73
|
+
parserOptions?: Record<string, unknown>;
|
|
74
|
+
[key: string]: unknown;
|
|
2477
75
|
};
|
|
2478
|
-
/**
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
}
|
|
2484
|
-
// #endregion
|
|
2485
|
-
// #region ESLint
|
|
2486
|
-
declare class ESLint {
|
|
2487
|
-
static configType: "flat";
|
|
2488
|
-
static readonly version: string;
|
|
2489
|
-
/**
|
|
2490
|
-
* The default configuration that ESLint uses internally. This is provided for tooling that wants to calculate configurations using the same defaults as ESLint.
|
|
2491
|
-
* Keep in mind that the default configuration may change from version to version, so you shouldn't rely on any particular keys or values to be present.
|
|
2492
|
-
*/
|
|
2493
|
-
static readonly defaultConfig: Linter.Config[];
|
|
2494
|
-
static outputFixes(results: ESLint.LintResult[]): Promise<void>;
|
|
2495
|
-
static getErrorResults(results: ESLint.LintResult[]): ESLint.LintResult[];
|
|
2496
|
-
constructor(options?: ESLint.Options);
|
|
2497
|
-
lintFiles(patterns: string | string[]): Promise<ESLint.LintResult[]>;
|
|
2498
|
-
lintText(code: string, options?: {
|
|
2499
|
-
filePath?: string | undefined;
|
|
2500
|
-
warnIgnored?: boolean | undefined;
|
|
2501
|
-
}): Promise<ESLint.LintResult[]>;
|
|
2502
|
-
getRulesMetaForResults(results: ESLint.LintResult[]): ESLint.LintResultData["rulesMeta"];
|
|
2503
|
-
hasFlag(flag: string): boolean;
|
|
2504
|
-
calculateConfigForFile(filePath: string): Promise<any>;
|
|
2505
|
-
findConfigFile(filePath?: string): Promise<string | undefined>;
|
|
2506
|
-
isPathIgnored(filePath: string): Promise<boolean>;
|
|
2507
|
-
loadFormatter(nameOrPath?: string): Promise<ESLint.LoadedFormatter>;
|
|
2508
|
-
static fromOptionsModule(optionsURL: {
|
|
2509
|
-
readonly href: string;
|
|
2510
|
-
}): Promise<ESLint>;
|
|
2511
|
-
}
|
|
2512
|
-
declare namespace ESLint {
|
|
2513
|
-
type ConfigData<Rules extends Linter.RulesRecord = RulesConfig> = Omit<Linter.LegacyConfig<Rules>, "$schema">;
|
|
2514
|
-
type Environment = EnvironmentConfig;
|
|
2515
|
-
type ObjectMetaProperties = ObjectMetaProperties;
|
|
2516
|
-
type Plugin = Plugin$1;
|
|
2517
|
-
type FixType = "directive" | "problem" | "suggestion" | "layout";
|
|
2518
|
-
type CacheStrategy = "content" | "metadata";
|
|
2519
|
-
interface Options {
|
|
2520
|
-
// File enumeration
|
|
2521
|
-
cwd?: string | undefined;
|
|
2522
|
-
errorOnUnmatchedPattern?: boolean | undefined;
|
|
2523
|
-
globInputPaths?: boolean | undefined;
|
|
2524
|
-
ignore?: boolean | undefined;
|
|
2525
|
-
ignorePatterns?: string[] | null | undefined;
|
|
2526
|
-
passOnNoPatterns?: boolean | undefined;
|
|
2527
|
-
warnIgnored?: boolean | undefined; // Linting
|
|
2528
|
-
allowInlineConfig?: boolean | undefined;
|
|
2529
|
-
baseConfig?: Linter.Config | Linter.Config[] | null | undefined;
|
|
2530
|
-
overrideConfig?: Linter.Config | Linter.Config[] | null | undefined;
|
|
2531
|
-
overrideConfigFile?: string | true | null | undefined;
|
|
2532
|
-
plugins?: Record<string, Plugin> | null | undefined;
|
|
2533
|
-
ruleFilter?: ((arg: {
|
|
2534
|
-
ruleId: string;
|
|
2535
|
-
severity: Exclude<Linter.Severity, 0>;
|
|
2536
|
-
}) => boolean) | undefined;
|
|
2537
|
-
stats?: boolean | undefined; // Autofix
|
|
2538
|
-
fix?: boolean | ((message: Linter.LintMessage) => boolean) | undefined;
|
|
2539
|
-
fixTypes?: FixType[] | null | undefined; // Cache-related
|
|
2540
|
-
cache?: boolean | undefined;
|
|
2541
|
-
cacheLocation?: string | undefined;
|
|
2542
|
-
cacheStrategy?: CacheStrategy | undefined; // Other Options
|
|
2543
|
-
concurrency?: number | "auto" | "off" | undefined;
|
|
2544
|
-
flags?: string[] | undefined;
|
|
2545
|
-
}
|
|
2546
|
-
interface LegacyOptions {
|
|
2547
|
-
// File enumeration
|
|
2548
|
-
cwd?: string | undefined;
|
|
2549
|
-
errorOnUnmatchedPattern?: boolean | undefined;
|
|
2550
|
-
extensions?: string[] | undefined;
|
|
2551
|
-
globInputPaths?: boolean | undefined;
|
|
2552
|
-
ignore?: boolean | undefined;
|
|
2553
|
-
ignorePath?: string | undefined; // Linting
|
|
2554
|
-
allowInlineConfig?: boolean | undefined;
|
|
2555
|
-
baseConfig?: Linter.LegacyConfig | undefined;
|
|
2556
|
-
overrideConfig?: Linter.LegacyConfig | undefined;
|
|
2557
|
-
overrideConfigFile?: string | undefined;
|
|
2558
|
-
plugins?: Record<string, Plugin> | undefined;
|
|
2559
|
-
reportUnusedDisableDirectives?: Linter.StringSeverity | undefined;
|
|
2560
|
-
resolvePluginsRelativeTo?: string | undefined;
|
|
2561
|
-
rulePaths?: string[] | undefined;
|
|
2562
|
-
useEslintrc?: boolean | undefined; // Autofix
|
|
2563
|
-
fix?: boolean | ((message: Linter.LintMessage) => boolean) | undefined;
|
|
2564
|
-
fixTypes?: FixType[] | null | undefined; // Cache-related
|
|
2565
|
-
cache?: boolean | undefined;
|
|
2566
|
-
cacheLocation?: string | undefined;
|
|
2567
|
-
cacheStrategy?: CacheStrategy | undefined; // Other Options
|
|
2568
|
-
flags?: string[] | undefined;
|
|
2569
|
-
}
|
|
2570
|
-
/** A linting result. */
|
|
2571
|
-
interface LintResult {
|
|
2572
|
-
/** The path to the file that was linted. */
|
|
2573
|
-
filePath: string;
|
|
2574
|
-
/** All of the messages for the result. */
|
|
2575
|
-
messages: Linter.LintMessage[];
|
|
2576
|
-
/** All of the suppressed messages for the result. */
|
|
2577
|
-
suppressedMessages: Linter.SuppressedLintMessage[];
|
|
2578
|
-
/** Number of errors for the result. */
|
|
2579
|
-
errorCount: number;
|
|
2580
|
-
/** Number of fatal errors for the result. */
|
|
2581
|
-
fatalErrorCount: number;
|
|
2582
|
-
/** Number of warnings for the result. */
|
|
2583
|
-
warningCount: number;
|
|
2584
|
-
/** Number of fixable errors for the result. */
|
|
2585
|
-
fixableErrorCount: number;
|
|
2586
|
-
/** Number of fixable warnings for the result. */
|
|
2587
|
-
fixableWarningCount: number;
|
|
2588
|
-
/** The source code of the file that was linted, with as many fixes applied as possible. */
|
|
2589
|
-
output?: string | undefined;
|
|
2590
|
-
/** The source code of the file that was linted. */
|
|
2591
|
-
source?: string | undefined;
|
|
2592
|
-
/** The performance statistics collected with the `stats` flag. */
|
|
2593
|
-
stats?: Linter.Stats | undefined;
|
|
2594
|
-
/** The list of used deprecated rules. */
|
|
2595
|
-
usedDeprecatedRules: DeprecatedRuleUse[];
|
|
2596
|
-
}
|
|
2597
|
-
/**
|
|
2598
|
-
* Information provided when the maximum warning threshold is exceeded.
|
|
2599
|
-
*/
|
|
2600
|
-
interface MaxWarningsExceeded {
|
|
2601
|
-
/**
|
|
2602
|
-
* Number of warnings to trigger nonzero exit code.
|
|
2603
|
-
*/
|
|
2604
|
-
maxWarnings: number;
|
|
2605
|
-
/**
|
|
2606
|
-
* Number of warnings found while linting.
|
|
2607
|
-
*/
|
|
2608
|
-
foundWarnings: number;
|
|
2609
|
-
}
|
|
2610
|
-
interface LintResultData {
|
|
2611
|
-
cwd: string;
|
|
2612
|
-
maxWarningsExceeded?: MaxWarningsExceeded | undefined;
|
|
2613
|
-
rulesMeta: {
|
|
2614
|
-
[ruleId: string]: Rule.RuleMetaData;
|
|
76
|
+
/** Linter options */
|
|
77
|
+
linterOptions?: {
|
|
78
|
+
noInlineConfig?: boolean;
|
|
79
|
+
reportUnusedDisableDirectives?: boolean | Severity;
|
|
80
|
+
[key: string]: unknown;
|
|
2615
81
|
};
|
|
82
|
+
/** Processor name or object */
|
|
83
|
+
processor?: string | object;
|
|
84
|
+
/** Plugin configurations */
|
|
85
|
+
plugins?: Record<string, Plugin>;
|
|
86
|
+
/** Rule configurations */
|
|
87
|
+
rules?: Partial<Rules>;
|
|
88
|
+
/** Settings available to all rules */
|
|
89
|
+
settings?: Record<string, unknown>;
|
|
90
|
+
/** Legacy env configuration */
|
|
91
|
+
env?: Record<string, boolean>;
|
|
92
|
+
/** Legacy globals configuration (for backwards compatibility) */
|
|
93
|
+
globals?: GlobalsConfig;
|
|
94
|
+
/** Legacy overrides configuration */
|
|
95
|
+
overrides?: unknown[];
|
|
96
|
+
/** Index signature to accept any additional properties */
|
|
97
|
+
[key: string]: any;
|
|
2616
98
|
}
|
|
2617
|
-
/**
|
|
2618
|
-
* Information about deprecated rules.
|
|
2619
|
-
*/
|
|
2620
|
-
interface DeprecatedRuleUse {
|
|
2621
|
-
/**
|
|
2622
|
-
* The rule ID.
|
|
2623
|
-
*/
|
|
2624
|
-
ruleId: string;
|
|
2625
|
-
/**
|
|
2626
|
-
* The rule IDs that replace this deprecated rule.
|
|
2627
|
-
*/
|
|
2628
|
-
replacedBy: string[];
|
|
2629
|
-
/**
|
|
2630
|
-
* The raw deprecated info provided by the rule.
|
|
2631
|
-
* - Undefined if the rule's `meta.deprecated` property is a boolean.
|
|
2632
|
-
* - Unset when using the legacy eslintrc configuration.
|
|
2633
|
-
*/
|
|
2634
|
-
info?: DeprecatedInfo | undefined;
|
|
2635
|
-
}
|
|
2636
|
-
/**
|
|
2637
|
-
* Metadata about results for formatters.
|
|
2638
|
-
*/
|
|
2639
|
-
interface ResultsMeta {
|
|
2640
|
-
/**
|
|
2641
|
-
* Present if the maxWarnings threshold was exceeded.
|
|
2642
|
-
*/
|
|
2643
|
-
maxWarningsExceeded?: MaxWarningsExceeded | undefined;
|
|
2644
|
-
}
|
|
2645
|
-
/** The type of an object resolved by {@link ESLint.loadFormatter}. */
|
|
2646
|
-
interface LoadedFormatter {
|
|
2647
|
-
/**
|
|
2648
|
-
* Used to call the underlying formatter.
|
|
2649
|
-
* @param results An array of lint results to format.
|
|
2650
|
-
* @param resultsMeta An object with an optional `maxWarningsExceeded` property that will be
|
|
2651
|
-
* passed to the underlying formatter function along with other properties set by ESLint.
|
|
2652
|
-
* This argument can be omitted if `maxWarningsExceeded` is not needed.
|
|
2653
|
-
* @return The formatter output.
|
|
2654
|
-
*/
|
|
2655
|
-
format(results: LintResult[], resultsMeta?: ResultsMeta): string | Promise<string>;
|
|
2656
|
-
} // The documented type name is `LoadedFormatter`, but `Formatter` has been historically more used.
|
|
2657
|
-
type Formatter = LoadedFormatter;
|
|
2658
|
-
/**
|
|
2659
|
-
* The expected signature of a custom formatter.
|
|
2660
|
-
* @param results An array of lint results to format.
|
|
2661
|
-
* @param context Additional information for the formatter.
|
|
2662
|
-
* @return The formatter output.
|
|
2663
|
-
*/
|
|
2664
|
-
type FormatterFunction = (results: LintResult[], context: LintResultData) => string | Promise<string>; // Docs reference the types by those name
|
|
2665
|
-
type EditInfo = Rule.Fix;
|
|
2666
99
|
}
|
|
2667
|
-
//#endregion
|
|
2668
|
-
//#region src/types.d.ts
|
|
2669
100
|
type OxlintConfigPlugins = string[];
|
|
2670
101
|
type OxlintConfigJsPlugins = string[];
|
|
2671
102
|
type OxlintConfigCategories = Partial<Record<Category, unknown>>;
|
|
@@ -2673,26 +104,31 @@ type OxlintConfigEnv = Record<string, boolean>;
|
|
|
2673
104
|
type OxlintConfigIgnorePatterns = string[];
|
|
2674
105
|
type OxlintSupportedSettingsKey = 'jsx-a11y' | 'next' | 'react' | 'jsdoc' | 'vitest';
|
|
2675
106
|
type OxlintSettings = { [K in OxlintSupportedSettingsKey]?: Record<string, unknown> } & Record<string, Record<string, unknown> | undefined>;
|
|
107
|
+
type OxlintOptions = {
|
|
108
|
+
typeAware?: boolean;
|
|
109
|
+
typeCheck?: boolean;
|
|
110
|
+
};
|
|
2676
111
|
type OxlintConfigOverride = {
|
|
2677
112
|
files: string[];
|
|
2678
113
|
env?: OxlintConfigEnv;
|
|
2679
|
-
globals?:
|
|
114
|
+
globals?: ESLint.GlobalsConfig;
|
|
2680
115
|
plugins?: OxlintConfigPlugins;
|
|
2681
116
|
jsPlugins?: OxlintConfigJsPlugins;
|
|
2682
117
|
categories?: OxlintConfigCategories;
|
|
2683
|
-
rules?: Partial<
|
|
118
|
+
rules?: Partial<ESLint.RulesRecord>;
|
|
2684
119
|
};
|
|
2685
120
|
type OxlintConfig = {
|
|
2686
121
|
$schema?: string;
|
|
2687
122
|
env?: OxlintConfigEnv;
|
|
2688
|
-
globals?:
|
|
123
|
+
globals?: ESLint.GlobalsConfig;
|
|
2689
124
|
plugins?: OxlintConfigPlugins;
|
|
2690
125
|
jsPlugins?: OxlintConfigJsPlugins;
|
|
2691
126
|
categories?: OxlintConfigCategories;
|
|
2692
|
-
rules?: Partial<
|
|
127
|
+
rules?: Partial<ESLint.RulesRecord>;
|
|
2693
128
|
overrides?: OxlintConfigOverride[];
|
|
2694
129
|
ignorePatterns?: OxlintConfigIgnorePatterns;
|
|
2695
130
|
settings?: OxlintSettings;
|
|
131
|
+
options?: OxlintOptions;
|
|
2696
132
|
};
|
|
2697
133
|
type RuleSkippedCategory = 'nursery' | 'type-aware' | 'not-implemented' | 'unsupported' | 'js-plugins';
|
|
2698
134
|
type SkippedCategoryGroup = Record<RuleSkippedCategory, string[]>;
|
|
@@ -2713,6 +149,6 @@ type Options = {
|
|
|
2713
149
|
type Category = 'style' | 'correctness' | 'nursery' | 'suspicious' | 'pedantic' | 'perf' | 'restriction';
|
|
2714
150
|
//#endregion
|
|
2715
151
|
//#region src/index.d.ts
|
|
2716
|
-
declare const main: (configs:
|
|
152
|
+
declare const main: (configs: ESLint.Config | ESLint.Config[] | Promise<ESLint.Config> | Promise<ESLint.Config[]>, oxlintConfig?: OxlintConfig, options?: Options) => Promise<OxlintConfig>;
|
|
2717
153
|
//#endregion
|
|
2718
154
|
export { main as default };
|