@octohash/eslint-config 0.1.3 → 0.2.1

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.
@@ -0,0 +1,1601 @@
1
+ import * as _antfu_eslint_config0 from "@antfu/eslint-config";
2
+ import { Awaitable, OptionsConfig, OptionsFiles, OptionsFormatters, OptionsOverrides, TypedFlatConfigItem } from "@antfu/eslint-config";
3
+ import { Linter, Rule } from "eslint";
4
+
5
+ //#region node_modules/.pnpm/@types+json-schema@7.0.15/node_modules/@types/json-schema/index.d.ts
6
+ // ==================================================================================================
7
+ // JSON Schema Draft 04
8
+ // ==================================================================================================
9
+ /**
10
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.1
11
+ */
12
+ type JSONSchema4TypeName = "string" //
13
+ | "number" | "integer" | "boolean" | "object" | "array" | "null" | "any";
14
+ /**
15
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-04#section-3.5
16
+ */
17
+ type JSONSchema4Type = string //
18
+ | number | boolean | JSONSchema4Object | JSONSchema4Array | null;
19
+ // Workaround for infinite type recursion
20
+ interface JSONSchema4Object {
21
+ [key: string]: JSONSchema4Type;
22
+ }
23
+ // Workaround for infinite type recursion
24
+ // https://github.com/Microsoft/TypeScript/issues/3496#issuecomment-128553540
25
+ interface JSONSchema4Array extends Array<JSONSchema4Type> {}
26
+ /**
27
+ * Meta schema
28
+ *
29
+ * Recommended values:
30
+ * - 'http://json-schema.org/schema#'
31
+ * - 'http://json-schema.org/hyper-schema#'
32
+ * - 'http://json-schema.org/draft-04/schema#'
33
+ * - 'http://json-schema.org/draft-04/hyper-schema#'
34
+ * - 'http://json-schema.org/draft-03/schema#'
35
+ * - 'http://json-schema.org/draft-03/hyper-schema#'
36
+ *
37
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-5
38
+ */
39
+ type JSONSchema4Version = string;
40
+ /**
41
+ * JSON Schema V4
42
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-04
43
+ */
44
+ interface JSONSchema4 {
45
+ id?: string | undefined;
46
+ $ref?: string | undefined;
47
+ $schema?: JSONSchema4Version | undefined;
48
+ /**
49
+ * This attribute is a string that provides a short description of the
50
+ * instance property.
51
+ *
52
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.21
53
+ */
54
+ title?: string | undefined;
55
+ /**
56
+ * This attribute is a string that provides a full description of the of
57
+ * purpose the instance property.
58
+ *
59
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.22
60
+ */
61
+ description?: string | undefined;
62
+ default?: JSONSchema4Type | undefined;
63
+ multipleOf?: number | undefined;
64
+ maximum?: number | undefined;
65
+ exclusiveMaximum?: boolean | undefined;
66
+ minimum?: number | undefined;
67
+ exclusiveMinimum?: boolean | undefined;
68
+ maxLength?: number | undefined;
69
+ minLength?: number | undefined;
70
+ pattern?: string | undefined;
71
+ /**
72
+ * May only be defined when "items" is defined, and is a tuple of JSONSchemas.
73
+ *
74
+ * This provides a definition for additional items in an array instance
75
+ * when tuple definitions of the items is provided. This can be false
76
+ * to indicate additional items in the array are not allowed, or it can
77
+ * be a schema that defines the schema of the additional items.
78
+ *
79
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.6
80
+ */
81
+ additionalItems?: boolean | JSONSchema4 | undefined;
82
+ /**
83
+ * This attribute defines the allowed items in an instance array, and
84
+ * MUST be a schema or an array of schemas. The default value is an
85
+ * empty schema which allows any value for items in the instance array.
86
+ *
87
+ * When this attribute value is a schema and the instance value is an
88
+ * array, then all the items in the array MUST be valid according to the
89
+ * schema.
90
+ *
91
+ * When this attribute value is an array of schemas and the instance
92
+ * value is an array, each position in the instance array MUST conform
93
+ * to the schema in the corresponding position for this array. This
94
+ * called tuple typing. When tuple typing is used, additional items are
95
+ * allowed, disallowed, or constrained by the "additionalItems"
96
+ * (Section 5.6) attribute using the same rules as
97
+ * "additionalProperties" (Section 5.4) for objects.
98
+ *
99
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.5
100
+ */
101
+ items?: JSONSchema4 | JSONSchema4[] | undefined;
102
+ maxItems?: number | undefined;
103
+ minItems?: number | undefined;
104
+ uniqueItems?: boolean | undefined;
105
+ maxProperties?: number | undefined;
106
+ minProperties?: number | undefined;
107
+ /**
108
+ * This attribute indicates if the instance must have a value, and not
109
+ * be undefined. This is false by default, making the instance
110
+ * optional.
111
+ *
112
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.7
113
+ */
114
+ required?: boolean | string[] | undefined;
115
+ /**
116
+ * This attribute defines a schema for all properties that are not
117
+ * explicitly defined in an object type definition. If specified, the
118
+ * value MUST be a schema or a boolean. If false is provided, no
119
+ * additional properties are allowed beyond the properties defined in
120
+ * the schema. The default value is an empty schema which allows any
121
+ * value for additional properties.
122
+ *
123
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.4
124
+ */
125
+ additionalProperties?: boolean | JSONSchema4 | undefined;
126
+ definitions?: {
127
+ [k: string]: JSONSchema4;
128
+ } | undefined;
129
+ /**
130
+ * This attribute is an object with property definitions that define the
131
+ * valid values of instance object property values. When the instance
132
+ * value is an object, the property values of the instance object MUST
133
+ * conform to the property definitions in this object. In this object,
134
+ * each property definition's value MUST be a schema, and the property's
135
+ * name MUST be the name of the instance property that it defines. The
136
+ * instance property value MUST be valid according to the schema from
137
+ * the property definition. Properties are considered unordered, the
138
+ * order of the instance properties MAY be in any order.
139
+ *
140
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.2
141
+ */
142
+ properties?: {
143
+ [k: string]: JSONSchema4;
144
+ } | undefined;
145
+ /**
146
+ * This attribute is an object that defines the schema for a set of
147
+ * property names of an object instance. The name of each property of
148
+ * this attribute's object is a regular expression pattern in the ECMA
149
+ * 262/Perl 5 format, while the value is a schema. If the pattern
150
+ * matches the name of a property on the instance object, the value of
151
+ * the instance's property MUST be valid against the pattern name's
152
+ * schema value.
153
+ *
154
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.3
155
+ */
156
+ patternProperties?: {
157
+ [k: string]: JSONSchema4;
158
+ } | undefined;
159
+ dependencies?: {
160
+ [k: string]: JSONSchema4 | string[];
161
+ } | undefined;
162
+ /**
163
+ * This provides an enumeration of all possible values that are valid
164
+ * for the instance property. This MUST be an array, and each item in
165
+ * the array represents a possible value for the instance value. If
166
+ * this attribute is defined, the instance value MUST be one of the
167
+ * values in the array in order for the schema to be valid.
168
+ *
169
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.19
170
+ */
171
+ enum?: JSONSchema4Type[] | undefined;
172
+ /**
173
+ * A single type, or a union of simple types
174
+ */
175
+ type?: JSONSchema4TypeName | JSONSchema4TypeName[] | undefined;
176
+ allOf?: JSONSchema4[] | undefined;
177
+ anyOf?: JSONSchema4[] | undefined;
178
+ oneOf?: JSONSchema4[] | undefined;
179
+ not?: JSONSchema4 | undefined;
180
+ /**
181
+ * The value of this property MUST be another schema which will provide
182
+ * a base schema which the current schema will inherit from. The
183
+ * inheritance rules are such that any instance that is valid according
184
+ * to the current schema MUST be valid according to the referenced
185
+ * schema. This MAY also be an array, in which case, the instance MUST
186
+ * be valid for all the schemas in the array. A schema that extends
187
+ * another schema MAY define additional attributes, constrain existing
188
+ * attributes, or add other constraints.
189
+ *
190
+ * Conceptually, the behavior of extends can be seen as validating an
191
+ * instance against all constraints in the extending schema as well as
192
+ * the extended schema(s).
193
+ *
194
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-03#section-5.26
195
+ */
196
+ extends?: string | string[] | undefined;
197
+ /**
198
+ * @see https://tools.ietf.org/html/draft-zyp-json-schema-04#section-5.6
199
+ */
200
+ [k: string]: any;
201
+ format?: string | undefined;
202
+ }
203
+ //#endregion
204
+ //#region node_modules/.pnpm/@eslint+core@1.1.0/node_modules/@eslint/core/dist/esm/types.d.ts
205
+ /**
206
+ * Represents an error inside of a file.
207
+ */
208
+ interface FileError {
209
+ message: string;
210
+ line: number;
211
+ column: number;
212
+ endLine?: number;
213
+ endColumn?: number;
214
+ }
215
+ /**
216
+ * Represents a problem found in a file.
217
+ */
218
+ interface FileProblem {
219
+ ruleId: string | null;
220
+ message: string;
221
+ loc: SourceLocation;
222
+ }
223
+ /**
224
+ * Represents the start and end coordinates of a node inside the source.
225
+ */
226
+ interface SourceLocation {
227
+ start: Position;
228
+ end: Position;
229
+ }
230
+ /**
231
+ * Represents a location coordinate inside the source. ESLint-style formats
232
+ * have just `line` and `column` while others may have `offset` as well.
233
+ */
234
+ interface Position {
235
+ line: number;
236
+ column: number;
237
+ }
238
+ /**
239
+ * Represents a range of characters in the source.
240
+ */
241
+ type SourceRange = [number, number];
242
+ /**
243
+ * What the rule is responsible for finding:
244
+ * - `problem` means the rule has noticed a potential error.
245
+ * - `suggestion` means the rule suggests an alternate or better approach.
246
+ * - `layout` means the rule is looking at spacing, indentation, etc.
247
+ */
248
+ type RuleType = "problem" | "suggestion" | "layout";
249
+ /**
250
+ * The type of fix the rule can provide:
251
+ * - `code` means the rule can fix syntax.
252
+ * - `whitespace` means the rule can fix spacing and indentation.
253
+ */
254
+ type RuleFixType = "code" | "whitespace";
255
+ /**
256
+ * An object containing visitor information for a rule. Each method is either the
257
+ * name of a node type or a selector, or is a method that will be called at specific
258
+ * times during the traversal.
259
+ */
260
+ type RuleVisitor = Record<string, ((...args: any[]) => void) | undefined>;
261
+ /**
262
+ * Rule meta information used for documentation.
263
+ */
264
+ interface RulesMetaDocs {
265
+ /**
266
+ * A short description of the rule.
267
+ */
268
+ description?: string | undefined;
269
+ /**
270
+ * The URL to the documentation for the rule.
271
+ */
272
+ url?: string | undefined;
273
+ /**
274
+ * Indicates if the rule is generally recommended for all users.
275
+ *
276
+ * Note - this will always be a boolean for core rules, but may be used in any way by plugins.
277
+ */
278
+ recommended?: unknown;
279
+ /**
280
+ * Indicates if the rule is frozen (no longer accepting feature requests).
281
+ */
282
+ frozen?: boolean | undefined;
283
+ }
284
+ /**
285
+ * Meta information about a rule.
286
+ */
287
+ interface RulesMeta<MessageIds extends string = string, RuleOptions = unknown[], ExtRuleDocs = unknown> {
288
+ /**
289
+ * Properties that are used when documenting the rule.
290
+ */
291
+ docs?: (RulesMetaDocs & ExtRuleDocs) | undefined;
292
+ /**
293
+ * The type of rule.
294
+ */
295
+ type?: RuleType | undefined;
296
+ /**
297
+ * The schema for the rule options. Required if the rule has options.
298
+ */
299
+ schema?: JSONSchema4 | JSONSchema4[] | false | undefined;
300
+ /**
301
+ * Any default options to be recursively merged on top of any user-provided options.
302
+ */
303
+ defaultOptions?: RuleOptions;
304
+ /**
305
+ * The messages that the rule can report.
306
+ */
307
+ messages?: Record<MessageIds, string>;
308
+ /**
309
+ * Indicates whether the rule has been deprecated or provides additional metadata about the deprecation. Omit if not deprecated.
310
+ */
311
+ deprecated?: boolean | DeprecatedInfo | undefined;
312
+ /**
313
+ * @deprecated Use deprecated.replacedBy instead.
314
+ * The name of the rule(s) this rule was replaced by, if it was deprecated.
315
+ */
316
+ replacedBy?: readonly string[] | undefined;
317
+ /**
318
+ * Indicates if the rule is fixable, and if so, what type of fix it provides.
319
+ */
320
+ fixable?: RuleFixType | undefined;
321
+ /**
322
+ * Indicates if the rule may provide suggestions.
323
+ */
324
+ hasSuggestions?: boolean | undefined;
325
+ /**
326
+ * The language the rule is intended to lint.
327
+ */
328
+ language?: string;
329
+ /**
330
+ * The dialects of `language` that the rule is intended to lint.
331
+ */
332
+ dialects?: string[];
333
+ }
334
+ /**
335
+ * Provides additional metadata about a deprecation.
336
+ */
337
+ interface DeprecatedInfo {
338
+ /**
339
+ * General message presented to the user, e.g. for the key rule why the rule
340
+ * is deprecated or for info how to replace the rule.
341
+ */
342
+ message?: string;
343
+ /**
344
+ * URL to more information about this deprecation in general.
345
+ */
346
+ url?: string;
347
+ /**
348
+ * An empty array explicitly states that there is no replacement.
349
+ */
350
+ replacedBy?: ReplacedByInfo[];
351
+ /**
352
+ * The package version since when the rule is deprecated (should use full
353
+ * semver without a leading "v").
354
+ */
355
+ deprecatedSince?: string;
356
+ /**
357
+ * The estimated version when the rule is removed (probably the next major
358
+ * version). null means the rule is "frozen" (will be available but will not
359
+ * be changed).
360
+ */
361
+ availableUntil?: string | null;
362
+ }
363
+ /**
364
+ * Provides metadata about a replacement
365
+ */
366
+ interface ReplacedByInfo {
367
+ /**
368
+ * General message presented to the user, e.g. how to replace the rule
369
+ */
370
+ message?: string;
371
+ /**
372
+ * URL to more information about this replacement in general
373
+ */
374
+ url?: string;
375
+ /**
376
+ * Name should be "eslint" if the replacement is an ESLint core rule. Omit
377
+ * the property if the replacement is in the same plugin.
378
+ */
379
+ plugin?: ExternalSpecifier;
380
+ /**
381
+ * Name and documentation of the replacement rule
382
+ */
383
+ rule?: ExternalSpecifier;
384
+ }
385
+ /**
386
+ * Specifies the name and url of an external resource. At least one property
387
+ * should be set.
388
+ */
389
+ interface ExternalSpecifier {
390
+ /**
391
+ * Name of the referenced plugin / rule.
392
+ */
393
+ name?: string;
394
+ /**
395
+ * URL pointing to documentation for the plugin / rule.
396
+ */
397
+ url?: string;
398
+ }
399
+ /**
400
+ * Generic type for `RuleContext`.
401
+ */
402
+ interface RuleContextTypeOptions {
403
+ LangOptions: LanguageOptions;
404
+ Code: SourceCode;
405
+ RuleOptions: unknown[];
406
+ Node: unknown;
407
+ MessageIds: string;
408
+ }
409
+ /**
410
+ * Represents the context object that is passed to a rule. This object contains
411
+ * information about the current state of the linting process and is the rule's
412
+ * view into the outside world.
413
+ */
414
+ interface RuleContext<Options extends RuleContextTypeOptions = RuleContextTypeOptions> {
415
+ /**
416
+ * The current working directory for the session.
417
+ */
418
+ cwd: string;
419
+ /**
420
+ * The filename of the file being linted.
421
+ */
422
+ filename: string;
423
+ /**
424
+ * The physical filename of the file being linted.
425
+ */
426
+ physicalFilename: string;
427
+ /**
428
+ * The source code object that the rule is running on.
429
+ */
430
+ sourceCode: Options["Code"];
431
+ /**
432
+ * Shared settings for the configuration.
433
+ */
434
+ settings: SettingsConfig;
435
+ /**
436
+ * The language options for the configuration.
437
+ */
438
+ languageOptions: Options["LangOptions"];
439
+ /**
440
+ * The rule ID.
441
+ */
442
+ id: string;
443
+ /**
444
+ * The rule's configured options.
445
+ */
446
+ options: Options["RuleOptions"];
447
+ /**
448
+ * The report function that the rule should use to report problems.
449
+ * @param violation The violation to report.
450
+ */
451
+ report(violation: ViolationReport<Options["Node"], Options["MessageIds"]>): void;
452
+ }
453
+ /**
454
+ * Manager of text edits for a rule fix.
455
+ */
456
+ interface RuleTextEditor<EditableSyntaxElement = unknown> {
457
+ /**
458
+ * Inserts text after the specified node or token.
459
+ * @param syntaxElement The node or token to insert after.
460
+ * @param text The edit to insert after the node or token.
461
+ */
462
+ insertTextAfter(syntaxElement: EditableSyntaxElement, text: string): RuleTextEdit;
463
+ /**
464
+ * Inserts text after the specified range.
465
+ * @param range The range to insert after.
466
+ * @param text The edit to insert after the range.
467
+ */
468
+ insertTextAfterRange(range: SourceRange, text: string): RuleTextEdit;
469
+ /**
470
+ * Inserts text before the specified node or token.
471
+ * @param syntaxElement A syntax element with location information to insert before.
472
+ * @param text The edit to insert before the node or token.
473
+ */
474
+ insertTextBefore(syntaxElement: EditableSyntaxElement, text: string): RuleTextEdit;
475
+ /**
476
+ * Inserts text before the specified range.
477
+ * @param range The range to insert before.
478
+ * @param text The edit to insert before the range.
479
+ */
480
+ insertTextBeforeRange(range: SourceRange, text: string): RuleTextEdit;
481
+ /**
482
+ * Removes the specified node or token.
483
+ * @param syntaxElement A syntax element with location information to remove.
484
+ * @returns The edit to remove the node or token.
485
+ */
486
+ remove(syntaxElement: EditableSyntaxElement): RuleTextEdit;
487
+ /**
488
+ * Removes the specified range.
489
+ * @param range The range to remove.
490
+ * @returns The edit to remove the range.
491
+ */
492
+ removeRange(range: SourceRange): RuleTextEdit;
493
+ /**
494
+ * Replaces the specified node or token with the given text.
495
+ * @param syntaxElement A syntax element with location information to replace.
496
+ * @param text The text to replace the node or token with.
497
+ * @returns The edit to replace the node or token.
498
+ */
499
+ replaceText(syntaxElement: EditableSyntaxElement, text: string): RuleTextEdit;
500
+ /**
501
+ * Replaces the specified range with the given text.
502
+ * @param range The range to replace.
503
+ * @param text The text to replace the range with.
504
+ * @returns The edit to replace the range.
505
+ */
506
+ replaceTextRange(range: SourceRange, text: string): RuleTextEdit;
507
+ }
508
+ /**
509
+ * Represents a fix for a rule violation implemented as a text edit.
510
+ */
511
+ interface RuleTextEdit {
512
+ /**
513
+ * The range to replace.
514
+ */
515
+ range: SourceRange;
516
+ /**
517
+ * The text to insert.
518
+ */
519
+ text: string;
520
+ }
521
+ /**
522
+ * Fixes a violation.
523
+ * @param fixer The text editor to apply the fix.
524
+ * @returns The fix(es) for the violation.
525
+ */
526
+ type RuleFixer = (fixer: RuleTextEditor) => RuleTextEdit | Iterable<RuleTextEdit> | null;
527
+ /**
528
+ * Data that can be used to fill placeholders in error messages.
529
+ */
530
+ type MessagePlaceholderData = Record<string, string | number | boolean | bigint | null | undefined>;
531
+ interface ViolationReportBase {
532
+ /**
533
+ * The data to insert into the message.
534
+ */
535
+ data?: MessagePlaceholderData | undefined;
536
+ /**
537
+ * The fix to be applied for the violation.
538
+ */
539
+ fix?: RuleFixer | null | undefined;
540
+ /**
541
+ * An array of suggested fixes for the problem. These fixes may change the
542
+ * behavior of the code, so they are not applied automatically.
543
+ */
544
+ suggest?: SuggestedEdit[] | null | undefined;
545
+ }
546
+ type ViolationMessage<MessageIds = string> = {
547
+ message: string;
548
+ } | {
549
+ messageId: MessageIds;
550
+ };
551
+ type ViolationLocation<Node> = {
552
+ loc: SourceLocation | Position;
553
+ } | {
554
+ node: Node;
555
+ };
556
+ type ViolationReport<Node = unknown, MessageIds = string> = ViolationReportBase & ViolationMessage<MessageIds> & ViolationLocation<Node>;
557
+ interface SuggestedEditBase {
558
+ /**
559
+ * The data to insert into the message.
560
+ */
561
+ data?: MessagePlaceholderData | undefined;
562
+ /**
563
+ * The fix to be applied for the suggestion.
564
+ */
565
+ fix: RuleFixer;
566
+ }
567
+ type SuggestionMessage = {
568
+ desc: string;
569
+ } | {
570
+ messageId: string;
571
+ };
572
+ /**
573
+ * A suggested edit for a rule violation.
574
+ */
575
+ type SuggestedEdit = SuggestedEditBase & SuggestionMessage;
576
+ /**
577
+ * The normalized version of a lint suggestion.
578
+ */
579
+ interface LintSuggestion {
580
+ /** A short description. */
581
+ desc: string;
582
+ /** Fix result info. */
583
+ fix: RuleTextEdit;
584
+ /** Id referencing a message for the description. */
585
+ messageId?: string | undefined;
586
+ }
587
+ /**
588
+ * The normalized version of a lint violation message.
589
+ */
590
+ interface LintMessage {
591
+ /** The 1-based column number. */
592
+ column: number;
593
+ /** The 1-based line number. */
594
+ line: number;
595
+ /** The 1-based column number of the end location. */
596
+ endColumn?: number | undefined;
597
+ /** The 1-based line number of the end location. */
598
+ endLine?: number | undefined;
599
+ /** The ID of the rule which makes this message. */
600
+ ruleId: string | null;
601
+ /** The reported message. */
602
+ message: string;
603
+ /** The ID of the message in the rule's meta. */
604
+ messageId?: string | undefined;
605
+ /** If `true` then this is a fatal error. */
606
+ fatal?: true | undefined;
607
+ /** The severity of this message. */
608
+ severity: Exclude<SeverityLevel, 0>;
609
+ /** Information for autofix. */
610
+ fix?: RuleTextEdit | undefined;
611
+ /** Information for suggestions. */
612
+ suggestions?: LintSuggestion[] | undefined;
613
+ }
614
+ /**
615
+ * Generic options for the `RuleDefinition` type.
616
+ */
617
+ interface RuleDefinitionTypeOptions {
618
+ LangOptions: LanguageOptions;
619
+ Code: SourceCode;
620
+ RuleOptions: unknown[];
621
+ Visitor: RuleVisitor;
622
+ Node: unknown;
623
+ MessageIds: string;
624
+ ExtRuleDocs: unknown;
625
+ }
626
+ /**
627
+ * The definition of an ESLint rule.
628
+ */
629
+ interface RuleDefinition<Options extends RuleDefinitionTypeOptions = RuleDefinitionTypeOptions> {
630
+ /**
631
+ * The meta information for the rule.
632
+ */
633
+ meta?: RulesMeta<Options["MessageIds"], Options["RuleOptions"], Options["ExtRuleDocs"]>;
634
+ /**
635
+ * Creates the visitor that ESLint uses to apply the rule during traversal.
636
+ * @param context The rule context.
637
+ * @returns The rule visitor.
638
+ */
639
+ create(context: RuleContext<{
640
+ LangOptions: Options["LangOptions"];
641
+ Code: Options["Code"];
642
+ RuleOptions: Options["RuleOptions"];
643
+ Node: Options["Node"];
644
+ MessageIds: Options["MessageIds"];
645
+ }>): Options["Visitor"];
646
+ }
647
+ /**
648
+ * The human readable severity level used in a configuration.
649
+ */
650
+ type SeverityName = "off" | "warn" | "error";
651
+ /**
652
+ * The numeric severity level for a rule.
653
+ *
654
+ * - `0` means off.
655
+ * - `1` means warn.
656
+ * - `2` means error.
657
+ */
658
+ type SeverityLevel = 0 | 1 | 2;
659
+ /**
660
+ * The severity of a rule in a configuration.
661
+ */
662
+ type Severity = SeverityName | SeverityLevel;
663
+ /**
664
+ * Represents the metadata for an object, such as a plugin or processor.
665
+ */
666
+ interface ObjectMetaProperties {
667
+ /** @deprecated Use `meta.name` instead. */
668
+ name?: string | undefined;
669
+ /** @deprecated Use `meta.version` instead. */
670
+ version?: string | undefined;
671
+ meta?: {
672
+ name?: string | undefined;
673
+ version?: string | undefined;
674
+ };
675
+ }
676
+ /**
677
+ * Represents the configuration options for the core linter.
678
+ */
679
+ interface LinterOptionsConfig {
680
+ /**
681
+ * Indicates whether or not inline configuration is evaluated.
682
+ */
683
+ noInlineConfig?: boolean;
684
+ /**
685
+ * Indicates what to do when an unused disable directive is found.
686
+ */
687
+ reportUnusedDisableDirectives?: boolean | Severity;
688
+ /**
689
+ * A severity value indicating if and how unused inline configs should be
690
+ * tracked and reported.
691
+ */
692
+ reportUnusedInlineConfigs?: Severity;
693
+ }
694
+ /**
695
+ * The configuration for a rule.
696
+ */
697
+ type RuleConfig<RuleOptions extends unknown[] = unknown[]> = Severity | [Severity, ...Partial<RuleOptions>];
698
+ /**
699
+ * A collection of rules and their configurations.
700
+ */
701
+ interface RulesConfig {
702
+ [key: string]: RuleConfig;
703
+ }
704
+ /**
705
+ * A collection of settings.
706
+ */
707
+ interface SettingsConfig {
708
+ [key: string]: unknown;
709
+ }
710
+ /**
711
+ * The configuration for a set of files.
712
+ */
713
+ interface ConfigObject<Rules extends RulesConfig = RulesConfig> {
714
+ /**
715
+ * A string to identify the configuration object. Used in error messages and
716
+ * inspection tools.
717
+ */
718
+ name?: string;
719
+ /**
720
+ * Path to the directory where the configuration object should apply.
721
+ * `files` and `ignores` patterns in the configuration object are
722
+ * interpreted as relative to this path.
723
+ */
724
+ basePath?: string;
725
+ /**
726
+ * An array of glob patterns indicating the files that the configuration
727
+ * object should apply to. If not specified, the configuration object applies
728
+ * to all files
729
+ */
730
+ files?: (string | string[])[];
731
+ /**
732
+ * An array of glob patterns indicating the files that the configuration
733
+ * object should not apply to. If not specified, the configuration object
734
+ * applies to all files matched by files
735
+ */
736
+ ignores?: string[];
737
+ /**
738
+ * The name of the language used for linting. This is used to determine the
739
+ * parser and other language-specific settings.
740
+ * @since 9.7.0
741
+ */
742
+ language?: string;
743
+ /**
744
+ * An object containing settings related to how the language is configured for
745
+ * linting.
746
+ */
747
+ languageOptions?: LanguageOptions;
748
+ /**
749
+ * An object containing settings related to the linting process
750
+ */
751
+ linterOptions?: LinterOptionsConfig;
752
+ /**
753
+ * Either an object containing preprocess() and postprocess() methods or a
754
+ * string indicating the name of a processor inside of a plugin
755
+ * (i.e., "pluginName/processorName").
756
+ */
757
+ processor?: string | Processor;
758
+ /**
759
+ * An object containing a name-value mapping of plugin names to plugin objects.
760
+ * When files is specified, these plugins are only available to the matching files.
761
+ */
762
+ plugins?: Record<string, Plugin>;
763
+ /**
764
+ * An object containing the configured rules. When files or ignores are specified,
765
+ * these rule configurations are only available to the matching files.
766
+ */
767
+ rules?: Partial<Rules>;
768
+ /**
769
+ * An object containing name-value pairs of information that should be
770
+ * available to all rules.
771
+ */
772
+ settings?: SettingsConfig;
773
+ }
774
+ /** @deprecated Only supported in legacy eslintrc config format. */
775
+ type GlobalAccess = boolean | "off" | "readable" | "readonly" | "writable" | "writeable";
776
+ /** @deprecated Only supported in legacy eslintrc config format. */
777
+ interface GlobalsConfig {
778
+ [name: string]: GlobalAccess;
779
+ }
780
+ /**
781
+ * The ECMAScript version of the code being linted.
782
+ * @deprecated Only supported in legacy eslintrc config format.
783
+ */
784
+ type EcmaVersion = 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";
785
+ /**
786
+ * The type of JavaScript source code.
787
+ * @deprecated Only supported in legacy eslintrc config format.
788
+ */
789
+ type JavaScriptSourceType = "script" | "module" | "commonjs";
790
+ /**
791
+ * Parser options.
792
+ * @deprecated Only supported in legacy eslintrc config format.
793
+ * @see [Specifying Parser Options](https://eslint.org/docs/latest/use/configure/language-options#specifying-parser-options)
794
+ */
795
+ interface JavaScriptParserOptionsConfig {
796
+ /**
797
+ * Allow the use of reserved words as identifiers (if `ecmaVersion` is 3).
798
+ *
799
+ * @default false
800
+ */
801
+ allowReserved?: boolean | undefined;
802
+ /**
803
+ * Accepts any valid ECMAScript version number or `'latest'`:
804
+ *
805
+ * - A version: es3, es5, es6, es7, es8, es9, es10, es11, es12, es13, es14, ..., or
806
+ * - A year: es2015, es2016, es2017, es2018, es2019, es2020, es2021, es2022, es2023, ..., or
807
+ * - `'latest'`
808
+ *
809
+ * When it's a version or a year, the value must be a number - so do not include the `es` prefix.
810
+ *
811
+ * 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
812
+ *
813
+ * @default 5
814
+ */
815
+ ecmaVersion?: EcmaVersion | undefined;
816
+ /**
817
+ * The type of JavaScript source code. Possible values are "script" for
818
+ * traditional script files, "module" for ECMAScript modules (ESM), and
819
+ * "commonjs" for CommonJS files.
820
+ *
821
+ * @default 'script'
822
+ *
823
+ * @see https://eslint.org/docs/latest/use/configure/language-options-deprecated#specifying-parser-options
824
+ */
825
+ sourceType?: JavaScriptSourceType | undefined;
826
+ /**
827
+ * An object indicating which additional language features you'd like to use.
828
+ *
829
+ * @see https://eslint.org/docs/latest/use/configure/language-options-deprecated#specifying-parser-options
830
+ */
831
+ ecmaFeatures?: {
832
+ globalReturn?: boolean | undefined;
833
+ impliedStrict?: boolean | undefined;
834
+ jsx?: boolean | undefined;
835
+ [key: string]: any;
836
+ } | undefined;
837
+ [key: string]: any;
838
+ }
839
+ /** @deprecated Only supported in legacy eslintrc config format. */
840
+ interface EnvironmentConfig {
841
+ /** The definition of global variables. */
842
+ globals?: GlobalsConfig | undefined;
843
+ /** The parser options that will be enabled under this environment. */
844
+ parserOptions?: JavaScriptParserOptionsConfig | undefined;
845
+ }
846
+ /**
847
+ * A configuration object that may have a `rules` block.
848
+ */
849
+ interface HasRules<Rules extends RulesConfig = RulesConfig> {
850
+ rules?: Partial<Rules> | undefined;
851
+ }
852
+ /**
853
+ * ESLint legacy configuration.
854
+ *
855
+ * @see [ESLint Legacy Configuration](https://eslint.org/docs/latest/use/configure/)
856
+ */
857
+ interface BaseConfig<Rules extends RulesConfig = RulesConfig, OverrideRules extends RulesConfig = Rules> extends HasRules<Rules> {
858
+ $schema?: string | undefined;
859
+ /**
860
+ * An environment provides predefined global variables.
861
+ *
862
+ * @see [Environments](https://eslint.org/docs/latest/use/configure/language-options-deprecated#specifying-environments)
863
+ */
864
+ env?: {
865
+ [name: string]: boolean;
866
+ } | undefined;
867
+ /**
868
+ * Extending configuration files.
869
+ *
870
+ * @see [Extends](https://eslint.org/docs/latest/use/configure/configuration-files-deprecated#extending-configuration-files)
871
+ */
872
+ extends?: string | string[] | undefined;
873
+ /**
874
+ * Specifying globals.
875
+ *
876
+ * @see [Globals](https://eslint.org/docs/latest/use/configure/language-options-deprecated#specifying-globals)
877
+ */
878
+ globals?: GlobalsConfig | undefined;
879
+ /**
880
+ * Disable processing of inline comments.
881
+ *
882
+ * @see [Disabling Inline Comments](https://eslint.org/docs/latest/use/configure/rules-deprecated#disabling-inline-comments)
883
+ */
884
+ noInlineConfig?: boolean | undefined;
885
+ /**
886
+ * Overrides can be used to use a differing configuration for matching sub-directories and files.
887
+ *
888
+ * @see [How do overrides work](https://eslint.org/docs/latest/use/configure/configuration-files-deprecated#how-do-overrides-work)
889
+ */
890
+ overrides?: ConfigOverride<OverrideRules>[] | undefined;
891
+ /**
892
+ * Parser.
893
+ *
894
+ * @see [Working with Custom Parsers](https://eslint.org/docs/latest/extend/custom-parsers)
895
+ * @see [Specifying Parser](https://eslint.org/docs/latest/use/configure/parser-deprecated)
896
+ */
897
+ parser?: string | undefined;
898
+ /**
899
+ * Parser options.
900
+ *
901
+ * @see [Working with Custom Parsers](https://eslint.org/docs/latest/extend/custom-parsers)
902
+ * @see [Specifying Parser Options](https://eslint.org/docs/latest/use/configure/language-options-deprecated#specifying-parser-options)
903
+ */
904
+ parserOptions?: JavaScriptParserOptionsConfig | undefined;
905
+ /**
906
+ * Which third-party plugins define additional rules, environments, configs, etc. for ESLint to use.
907
+ *
908
+ * @see [Configuring Plugins](https://eslint.org/docs/latest/use/configure/plugins-deprecated#configure-plugins)
909
+ */
910
+ plugins?: string[] | undefined;
911
+ /**
912
+ * Specifying processor.
913
+ *
914
+ * @see [processor](https://eslint.org/docs/latest/use/configure/plugins-deprecated#specify-a-processor)
915
+ */
916
+ processor?: string | undefined;
917
+ /**
918
+ * Report unused eslint-disable comments as warning.
919
+ *
920
+ * @see [Report unused eslint-disable comments](https://eslint.org/docs/latest/use/configure/rules-deprecated#report-unused-eslint-disable-comments)
921
+ */
922
+ reportUnusedDisableDirectives?: boolean | undefined;
923
+ /**
924
+ * Settings.
925
+ *
926
+ * @see [Settings](https://eslint.org/docs/latest/use/configure/configuration-files-deprecated#adding-shared-settings)
927
+ */
928
+ settings?: SettingsConfig | undefined;
929
+ }
930
+ /**
931
+ * The overwrites that apply more differing configuration to specific files or directories.
932
+ */
933
+ interface ConfigOverride<Rules extends RulesConfig = RulesConfig> extends BaseConfig<Rules> {
934
+ /**
935
+ * The glob patterns for excluded files.
936
+ */
937
+ excludedFiles?: string | string[] | undefined;
938
+ /**
939
+ * The glob patterns for target files.
940
+ */
941
+ files: string | string[];
942
+ }
943
+ /**
944
+ * ESLint legacy configuration.
945
+ *
946
+ * @see [ESLint Legacy Configuration](https://eslint.org/docs/latest/use/configure/)
947
+ */
948
+ interface LegacyConfigObject<Rules extends RulesConfig = RulesConfig, OverrideRules extends RulesConfig = Rules> extends BaseConfig<Rules, OverrideRules> {
949
+ /**
950
+ * Tell ESLint to ignore specific files and directories.
951
+ *
952
+ * @see [Ignore Patterns](https://eslint.org/docs/latest/use/configure/ignore-deprecated#ignorepatterns-in-config-files)
953
+ */
954
+ ignorePatterns?: string | string[] | undefined;
955
+ /**
956
+ * @see [Using Configuration Files](https://eslint.org/docs/latest/use/configure/configuration-files-deprecated#using-configuration-files)
957
+ */
958
+ root?: boolean | undefined;
959
+ }
960
+ /**
961
+ * File information passed to a processor.
962
+ */
963
+ interface ProcessorFile {
964
+ text: string;
965
+ filename: string;
966
+ }
967
+ /**
968
+ * A processor is an object that can preprocess and postprocess files.
969
+ */
970
+ interface Processor<T extends string | ProcessorFile = string | ProcessorFile> extends ObjectMetaProperties {
971
+ /** If `true` then it means the processor supports autofix. */
972
+ supportsAutofix?: boolean | undefined;
973
+ /** The function to extract code blocks. */
974
+ preprocess?(text: string, filename: string): T[];
975
+ /** The function to merge messages. */
976
+ postprocess?(messages: LintMessage[][], filename: string): LintMessage[];
977
+ }
978
+ interface Plugin extends ObjectMetaProperties {
979
+ meta?: ObjectMetaProperties["meta"] & {
980
+ namespace?: string | undefined;
981
+ };
982
+ configs?: Record<string, LegacyConfigObject | ConfigObject | ConfigObject[]> | undefined;
983
+ environments?: Record<string, EnvironmentConfig> | undefined;
984
+ languages?: Record<string, Language> | undefined;
985
+ processors?: Record<string, Processor> | undefined;
986
+ rules?: Record<string, RuleDefinition> | undefined;
987
+ }
988
+ /**
989
+ * Generic options for the `Language` type.
990
+ */
991
+ interface LanguageTypeOptions {
992
+ LangOptions: LanguageOptions;
993
+ Code: SourceCode;
994
+ RootNode: unknown;
995
+ Node: unknown;
996
+ }
997
+ /**
998
+ * Represents a plugin language.
999
+ */
1000
+ interface Language<Options extends LanguageTypeOptions = {
1001
+ LangOptions: LanguageOptions;
1002
+ Code: SourceCode;
1003
+ RootNode: unknown;
1004
+ Node: unknown;
1005
+ }> {
1006
+ /**
1007
+ * Indicates how ESLint should read the file.
1008
+ */
1009
+ fileType: "text";
1010
+ /**
1011
+ * First line number returned from the parser (text mode only).
1012
+ */
1013
+ lineStart: 0 | 1;
1014
+ /**
1015
+ * First column number returned from the parser (text mode only).
1016
+ */
1017
+ columnStart: 0 | 1;
1018
+ /**
1019
+ * The property to read the node type from. Used in selector querying.
1020
+ */
1021
+ nodeTypeKey: string;
1022
+ /**
1023
+ * The traversal path that tools should take when evaluating the AST
1024
+ */
1025
+ visitorKeys?: Record<string, string[]>;
1026
+ /**
1027
+ * Default language options. User-defined options are merged with this object.
1028
+ */
1029
+ defaultLanguageOptions?: LanguageOptions;
1030
+ /**
1031
+ * Validates languageOptions for this language.
1032
+ */
1033
+ validateLanguageOptions(languageOptions: Options["LangOptions"]): void;
1034
+ /**
1035
+ * Normalizes languageOptions for this language.
1036
+ */
1037
+ normalizeLanguageOptions?(languageOptions: Options["LangOptions"]): Options["LangOptions"];
1038
+ /**
1039
+ * Helper for esquery that allows languages to match nodes against
1040
+ * class. esquery currently has classes like `function` that will
1041
+ * match all the various function nodes. This method allows languages
1042
+ * to implement similar shorthands.
1043
+ */
1044
+ matchesSelectorClass?(className: string, node: Options["Node"], ancestry: Options["Node"][]): boolean;
1045
+ /**
1046
+ * Parses the given file input into its component parts. This file should not
1047
+ * throws errors for parsing errors but rather should return any parsing
1048
+ * errors as parse of the ParseResult object.
1049
+ */
1050
+ parse(file: File, context: LanguageContext<Options["LangOptions"]>): ParseResult<Options["RootNode"]>;
1051
+ /**
1052
+ * Creates SourceCode object that ESLint uses to work with a file.
1053
+ */
1054
+ createSourceCode(file: File, input: OkParseResult<Options["RootNode"]>, context: LanguageContext<Options["LangOptions"]>): Options["Code"];
1055
+ }
1056
+ /**
1057
+ * Plugin-defined options for the language.
1058
+ */
1059
+ type LanguageOptions = Record<string, unknown>;
1060
+ /**
1061
+ * The context object that is passed to the language plugin methods.
1062
+ */
1063
+ interface LanguageContext<LangOptions = LanguageOptions> {
1064
+ languageOptions: LangOptions;
1065
+ }
1066
+ /**
1067
+ * Represents a file read by ESLint.
1068
+ */
1069
+ interface File {
1070
+ /**
1071
+ * The path that ESLint uses for this file. May be a virtual path
1072
+ * if it was returned by a processor.
1073
+ */
1074
+ path: string;
1075
+ /**
1076
+ * The path to the file on disk. This always maps directly to a file
1077
+ * regardless of whether it was returned from a processor.
1078
+ */
1079
+ physicalPath: string;
1080
+ /**
1081
+ * Indicates if the original source contained a byte-order marker.
1082
+ * ESLint strips the BOM from the `body`, but this info is needed
1083
+ * to correctly apply autofixing.
1084
+ */
1085
+ bom: boolean;
1086
+ /**
1087
+ * The body of the file to parse.
1088
+ */
1089
+ body: string | Uint8Array;
1090
+ }
1091
+ /**
1092
+ * Represents the successful result of parsing a file.
1093
+ */
1094
+ interface OkParseResult<RootNode = unknown> {
1095
+ /**
1096
+ * Indicates if the parse was successful. If true, the parse was successful
1097
+ * and ESLint should continue on to create a SourceCode object and run rules;
1098
+ * if false, ESLint should just report the error(s) without doing anything
1099
+ * else.
1100
+ */
1101
+ ok: true;
1102
+ /**
1103
+ * The abstract syntax tree created by the parser. (only when ok: true)
1104
+ */
1105
+ ast: RootNode;
1106
+ /**
1107
+ * Any additional data that the parser wants to provide.
1108
+ */
1109
+ [key: string]: any;
1110
+ }
1111
+ /**
1112
+ * Represents the unsuccessful result of parsing a file.
1113
+ */
1114
+ interface NotOkParseResult {
1115
+ /**
1116
+ * Indicates if the parse was successful. If true, the parse was successful
1117
+ * and ESLint should continue on to create a SourceCode object and run rules;
1118
+ * if false, ESLint should just report the error(s) without doing anything
1119
+ * else.
1120
+ */
1121
+ ok: false;
1122
+ /**
1123
+ * Any parsing errors, whether fatal or not. (only when ok: false)
1124
+ */
1125
+ errors: FileError[];
1126
+ /**
1127
+ * Any additional data that the parser wants to provide.
1128
+ */
1129
+ [key: string]: any;
1130
+ }
1131
+ type ParseResult<RootNode = unknown> = OkParseResult<RootNode> | NotOkParseResult;
1132
+ /**
1133
+ * Represents inline configuration found in the source code.
1134
+ */
1135
+ interface InlineConfigElement {
1136
+ /**
1137
+ * The location of the inline config element.
1138
+ */
1139
+ loc: SourceLocation;
1140
+ /**
1141
+ * The interpreted configuration from the inline config element.
1142
+ */
1143
+ config: {
1144
+ rules: RulesConfig;
1145
+ };
1146
+ }
1147
+ /**
1148
+ * Generic options for the `SourceCodeBase` type.
1149
+ */
1150
+ interface SourceCodeBaseTypeOptions {
1151
+ LangOptions: LanguageOptions;
1152
+ RootNode: unknown;
1153
+ SyntaxElementWithLoc: unknown;
1154
+ ConfigNode: unknown;
1155
+ }
1156
+ /**
1157
+ * Represents the basic interface for a source code object.
1158
+ */
1159
+ interface SourceCodeBase<Options extends SourceCodeBaseTypeOptions = {
1160
+ LangOptions: LanguageOptions;
1161
+ RootNode: unknown;
1162
+ SyntaxElementWithLoc: unknown;
1163
+ ConfigNode: unknown;
1164
+ }> {
1165
+ /**
1166
+ * Root of the AST.
1167
+ */
1168
+ ast: Options["RootNode"];
1169
+ /**
1170
+ * The traversal path that tools should take when evaluating the AST.
1171
+ * When present, this overrides the `visitorKeys` on the language for
1172
+ * just this source code object.
1173
+ */
1174
+ visitorKeys?: Record<string, string[]>;
1175
+ /**
1176
+ * Retrieves the equivalent of `loc` for a given node or token.
1177
+ * @param syntaxElement The node or token to get the location for.
1178
+ * @returns The location of the node or token.
1179
+ */
1180
+ getLoc(syntaxElement: Options["SyntaxElementWithLoc"]): SourceLocation;
1181
+ /**
1182
+ * Retrieves the equivalent of `range` for a given node or token.
1183
+ * @param syntaxElement The node or token to get the range for.
1184
+ * @returns The range of the node or token.
1185
+ */
1186
+ getRange(syntaxElement: Options["SyntaxElementWithLoc"]): SourceRange;
1187
+ /**
1188
+ * Traversal of AST.
1189
+ */
1190
+ traverse(): Iterable<TraversalStep>;
1191
+ /**
1192
+ * Applies language options passed in from the ESLint core.
1193
+ */
1194
+ applyLanguageOptions?(languageOptions: Options["LangOptions"]): void;
1195
+ /**
1196
+ * Return all of the inline areas where ESLint should be disabled/enabled
1197
+ * along with any problems found in evaluating the directives.
1198
+ */
1199
+ getDisableDirectives?(): {
1200
+ directives: Directive[];
1201
+ problems: FileProblem[];
1202
+ };
1203
+ /**
1204
+ * Returns an array of all inline configuration nodes found in the
1205
+ * source code.
1206
+ */
1207
+ getInlineConfigNodes?(): Options["ConfigNode"][];
1208
+ /**
1209
+ * Applies configuration found inside of the source code. This method is only
1210
+ * called when ESLint is running with inline configuration allowed.
1211
+ */
1212
+ applyInlineConfig?(): {
1213
+ configs: InlineConfigElement[];
1214
+ problems: FileProblem[];
1215
+ };
1216
+ /**
1217
+ * Called by ESLint core to indicate that it has finished providing
1218
+ * information. We now add in all the missing variables and ensure that
1219
+ * state-changing methods cannot be called by rules.
1220
+ * @returns {void}
1221
+ */
1222
+ finalize?(): void;
1223
+ }
1224
+ /**
1225
+ * Represents the source of a text file being linted.
1226
+ */
1227
+ interface TextSourceCode<Options extends SourceCodeBaseTypeOptions = {
1228
+ LangOptions: LanguageOptions;
1229
+ RootNode: unknown;
1230
+ SyntaxElementWithLoc: unknown;
1231
+ ConfigNode: unknown;
1232
+ }> extends SourceCodeBase<Options> {
1233
+ /**
1234
+ * The body of the file that you'd like rule developers to access.
1235
+ */
1236
+ text: string;
1237
+ }
1238
+ /**
1239
+ * Represents the source of a binary file being linted.
1240
+ */
1241
+ interface BinarySourceCode<Options extends SourceCodeBaseTypeOptions = {
1242
+ LangOptions: LanguageOptions;
1243
+ RootNode: unknown;
1244
+ SyntaxElementWithLoc: unknown;
1245
+ ConfigNode: unknown;
1246
+ }> extends SourceCodeBase<Options> {
1247
+ /**
1248
+ * The body of the file that you'd like rule developers to access.
1249
+ */
1250
+ body: Uint8Array;
1251
+ }
1252
+ type SourceCode<Options extends SourceCodeBaseTypeOptions = {
1253
+ LangOptions: LanguageOptions;
1254
+ RootNode: unknown;
1255
+ SyntaxElementWithLoc: unknown;
1256
+ ConfigNode: unknown;
1257
+ }> = TextSourceCode<Options> | BinarySourceCode<Options>;
1258
+ /**
1259
+ * Represents a traversal step visiting the AST.
1260
+ */
1261
+ interface VisitTraversalStep {
1262
+ kind: 1;
1263
+ target: unknown;
1264
+ phase: 1 | 2;
1265
+ args: unknown[];
1266
+ }
1267
+ /**
1268
+ * Represents a traversal step calling a function.
1269
+ */
1270
+ interface CallTraversalStep {
1271
+ kind: 2;
1272
+ target: string;
1273
+ phase?: string;
1274
+ args: unknown[];
1275
+ }
1276
+ type TraversalStep = VisitTraversalStep | CallTraversalStep;
1277
+ /**
1278
+ * The type of disable directive. This determines how ESLint will disable rules.
1279
+ */
1280
+ type DirectiveType = "disable" | "enable" | "disable-line" | "disable-next-line";
1281
+ /**
1282
+ * Represents a disable directive.
1283
+ */
1284
+ interface Directive {
1285
+ /**
1286
+ * The type of directive.
1287
+ */
1288
+ type: DirectiveType;
1289
+ /**
1290
+ * The node of the directive. May be in the AST or a comment/token.
1291
+ */
1292
+ node: unknown;
1293
+ /**
1294
+ * The value of the directive.
1295
+ */
1296
+ value: string;
1297
+ /**
1298
+ * The justification for the directive.
1299
+ */
1300
+ justification?: string;
1301
+ }
1302
+ //#endregion
1303
+ //#region node_modules/.pnpm/@eslint+config-helpers@0.5.2/node_modules/@eslint/config-helpers/dist/esm/types.d.ts
1304
+ /**
1305
+ * Infinite array type.
1306
+ */
1307
+ type InfiniteArray<T> = T | InfiniteArray<T>[];
1308
+ /**
1309
+ * The type of array element in the `extends` property after flattening.
1310
+ */
1311
+ type SimpleExtendsElement = string | ConfigObject;
1312
+ /**
1313
+ * The type of array element in the `extends` property before flattening.
1314
+ */
1315
+ type ExtendsElement = SimpleExtendsElement | InfiniteArray<ConfigObject>;
1316
+ /**
1317
+ * Config with extends. Valid only inside of `defineConfig()`.
1318
+ */
1319
+ interface ConfigWithExtends$1 extends ConfigObject {
1320
+ extends?: ExtendsElement[];
1321
+ }
1322
+ //#endregion
1323
+ //#region node_modules/.pnpm/@eslint+config-helpers@0.5.2/node_modules/@eslint/config-helpers/dist/esm/index.d.ts
1324
+ type ConfigWithExtends = ConfigWithExtends$1;
1325
+ //#endregion
1326
+ //#region node_modules/.pnpm/eslint-flat-config-utils@3.0.1/node_modules/eslint-flat-config-utils/dist/index.d.mts
1327
+ /**
1328
+ * A type that can be awaited. Promise<T> or T.
1329
+ */
1330
+ type Awaitable$1<T> = T | Promise<T>;
1331
+ /**
1332
+ * A type that can be an array or a single item.
1333
+ */
1334
+ type Arrayable<T> = T | T[];
1335
+ /**
1336
+ * Default config names map. Used for type augmentation.
1337
+ *
1338
+ * @example
1339
+ * ```ts
1340
+ * declare module 'eslint-flat-config-utils' {
1341
+ * interface DefaultConfigNamesMap {
1342
+ * 'my-custom-config': true
1343
+ * }
1344
+ * }
1345
+ * ```
1346
+ */
1347
+ interface DefaultConfigNamesMap {}
1348
+ interface Nothing {}
1349
+ /**
1350
+ * type StringLiteralUnion<'foo'> = 'foo' | string
1351
+ * This has auto completion whereas `'foo' | string` doesn't
1352
+ * Adapted from https://github.com/microsoft/TypeScript/issues/29729
1353
+ */
1354
+ type StringLiteralUnion<T extends U, U = string> = T | (U & Nothing);
1355
+ type FilterType<T, F> = T extends F ? T : never;
1356
+ type NullableObject<T> = { [K in keyof T]?: T[K] | null | undefined };
1357
+ type GetRuleRecordFromConfig<T> = T extends {
1358
+ rules?: infer R;
1359
+ } ? R : Linter.RulesRecord;
1360
+ interface DisableFixesOptions {
1361
+ builtinRules?: Map<string, Rule.RuleModule> | (() => Awaitable$1<Map<string, Rule.RuleModule>>);
1362
+ }
1363
+ type PluginConflictsError<T extends Linter.Config = Linter.Config> = (pluginName: string, configs: T[]) => string;
1364
+ /**
1365
+ * Awaitable array of ESLint flat configs or a composer object.
1366
+ */
1367
+ type ResolvableFlatConfig<T extends object = ConfigWithExtends> = Awaitable$1<Arrayable<(T | false | undefined | null)>> | Awaitable$1<(ConfigWithExtends | false | undefined | null)[]> | Awaitable$1<(Linter.Config | false | undefined | null)[]> | FlatConfigComposer<any>;
1368
+ /**
1369
+ * Create a chainable composer object that makes manipulating ESLint flat config easier.
1370
+ *
1371
+ * It extends Promise, so that you can directly await or export it to `eslint.config.mjs`
1372
+ *
1373
+ * ```ts
1374
+ * // eslint.config.mjs
1375
+ * import { composer } from 'eslint-flat-config-utils'
1376
+ *
1377
+ * export default composer(
1378
+ * {
1379
+ * plugins: {},
1380
+ * rules: {},
1381
+ * }
1382
+ * // ...some configs, accepts same arguments as `concat`
1383
+ * )
1384
+ * .append(
1385
+ * // appends more configs at the end, accepts same arguments as `concat`
1386
+ * )
1387
+ * .prepend(
1388
+ * // prepends more configs at the beginning, accepts same arguments as `concat`
1389
+ * )
1390
+ * .insertAfter(
1391
+ * 'config-name', // specify the name of the target config, or index
1392
+ * // insert more configs after the target, accepts same arguments as `concat`
1393
+ * )
1394
+ * .renamePlugins({
1395
+ * // rename plugins
1396
+ * 'old-name': 'new-name',
1397
+ * // for example, rename `n` from `eslint-plugin-n` to more a explicit prefix `node`
1398
+ * 'n': 'node'
1399
+ * // applies to all plugins and rules in the configs
1400
+ * })
1401
+ * .override(
1402
+ * 'config-name', // specify the name of the target config, or index
1403
+ * {
1404
+ * // merge with the target config
1405
+ * rules: {
1406
+ * 'no-console': 'off'
1407
+ * },
1408
+ * }
1409
+ * )
1410
+ *
1411
+ * // And you an directly return the composer object to `eslint.config.mjs`
1412
+ * ```
1413
+ */
1414
+ /**
1415
+ * The underlying impolementation of `composer()`.
1416
+ */
1417
+ declare class FlatConfigComposer<T extends object = ConfigWithExtends, ConfigNames extends string = keyof DefaultConfigNamesMap> extends Promise<Linter.Config[]> {
1418
+ private _operations;
1419
+ private _operationsOverrides;
1420
+ private _operationsResolved;
1421
+ private _renames;
1422
+ private _pluginsConflictsError;
1423
+ constructor(...configs: ResolvableFlatConfig<T>[]);
1424
+ /**
1425
+ * Set plugin renames, like `n` -> `node`, `import-x` -> `import`, etc.
1426
+ *
1427
+ * This will runs after all config items are resolved. Applies to `plugins` and `rules`.
1428
+ */
1429
+ renamePlugins(renames: Record<string, string>): this;
1430
+ /**
1431
+ * Append configs to the end of the current configs array.
1432
+ */
1433
+ append(...items: ResolvableFlatConfig<T>[]): this;
1434
+ /**
1435
+ * Prepend configs to the beginning of the current configs array.
1436
+ */
1437
+ prepend(...items: ResolvableFlatConfig<T>[]): this;
1438
+ /**
1439
+ * Insert configs before a specific config.
1440
+ */
1441
+ insertBefore(nameOrIndex: StringLiteralUnion<ConfigNames, string | number>, ...items: ResolvableFlatConfig<T>[]): this;
1442
+ /**
1443
+ * Insert configs after a specific config.
1444
+ */
1445
+ insertAfter(nameOrIndex: StringLiteralUnion<ConfigNames, string | number>, ...items: ResolvableFlatConfig<T>[]): this;
1446
+ /**
1447
+ * Provide overrides to a specific config.
1448
+ *
1449
+ * It will be merged with the original config, or provide a custom function to replace the config entirely.
1450
+ */
1451
+ override(nameOrIndex: StringLiteralUnion<ConfigNames, string | number>, config: T | ((config: T) => Awaitable$1<T>)): this;
1452
+ /**
1453
+ * Provide overrides to multiple configs as an object map.
1454
+ *
1455
+ * Same as calling `override` multiple times.
1456
+ */
1457
+ overrides(overrides: Partial<Record<StringLiteralUnion<ConfigNames, string | number>, T | ((config: T) => Awaitable$1<T>)>>): this;
1458
+ /**
1459
+ * Override rules and it's options in **all configs**.
1460
+ *
1461
+ * Pass `null` as the value to remove the rule.
1462
+ *
1463
+ * @example
1464
+ * ```ts
1465
+ * composer
1466
+ * .overrideRules({
1467
+ * 'no-console': 'off',
1468
+ * 'no-unused-vars': ['error', { vars: 'all', args: 'after-used' }],
1469
+ * // remove the rule from all configs
1470
+ * 'no-undef': null,
1471
+ * })
1472
+ * ```
1473
+ */
1474
+ overrideRules(rules: NullableObject<GetRuleRecordFromConfig<T>>): this;
1475
+ /**
1476
+ * Remove rules from **all configs**.
1477
+ *
1478
+ * @example
1479
+ * ```ts
1480
+ * composer
1481
+ * .removeRules(
1482
+ * 'no-console',
1483
+ * 'no-unused-vars'
1484
+ * )
1485
+ * ```
1486
+ */
1487
+ removeRules(...rules: StringLiteralUnion<FilterType<keyof GetRuleRecordFromConfig<T>, string>, string>[]): this;
1488
+ /**
1489
+ * Remove plugins by name and all the rules referenced by them.
1490
+ *
1491
+ * @example
1492
+ * ```ts
1493
+ * composer
1494
+ * .removePlugins(
1495
+ * 'node'
1496
+ * )
1497
+ * ```
1498
+ *
1499
+ * The `plugins: { node }` and `rules: { 'node/xxx': 'error' }` will be removed from all configs.
1500
+ */
1501
+ removePlugins(...names: string[]): this;
1502
+ /**
1503
+ * Remove a specific config by name or index.
1504
+ */
1505
+ remove(nameOrIndex: ConfigNames | string | number): this;
1506
+ /**
1507
+ * Replace a specific config by name or index.
1508
+ *
1509
+ * The original config will be removed and replaced with the new one.
1510
+ */
1511
+ replace(nameOrIndex: StringLiteralUnion<ConfigNames, string | number>, ...items: ResolvableFlatConfig<T>[]): this;
1512
+ /**
1513
+ * Hijack into plugins to disable fixes for specific rules.
1514
+ *
1515
+ * Note this mutates the plugin object, use with caution.
1516
+ *
1517
+ * @example
1518
+ * ```ts
1519
+ * const config = await composer(...)
1520
+ * .disableRulesFix([
1521
+ * 'unused-imports/no-unused-imports',
1522
+ * 'vitest/no-only-tests'
1523
+ * ])
1524
+ * ```
1525
+ */
1526
+ disableRulesFix(ruleIds: string[], options?: DisableFixesOptions): this;
1527
+ /**
1528
+ * Set a custom warning message for plugins conflicts.
1529
+ *
1530
+ * The error message can be a string or a function that returns a string.
1531
+ *
1532
+ * Error message accepts template strings:
1533
+ * - `{{pluginName}}`: the name of the plugin that has conflicts
1534
+ * - `{{configName1}}`: the name of the first config that uses the plugin
1535
+ * - `{{configName2}}`: the name of the second config that uses the plugin
1536
+ * - `{{configNames}}`: a list of config names that uses the plugin
1537
+ *
1538
+ * When only one argument is provided, it will be used as the default error message.
1539
+ */
1540
+ setPluginConflictsError(warning?: string | PluginConflictsError): this;
1541
+ setPluginConflictsError(pluginName: string, warning: string | PluginConflictsError): this;
1542
+ private _verifyPluginsConflicts;
1543
+ /**
1544
+ * Hook when all configs are resolved but before returning the final configs.
1545
+ *
1546
+ * You can modify the final configs here.
1547
+ */
1548
+ onResolved(callback: (configs: T[]) => Awaitable$1<T[] | void>): this;
1549
+ /**
1550
+ * Clone the composer object.
1551
+ */
1552
+ clone(): FlatConfigComposer<T>;
1553
+ /**
1554
+ * Resolve the pipeline and return the final configs.
1555
+ *
1556
+ * This returns a promise. Calling `.then()` has the same effect.
1557
+ */
1558
+ toConfigs(): Promise<Linter.Config[]>;
1559
+ then<T>(onFulfilled: (value: Linter.Config[]) => T, onRejected?: (reason: any) => any): Promise<Awaited<T>>;
1560
+ catch(onRejected: (reason: any) => any): Promise<any>;
1561
+ finally(onFinally: () => void): Promise<Linter.Config[]>;
1562
+ }
1563
+ /**
1564
+ * @deprecated Renamed to `composer`.
1565
+ */
1566
+ //#endregion
1567
+ //#region src/types.d.ts
1568
+ interface Options extends Omit<AntfuOptions, 'formatters'> {
1569
+ formatters?: boolean | FormattersOptions;
1570
+ }
1571
+ interface FormattersOptions extends OptionsFormatters {
1572
+ tailwindcss?: boolean | OptionsTailwindcss;
1573
+ }
1574
+ type AntfuOptions = OptionsConfig & Omit<TypedFlatConfigItem, 'files'>;
1575
+ type UserConfig = Awaitable<TypedFlatConfigItem | TypedFlatConfigItem[] | FlatConfigComposer<any, any> | Linter.Config[]>[];
1576
+ interface Matcher {
1577
+ name: string;
1578
+ configurations: {
1579
+ match: 'objectKeys' | 'objectValues' | 'strings';
1580
+ pathPattern?: string;
1581
+ }[];
1582
+ }
1583
+ interface OptionsTailwindcss extends OptionsFiles, OptionsOverrides {
1584
+ settings?: {
1585
+ entryPoint?: string | undefined;
1586
+ tailwindConfig?: string | undefined;
1587
+ tsconfig?: string | undefined;
1588
+ detectComponentClasses?: boolean | undefined;
1589
+ rootFontSize?: number | undefined;
1590
+ messageStyle?: 'visual' | 'compact' | 'raw' | undefined;
1591
+ attributes?: Array<string | Matcher[]> | undefined;
1592
+ callees?: Array<string | Matcher[]> | undefined;
1593
+ variables?: Array<string | Matcher[]> | undefined;
1594
+ tags?: Array<string | Matcher[]> | undefined;
1595
+ };
1596
+ }
1597
+ //#endregion
1598
+ //#region src/index.d.ts
1599
+ declare function defineConfig(options?: Options, ...userConfigs: UserConfig): FlatConfigComposer<_antfu_eslint_config0.TypedFlatConfigItem, _antfu_eslint_config0.ConfigNames>;
1600
+ //#endregion
1601
+ export { defineConfig };