@icebreakers/eslint-config 4.0.0 → 4.0.2
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 +101 -3
- package/README.zh.md +93 -2
- package/dist/index.cjs +137 -16
- package/dist/index.d.cts +1434 -267
- package/dist/index.d.ts +1434 -267
- package/dist/index.js +137 -16
- package/index.d.ts +8 -1
- package/package.json +6 -5
package/dist/index.d.cts
CHANGED
|
@@ -204,7 +204,7 @@ interface JSONSchema4 {
|
|
|
204
204
|
/**
|
|
205
205
|
* Represents an error inside of a file.
|
|
206
206
|
*/
|
|
207
|
-
interface FileError {
|
|
207
|
+
interface FileError$1 {
|
|
208
208
|
message: string;
|
|
209
209
|
line: number;
|
|
210
210
|
column: number;
|
|
@@ -214,53 +214,53 @@ interface FileError {
|
|
|
214
214
|
/**
|
|
215
215
|
* Represents a problem found in a file.
|
|
216
216
|
*/
|
|
217
|
-
interface FileProblem {
|
|
217
|
+
interface FileProblem$1 {
|
|
218
218
|
ruleId: string | null;
|
|
219
219
|
message: string;
|
|
220
|
-
loc: SourceLocation$
|
|
220
|
+
loc: SourceLocation$3;
|
|
221
221
|
}
|
|
222
222
|
/**
|
|
223
223
|
* Represents the start and end coordinates of a node inside the source.
|
|
224
224
|
*/
|
|
225
|
-
interface SourceLocation$
|
|
226
|
-
start: Position$
|
|
227
|
-
end: Position$
|
|
225
|
+
interface SourceLocation$3 {
|
|
226
|
+
start: Position$2;
|
|
227
|
+
end: Position$2;
|
|
228
228
|
}
|
|
229
229
|
/**
|
|
230
230
|
* Represents a location coordinate inside the source. ESLint-style formats
|
|
231
231
|
* have just `line` and `column` while others may have `offset` as well.
|
|
232
232
|
*/
|
|
233
|
-
interface Position$
|
|
233
|
+
interface Position$2 {
|
|
234
234
|
line: number;
|
|
235
235
|
column: number;
|
|
236
236
|
}
|
|
237
237
|
/**
|
|
238
238
|
* Represents a range of characters in the source.
|
|
239
239
|
*/
|
|
240
|
-
type SourceRange = [number, number];
|
|
240
|
+
type SourceRange$1 = [number, number];
|
|
241
241
|
/**
|
|
242
242
|
* What the rule is responsible for finding:
|
|
243
243
|
* - `problem` means the rule has noticed a potential error.
|
|
244
244
|
* - `suggestion` means the rule suggests an alternate or better approach.
|
|
245
245
|
* - `layout` means the rule is looking at spacing, indentation, etc.
|
|
246
246
|
*/
|
|
247
|
-
type RuleType = "problem" | "suggestion" | "layout";
|
|
247
|
+
type RuleType$1 = "problem" | "suggestion" | "layout";
|
|
248
248
|
/**
|
|
249
249
|
* The type of fix the rule can provide:
|
|
250
250
|
* - `code` means the rule can fix syntax.
|
|
251
251
|
* - `whitespace` means the rule can fix spacing and indentation.
|
|
252
252
|
*/
|
|
253
|
-
type RuleFixType = "code" | "whitespace";
|
|
253
|
+
type RuleFixType$1 = "code" | "whitespace";
|
|
254
254
|
/**
|
|
255
255
|
* An object containing visitor information for a rule. Each method is either the
|
|
256
256
|
* name of a node type or a selector, or is a method that will be called at specific
|
|
257
257
|
* times during the traversal.
|
|
258
258
|
*/
|
|
259
|
-
type RuleVisitor$
|
|
259
|
+
type RuleVisitor$2 = Record<string, ((...args: any[]) => void) | undefined>;
|
|
260
260
|
/**
|
|
261
261
|
* Rule meta information used for documentation.
|
|
262
262
|
*/
|
|
263
|
-
interface RulesMetaDocs {
|
|
263
|
+
interface RulesMetaDocs$1 {
|
|
264
264
|
/**
|
|
265
265
|
* A short description of the rule.
|
|
266
266
|
*/
|
|
@@ -283,15 +283,15 @@ interface RulesMetaDocs {
|
|
|
283
283
|
/**
|
|
284
284
|
* Meta information about a rule.
|
|
285
285
|
*/
|
|
286
|
-
interface RulesMeta<MessageIds extends string = string, RuleOptions = unknown[], ExtRuleDocs = unknown> {
|
|
286
|
+
interface RulesMeta$1<MessageIds extends string = string, RuleOptions = unknown[], ExtRuleDocs = unknown> {
|
|
287
287
|
/**
|
|
288
288
|
* Properties that are used when documenting the rule.
|
|
289
289
|
*/
|
|
290
|
-
docs?: (RulesMetaDocs & ExtRuleDocs) | undefined;
|
|
290
|
+
docs?: (RulesMetaDocs$1 & ExtRuleDocs) | undefined;
|
|
291
291
|
/**
|
|
292
292
|
* The type of rule.
|
|
293
293
|
*/
|
|
294
|
-
type?: RuleType | undefined;
|
|
294
|
+
type?: RuleType$1 | undefined;
|
|
295
295
|
/**
|
|
296
296
|
* The schema for the rule options. Required if the rule has options.
|
|
297
297
|
*/
|
|
@@ -307,7 +307,7 @@ interface RulesMeta<MessageIds extends string = string, RuleOptions = unknown[],
|
|
|
307
307
|
/**
|
|
308
308
|
* Indicates whether the rule has been deprecated or provides additional metadata about the deprecation. Omit if not deprecated.
|
|
309
309
|
*/
|
|
310
|
-
deprecated?: boolean | DeprecatedInfo | undefined;
|
|
310
|
+
deprecated?: boolean | DeprecatedInfo$1 | undefined;
|
|
311
311
|
/**
|
|
312
312
|
* @deprecated Use deprecated.replacedBy instead.
|
|
313
313
|
* The name of the rule(s) this rule was replaced by, if it was deprecated.
|
|
@@ -316,7 +316,7 @@ interface RulesMeta<MessageIds extends string = string, RuleOptions = unknown[],
|
|
|
316
316
|
/**
|
|
317
317
|
* Indicates if the rule is fixable, and if so, what type of fix it provides.
|
|
318
318
|
*/
|
|
319
|
-
fixable?: RuleFixType | undefined;
|
|
319
|
+
fixable?: RuleFixType$1 | undefined;
|
|
320
320
|
/**
|
|
321
321
|
* Indicates if the rule may provide suggestions.
|
|
322
322
|
*/
|
|
@@ -333,7 +333,7 @@ interface RulesMeta<MessageIds extends string = string, RuleOptions = unknown[],
|
|
|
333
333
|
/**
|
|
334
334
|
* Provides additional metadata about a deprecation.
|
|
335
335
|
*/
|
|
336
|
-
interface DeprecatedInfo {
|
|
336
|
+
interface DeprecatedInfo$1 {
|
|
337
337
|
/**
|
|
338
338
|
* General message presented to the user, e.g. for the key rule why the rule
|
|
339
339
|
* is deprecated or for info how to replace the rule.
|
|
@@ -346,7 +346,7 @@ interface DeprecatedInfo {
|
|
|
346
346
|
/**
|
|
347
347
|
* An empty array explicitly states that there is no replacement.
|
|
348
348
|
*/
|
|
349
|
-
replacedBy?: ReplacedByInfo[];
|
|
349
|
+
replacedBy?: ReplacedByInfo$1[];
|
|
350
350
|
/**
|
|
351
351
|
* The package version since when the rule is deprecated (should use full
|
|
352
352
|
* semver without a leading "v").
|
|
@@ -362,7 +362,7 @@ interface DeprecatedInfo {
|
|
|
362
362
|
/**
|
|
363
363
|
* Provides metadata about a replacement
|
|
364
364
|
*/
|
|
365
|
-
interface ReplacedByInfo {
|
|
365
|
+
interface ReplacedByInfo$1 {
|
|
366
366
|
/**
|
|
367
367
|
* General message presented to the user, e.g. how to replace the rule
|
|
368
368
|
*/
|
|
@@ -375,17 +375,17 @@ interface ReplacedByInfo {
|
|
|
375
375
|
* Name should be "eslint" if the replacement is an ESLint core rule. Omit
|
|
376
376
|
* the property if the replacement is in the same plugin.
|
|
377
377
|
*/
|
|
378
|
-
plugin?: ExternalSpecifier;
|
|
378
|
+
plugin?: ExternalSpecifier$1;
|
|
379
379
|
/**
|
|
380
380
|
* Name and documentation of the replacement rule
|
|
381
381
|
*/
|
|
382
|
-
rule?: ExternalSpecifier;
|
|
382
|
+
rule?: ExternalSpecifier$1;
|
|
383
383
|
}
|
|
384
384
|
/**
|
|
385
385
|
* Specifies the name and url of an external resource. At least one property
|
|
386
386
|
* should be set.
|
|
387
387
|
*/
|
|
388
|
-
interface ExternalSpecifier {
|
|
388
|
+
interface ExternalSpecifier$1 {
|
|
389
389
|
/**
|
|
390
390
|
* Name of the referenced plugin / rule.
|
|
391
391
|
*/
|
|
@@ -398,9 +398,9 @@ interface ExternalSpecifier {
|
|
|
398
398
|
/**
|
|
399
399
|
* Generic type for `RuleContext`.
|
|
400
400
|
*/
|
|
401
|
-
interface RuleContextTypeOptions {
|
|
402
|
-
LangOptions: LanguageOptions;
|
|
403
|
-
Code: SourceCode$
|
|
401
|
+
interface RuleContextTypeOptions$1 {
|
|
402
|
+
LangOptions: LanguageOptions$1;
|
|
403
|
+
Code: SourceCode$2;
|
|
404
404
|
RuleOptions: unknown[];
|
|
405
405
|
Node: unknown;
|
|
406
406
|
MessageIds: string;
|
|
@@ -410,7 +410,7 @@ interface RuleContextTypeOptions {
|
|
|
410
410
|
* information about the current state of the linting process and is the rule's
|
|
411
411
|
* view into the outside world.
|
|
412
412
|
*/
|
|
413
|
-
interface RuleContext$
|
|
413
|
+
interface RuleContext$2<Options extends RuleContextTypeOptions$1 = RuleContextTypeOptions$1> {
|
|
414
414
|
/**
|
|
415
415
|
* The current working directory for the session.
|
|
416
416
|
*/
|
|
@@ -430,7 +430,7 @@ interface RuleContext$1<Options extends RuleContextTypeOptions = RuleContextType
|
|
|
430
430
|
/**
|
|
431
431
|
* Shared settings for the configuration.
|
|
432
432
|
*/
|
|
433
|
-
settings: SettingsConfig;
|
|
433
|
+
settings: SettingsConfig$1;
|
|
434
434
|
/**
|
|
435
435
|
* The language options for the configuration.
|
|
436
436
|
*/
|
|
@@ -447,71 +447,71 @@ interface RuleContext$1<Options extends RuleContextTypeOptions = RuleContextType
|
|
|
447
447
|
* The report function that the rule should use to report problems.
|
|
448
448
|
* @param violation The violation to report.
|
|
449
449
|
*/
|
|
450
|
-
report(violation: ViolationReport<Options["Node"], Options["MessageIds"]>): void;
|
|
450
|
+
report(violation: ViolationReport$1<Options["Node"], Options["MessageIds"]>): void;
|
|
451
451
|
}
|
|
452
452
|
/**
|
|
453
453
|
* Manager of text edits for a rule fix.
|
|
454
454
|
*/
|
|
455
|
-
interface RuleTextEditor<EditableSyntaxElement = unknown> {
|
|
455
|
+
interface RuleTextEditor$1<EditableSyntaxElement = unknown> {
|
|
456
456
|
/**
|
|
457
457
|
* Inserts text after the specified node or token.
|
|
458
458
|
* @param syntaxElement The node or token to insert after.
|
|
459
459
|
* @param text The edit to insert after the node or token.
|
|
460
460
|
*/
|
|
461
|
-
insertTextAfter(syntaxElement: EditableSyntaxElement, text: string): RuleTextEdit;
|
|
461
|
+
insertTextAfter(syntaxElement: EditableSyntaxElement, text: string): RuleTextEdit$1;
|
|
462
462
|
/**
|
|
463
463
|
* Inserts text after the specified range.
|
|
464
464
|
* @param range The range to insert after.
|
|
465
465
|
* @param text The edit to insert after the range.
|
|
466
466
|
*/
|
|
467
|
-
insertTextAfterRange(range: SourceRange, text: string): RuleTextEdit;
|
|
467
|
+
insertTextAfterRange(range: SourceRange$1, text: string): RuleTextEdit$1;
|
|
468
468
|
/**
|
|
469
469
|
* Inserts text before the specified node or token.
|
|
470
470
|
* @param syntaxElement A syntax element with location information to insert before.
|
|
471
471
|
* @param text The edit to insert before the node or token.
|
|
472
472
|
*/
|
|
473
|
-
insertTextBefore(syntaxElement: EditableSyntaxElement, text: string): RuleTextEdit;
|
|
473
|
+
insertTextBefore(syntaxElement: EditableSyntaxElement, text: string): RuleTextEdit$1;
|
|
474
474
|
/**
|
|
475
475
|
* Inserts text before the specified range.
|
|
476
476
|
* @param range The range to insert before.
|
|
477
477
|
* @param text The edit to insert before the range.
|
|
478
478
|
*/
|
|
479
|
-
insertTextBeforeRange(range: SourceRange, text: string): RuleTextEdit;
|
|
479
|
+
insertTextBeforeRange(range: SourceRange$1, text: string): RuleTextEdit$1;
|
|
480
480
|
/**
|
|
481
481
|
* Removes the specified node or token.
|
|
482
482
|
* @param syntaxElement A syntax element with location information to remove.
|
|
483
483
|
* @returns The edit to remove the node or token.
|
|
484
484
|
*/
|
|
485
|
-
remove(syntaxElement: EditableSyntaxElement): RuleTextEdit;
|
|
485
|
+
remove(syntaxElement: EditableSyntaxElement): RuleTextEdit$1;
|
|
486
486
|
/**
|
|
487
487
|
* Removes the specified range.
|
|
488
488
|
* @param range The range to remove.
|
|
489
489
|
* @returns The edit to remove the range.
|
|
490
490
|
*/
|
|
491
|
-
removeRange(range: SourceRange): RuleTextEdit;
|
|
491
|
+
removeRange(range: SourceRange$1): RuleTextEdit$1;
|
|
492
492
|
/**
|
|
493
493
|
* Replaces the specified node or token with the given text.
|
|
494
494
|
* @param syntaxElement A syntax element with location information to replace.
|
|
495
495
|
* @param text The text to replace the node or token with.
|
|
496
496
|
* @returns The edit to replace the node or token.
|
|
497
497
|
*/
|
|
498
|
-
replaceText(syntaxElement: EditableSyntaxElement, text: string): RuleTextEdit;
|
|
498
|
+
replaceText(syntaxElement: EditableSyntaxElement, text: string): RuleTextEdit$1;
|
|
499
499
|
/**
|
|
500
500
|
* Replaces the specified range with the given text.
|
|
501
501
|
* @param range The range to replace.
|
|
502
502
|
* @param text The text to replace the range with.
|
|
503
503
|
* @returns The edit to replace the range.
|
|
504
504
|
*/
|
|
505
|
-
replaceTextRange(range: SourceRange, text: string): RuleTextEdit;
|
|
505
|
+
replaceTextRange(range: SourceRange$1, text: string): RuleTextEdit$1;
|
|
506
506
|
}
|
|
507
507
|
/**
|
|
508
508
|
* Represents a fix for a rule violation implemented as a text edit.
|
|
509
509
|
*/
|
|
510
|
-
interface RuleTextEdit {
|
|
510
|
+
interface RuleTextEdit$1 {
|
|
511
511
|
/**
|
|
512
512
|
* The range to replace.
|
|
513
513
|
*/
|
|
514
|
-
range: SourceRange;
|
|
514
|
+
range: SourceRange$1;
|
|
515
515
|
/**
|
|
516
516
|
* The text to insert.
|
|
517
517
|
*/
|
|
@@ -522,48 +522,48 @@ interface RuleTextEdit {
|
|
|
522
522
|
* @param fixer The text editor to apply the fix.
|
|
523
523
|
* @returns The fix(es) for the violation.
|
|
524
524
|
*/
|
|
525
|
-
type RuleFixer = (fixer: RuleTextEditor) => RuleTextEdit | Iterable<RuleTextEdit> | null;
|
|
525
|
+
type RuleFixer$1 = (fixer: RuleTextEditor$1) => RuleTextEdit$1 | Iterable<RuleTextEdit$1> | null;
|
|
526
526
|
/**
|
|
527
527
|
* Data that can be used to fill placeholders in error messages.
|
|
528
528
|
*/
|
|
529
|
-
type MessagePlaceholderData = Record<string, string | number | boolean | bigint | null | undefined>;
|
|
530
|
-
interface ViolationReportBase<MessageIds extends string = string> {
|
|
529
|
+
type MessagePlaceholderData$1 = Record<string, string | number | boolean | bigint | null | undefined>;
|
|
530
|
+
interface ViolationReportBase$1<MessageIds extends string = string> {
|
|
531
531
|
/**
|
|
532
532
|
* The data to insert into the message.
|
|
533
533
|
*/
|
|
534
|
-
data?: MessagePlaceholderData | undefined;
|
|
534
|
+
data?: MessagePlaceholderData$1 | undefined;
|
|
535
535
|
/**
|
|
536
536
|
* The fix to be applied for the violation.
|
|
537
537
|
*/
|
|
538
|
-
fix?: RuleFixer | null | undefined;
|
|
538
|
+
fix?: RuleFixer$1 | null | undefined;
|
|
539
539
|
/**
|
|
540
540
|
* An array of suggested fixes for the problem. These fixes may change the
|
|
541
541
|
* behavior of the code, so they are not applied automatically.
|
|
542
542
|
*/
|
|
543
|
-
suggest?: SuggestedEdit<MessageIds>[] | null | undefined;
|
|
543
|
+
suggest?: SuggestedEdit$1<MessageIds>[] | null | undefined;
|
|
544
544
|
}
|
|
545
|
-
type ViolationMessage<MessageIds extends string = string> = {
|
|
545
|
+
type ViolationMessage$1<MessageIds extends string = string> = {
|
|
546
546
|
message: string;
|
|
547
547
|
} | {
|
|
548
548
|
messageId: MessageIds;
|
|
549
549
|
};
|
|
550
|
-
type ViolationLocation<Node> = {
|
|
551
|
-
loc: SourceLocation$
|
|
550
|
+
type ViolationLocation$1<Node> = {
|
|
551
|
+
loc: SourceLocation$3 | Position$2;
|
|
552
552
|
} | {
|
|
553
553
|
node: Node;
|
|
554
554
|
};
|
|
555
|
-
type ViolationReport<Node = unknown, MessageIds extends string = string> = ViolationReportBase<MessageIds> & ViolationMessage<MessageIds> & ViolationLocation<Node>;
|
|
556
|
-
interface SuggestedEditBase {
|
|
555
|
+
type ViolationReport$1<Node = unknown, MessageIds extends string = string> = ViolationReportBase$1<MessageIds> & ViolationMessage$1<MessageIds> & ViolationLocation$1<Node>;
|
|
556
|
+
interface SuggestedEditBase$1 {
|
|
557
557
|
/**
|
|
558
558
|
* The data to insert into the message.
|
|
559
559
|
*/
|
|
560
|
-
data?: MessagePlaceholderData | undefined;
|
|
560
|
+
data?: MessagePlaceholderData$1 | undefined;
|
|
561
561
|
/**
|
|
562
562
|
* The fix to be applied for the suggestion.
|
|
563
563
|
*/
|
|
564
|
-
fix: RuleFixer;
|
|
564
|
+
fix: RuleFixer$1;
|
|
565
565
|
}
|
|
566
|
-
type SuggestionMessage<MessageIds extends string = string> = {
|
|
566
|
+
type SuggestionMessage$1<MessageIds extends string = string> = {
|
|
567
567
|
desc: string;
|
|
568
568
|
} | {
|
|
569
569
|
messageId: MessageIds;
|
|
@@ -571,22 +571,22 @@ type SuggestionMessage<MessageIds extends string = string> = {
|
|
|
571
571
|
/**
|
|
572
572
|
* A suggested edit for a rule violation.
|
|
573
573
|
*/
|
|
574
|
-
type SuggestedEdit<MessageIds extends string = string> = SuggestedEditBase & SuggestionMessage<MessageIds>;
|
|
574
|
+
type SuggestedEdit$1<MessageIds extends string = string> = SuggestedEditBase$1 & SuggestionMessage$1<MessageIds>;
|
|
575
575
|
/**
|
|
576
576
|
* The normalized version of a lint suggestion.
|
|
577
577
|
*/
|
|
578
|
-
interface LintSuggestion {
|
|
578
|
+
interface LintSuggestion$1 {
|
|
579
579
|
/** A short description. */
|
|
580
580
|
desc: string;
|
|
581
581
|
/** Fix result info. */
|
|
582
|
-
fix: RuleTextEdit;
|
|
582
|
+
fix: RuleTextEdit$1;
|
|
583
583
|
/** Id referencing a message for the description. */
|
|
584
584
|
messageId?: string | undefined;
|
|
585
585
|
}
|
|
586
586
|
/**
|
|
587
587
|
* The normalized version of a lint violation message.
|
|
588
588
|
*/
|
|
589
|
-
interface LintMessage$
|
|
589
|
+
interface LintMessage$2 {
|
|
590
590
|
/** The 1-based column number. */
|
|
591
591
|
column: number;
|
|
592
592
|
/** The 1-based line number. */
|
|
@@ -604,20 +604,20 @@ interface LintMessage$1 {
|
|
|
604
604
|
/** If `true` then this is a fatal error. */
|
|
605
605
|
fatal?: true | undefined;
|
|
606
606
|
/** The severity of this message. */
|
|
607
|
-
severity: Exclude<SeverityLevel, 0>;
|
|
607
|
+
severity: Exclude<SeverityLevel$1, 0>;
|
|
608
608
|
/** Information for autofix. */
|
|
609
|
-
fix?: RuleTextEdit | undefined;
|
|
609
|
+
fix?: RuleTextEdit$1 | undefined;
|
|
610
610
|
/** Information for suggestions. */
|
|
611
|
-
suggestions?: LintSuggestion[] | undefined;
|
|
611
|
+
suggestions?: LintSuggestion$1[] | undefined;
|
|
612
612
|
}
|
|
613
613
|
/**
|
|
614
614
|
* Generic options for the `RuleDefinition` type.
|
|
615
615
|
*/
|
|
616
|
-
interface RuleDefinitionTypeOptions {
|
|
617
|
-
LangOptions: LanguageOptions;
|
|
618
|
-
Code: SourceCode$
|
|
616
|
+
interface RuleDefinitionTypeOptions$1 {
|
|
617
|
+
LangOptions: LanguageOptions$1;
|
|
618
|
+
Code: SourceCode$2;
|
|
619
619
|
RuleOptions: unknown[];
|
|
620
|
-
Visitor: RuleVisitor$
|
|
620
|
+
Visitor: RuleVisitor$2;
|
|
621
621
|
Node: unknown;
|
|
622
622
|
MessageIds: string;
|
|
623
623
|
ExtRuleDocs: unknown;
|
|
@@ -625,17 +625,17 @@ interface RuleDefinitionTypeOptions {
|
|
|
625
625
|
/**
|
|
626
626
|
* The definition of an ESLint rule.
|
|
627
627
|
*/
|
|
628
|
-
interface RuleDefinition<Options extends RuleDefinitionTypeOptions = RuleDefinitionTypeOptions> {
|
|
628
|
+
interface RuleDefinition$1<Options extends RuleDefinitionTypeOptions$1 = RuleDefinitionTypeOptions$1> {
|
|
629
629
|
/**
|
|
630
630
|
* The meta information for the rule.
|
|
631
631
|
*/
|
|
632
|
-
meta?: RulesMeta<Options["MessageIds"], Options["RuleOptions"], Options["ExtRuleDocs"]>;
|
|
632
|
+
meta?: RulesMeta$1<Options["MessageIds"], Options["RuleOptions"], Options["ExtRuleDocs"]>;
|
|
633
633
|
/**
|
|
634
634
|
* Creates the visitor that ESLint uses to apply the rule during traversal.
|
|
635
635
|
* @param context The rule context.
|
|
636
636
|
* @returns The rule visitor.
|
|
637
637
|
*/
|
|
638
|
-
create(context: RuleContext$
|
|
638
|
+
create(context: RuleContext$2<{
|
|
639
639
|
LangOptions: Options["LangOptions"];
|
|
640
640
|
Code: Options["Code"];
|
|
641
641
|
RuleOptions: Options["RuleOptions"];
|
|
@@ -646,7 +646,7 @@ interface RuleDefinition<Options extends RuleDefinitionTypeOptions = RuleDefinit
|
|
|
646
646
|
/**
|
|
647
647
|
* The human readable severity level used in a configuration.
|
|
648
648
|
*/
|
|
649
|
-
type SeverityName = "off" | "warn" | "error";
|
|
649
|
+
type SeverityName$1 = "off" | "warn" | "error";
|
|
650
650
|
/**
|
|
651
651
|
* The numeric severity level for a rule.
|
|
652
652
|
*
|
|
@@ -654,15 +654,15 @@ type SeverityName = "off" | "warn" | "error";
|
|
|
654
654
|
* - `1` means warn.
|
|
655
655
|
* - `2` means error.
|
|
656
656
|
*/
|
|
657
|
-
type SeverityLevel = 0 | 1 | 2;
|
|
657
|
+
type SeverityLevel$1 = 0 | 1 | 2;
|
|
658
658
|
/**
|
|
659
659
|
* The severity of a rule in a configuration.
|
|
660
660
|
*/
|
|
661
|
-
type Severity = SeverityName | SeverityLevel;
|
|
661
|
+
type Severity$1 = SeverityName$1 | SeverityLevel$1;
|
|
662
662
|
/**
|
|
663
663
|
* Represents the metadata for an object, such as a plugin or processor.
|
|
664
664
|
*/
|
|
665
|
-
interface ObjectMetaProperties {
|
|
665
|
+
interface ObjectMetaProperties$1 {
|
|
666
666
|
/** @deprecated Use `meta.name` instead. */
|
|
667
667
|
name?: string | undefined;
|
|
668
668
|
/** @deprecated Use `meta.version` instead. */
|
|
@@ -675,7 +675,7 @@ interface ObjectMetaProperties {
|
|
|
675
675
|
/**
|
|
676
676
|
* Represents the configuration options for the core linter.
|
|
677
677
|
*/
|
|
678
|
-
interface LinterOptionsConfig {
|
|
678
|
+
interface LinterOptionsConfig$1 {
|
|
679
679
|
/**
|
|
680
680
|
* Indicates whether or not inline configuration is evaluated.
|
|
681
681
|
*/
|
|
@@ -683,33 +683,33 @@ interface LinterOptionsConfig {
|
|
|
683
683
|
/**
|
|
684
684
|
* Indicates what to do when an unused disable directive is found.
|
|
685
685
|
*/
|
|
686
|
-
reportUnusedDisableDirectives?: boolean | Severity;
|
|
686
|
+
reportUnusedDisableDirectives?: boolean | Severity$1;
|
|
687
687
|
/**
|
|
688
688
|
* A severity value indicating if and how unused inline configs should be
|
|
689
689
|
* tracked and reported.
|
|
690
690
|
*/
|
|
691
|
-
reportUnusedInlineConfigs?: Severity;
|
|
691
|
+
reportUnusedInlineConfigs?: Severity$1;
|
|
692
692
|
}
|
|
693
693
|
/**
|
|
694
694
|
* The configuration for a rule.
|
|
695
695
|
*/
|
|
696
|
-
type RuleConfig<RuleOptions extends unknown[] = unknown[]> = Severity | [Severity, ...Partial<RuleOptions>];
|
|
696
|
+
type RuleConfig$1<RuleOptions extends unknown[] = unknown[]> = Severity$1 | [Severity$1, ...Partial<RuleOptions>];
|
|
697
697
|
/**
|
|
698
698
|
* A collection of rules and their configurations.
|
|
699
699
|
*/
|
|
700
|
-
interface RulesConfig {
|
|
701
|
-
[key: string]: RuleConfig;
|
|
700
|
+
interface RulesConfig$1 {
|
|
701
|
+
[key: string]: RuleConfig$1;
|
|
702
702
|
}
|
|
703
703
|
/**
|
|
704
704
|
* A collection of settings.
|
|
705
705
|
*/
|
|
706
|
-
interface SettingsConfig {
|
|
706
|
+
interface SettingsConfig$1 {
|
|
707
707
|
[key: string]: unknown;
|
|
708
708
|
}
|
|
709
709
|
/**
|
|
710
710
|
* The configuration for a set of files.
|
|
711
711
|
*/
|
|
712
|
-
interface ConfigObject<Rules extends RulesConfig = RulesConfig> {
|
|
712
|
+
interface ConfigObject$1<Rules extends RulesConfig$1 = RulesConfig$1> {
|
|
713
713
|
/**
|
|
714
714
|
* A string to identify the configuration object. Used in error messages and
|
|
715
715
|
* inspection tools.
|
|
@@ -743,22 +743,22 @@ interface ConfigObject<Rules extends RulesConfig = RulesConfig> {
|
|
|
743
743
|
* An object containing settings related to how the language is configured for
|
|
744
744
|
* linting.
|
|
745
745
|
*/
|
|
746
|
-
languageOptions?: LanguageOptions;
|
|
746
|
+
languageOptions?: LanguageOptions$1;
|
|
747
747
|
/**
|
|
748
748
|
* An object containing settings related to the linting process
|
|
749
749
|
*/
|
|
750
|
-
linterOptions?: LinterOptionsConfig;
|
|
750
|
+
linterOptions?: LinterOptionsConfig$1;
|
|
751
751
|
/**
|
|
752
752
|
* Either an object containing preprocess() and postprocess() methods or a
|
|
753
753
|
* string indicating the name of a processor inside of a plugin
|
|
754
754
|
* (i.e., "pluginName/processorName").
|
|
755
755
|
*/
|
|
756
|
-
processor?: string | Processor;
|
|
756
|
+
processor?: string | Processor$1;
|
|
757
757
|
/**
|
|
758
758
|
* An object containing a name-value mapping of plugin names to plugin objects.
|
|
759
759
|
* When files is specified, these plugins are only available to the matching files.
|
|
760
760
|
*/
|
|
761
|
-
plugins?: Record<string, Plugin$
|
|
761
|
+
plugins?: Record<string, Plugin$3>;
|
|
762
762
|
/**
|
|
763
763
|
* An object containing the configured rules. When files or ignores are specified,
|
|
764
764
|
* these rule configurations are only available to the matching files.
|
|
@@ -768,30 +768,30 @@ interface ConfigObject<Rules extends RulesConfig = RulesConfig> {
|
|
|
768
768
|
* An object containing name-value pairs of information that should be
|
|
769
769
|
* available to all rules.
|
|
770
770
|
*/
|
|
771
|
-
settings?: SettingsConfig;
|
|
771
|
+
settings?: SettingsConfig$1;
|
|
772
772
|
}
|
|
773
773
|
/** @deprecated Only supported in legacy eslintrc config format. */
|
|
774
|
-
type GlobalAccess = boolean | "off" | "readable" | "readonly" | "writable" | "writeable";
|
|
774
|
+
type GlobalAccess$1 = boolean | "off" | "readable" | "readonly" | "writable" | "writeable";
|
|
775
775
|
/** @deprecated Only supported in legacy eslintrc config format. */
|
|
776
|
-
interface GlobalsConfig {
|
|
777
|
-
[name: string]: GlobalAccess;
|
|
776
|
+
interface GlobalsConfig$1 {
|
|
777
|
+
[name: string]: GlobalAccess$1;
|
|
778
778
|
}
|
|
779
779
|
/**
|
|
780
780
|
* The ECMAScript version of the code being linted.
|
|
781
781
|
* @deprecated Only supported in legacy eslintrc config format.
|
|
782
782
|
*/
|
|
783
|
-
type EcmaVersion$
|
|
783
|
+
type EcmaVersion$2 = 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";
|
|
784
784
|
/**
|
|
785
785
|
* The type of JavaScript source code.
|
|
786
786
|
* @deprecated Only supported in legacy eslintrc config format.
|
|
787
787
|
*/
|
|
788
|
-
type JavaScriptSourceType = "script" | "module" | "commonjs";
|
|
788
|
+
type JavaScriptSourceType$1 = "script" | "module" | "commonjs";
|
|
789
789
|
/**
|
|
790
790
|
* Parser options.
|
|
791
791
|
* @deprecated Only supported in legacy eslintrc config format.
|
|
792
792
|
* @see [Specifying Parser Options](https://eslint.org/docs/latest/use/configure/language-options#specifying-parser-options)
|
|
793
793
|
*/
|
|
794
|
-
interface JavaScriptParserOptionsConfig {
|
|
794
|
+
interface JavaScriptParserOptionsConfig$1 {
|
|
795
795
|
/**
|
|
796
796
|
* Allow the use of reserved words as identifiers (if `ecmaVersion` is 3).
|
|
797
797
|
*
|
|
@@ -811,7 +811,7 @@ interface JavaScriptParserOptionsConfig {
|
|
|
811
811
|
*
|
|
812
812
|
* @default 5
|
|
813
813
|
*/
|
|
814
|
-
ecmaVersion?: EcmaVersion$
|
|
814
|
+
ecmaVersion?: EcmaVersion$2 | undefined;
|
|
815
815
|
/**
|
|
816
816
|
* The type of JavaScript source code. Possible values are "script" for
|
|
817
817
|
* traditional script files, "module" for ECMAScript modules (ESM), and
|
|
@@ -821,7 +821,7 @@ interface JavaScriptParserOptionsConfig {
|
|
|
821
821
|
*
|
|
822
822
|
* @see https://eslint.org/docs/latest/use/configure/language-options-deprecated#specifying-parser-options
|
|
823
823
|
*/
|
|
824
|
-
sourceType?: JavaScriptSourceType | undefined;
|
|
824
|
+
sourceType?: JavaScriptSourceType$1 | undefined;
|
|
825
825
|
/**
|
|
826
826
|
* An object indicating which additional language features you'd like to use.
|
|
827
827
|
*
|
|
@@ -836,16 +836,16 @@ interface JavaScriptParserOptionsConfig {
|
|
|
836
836
|
[key: string]: any;
|
|
837
837
|
}
|
|
838
838
|
/** @deprecated Only supported in legacy eslintrc config format. */
|
|
839
|
-
interface EnvironmentConfig {
|
|
839
|
+
interface EnvironmentConfig$1 {
|
|
840
840
|
/** The definition of global variables. */
|
|
841
|
-
globals?: GlobalsConfig | undefined;
|
|
841
|
+
globals?: GlobalsConfig$1 | undefined;
|
|
842
842
|
/** The parser options that will be enabled under this environment. */
|
|
843
|
-
parserOptions?: JavaScriptParserOptionsConfig | undefined;
|
|
843
|
+
parserOptions?: JavaScriptParserOptionsConfig$1 | undefined;
|
|
844
844
|
}
|
|
845
845
|
/**
|
|
846
846
|
* A configuration object that may have a `rules` block.
|
|
847
847
|
*/
|
|
848
|
-
interface HasRules<Rules extends RulesConfig = RulesConfig> {
|
|
848
|
+
interface HasRules$1<Rules extends RulesConfig$1 = RulesConfig$1> {
|
|
849
849
|
rules?: Partial<Rules> | undefined;
|
|
850
850
|
}
|
|
851
851
|
/**
|
|
@@ -853,7 +853,7 @@ interface HasRules<Rules extends RulesConfig = RulesConfig> {
|
|
|
853
853
|
*
|
|
854
854
|
* @see [ESLint Legacy Configuration](https://eslint.org/docs/latest/use/configure/)
|
|
855
855
|
*/
|
|
856
|
-
interface BaseConfig<Rules extends RulesConfig = RulesConfig, OverrideRules extends RulesConfig = Rules> extends HasRules<Rules> {
|
|
856
|
+
interface BaseConfig$1<Rules extends RulesConfig$1 = RulesConfig$1, OverrideRules extends RulesConfig$1 = Rules> extends HasRules$1<Rules> {
|
|
857
857
|
$schema?: string | undefined;
|
|
858
858
|
/**
|
|
859
859
|
* An environment provides predefined global variables.
|
|
@@ -874,7 +874,7 @@ interface BaseConfig<Rules extends RulesConfig = RulesConfig, OverrideRules exte
|
|
|
874
874
|
*
|
|
875
875
|
* @see [Globals](https://eslint.org/docs/latest/use/configure/language-options-deprecated#specifying-globals)
|
|
876
876
|
*/
|
|
877
|
-
globals?: GlobalsConfig | undefined;
|
|
877
|
+
globals?: GlobalsConfig$1 | undefined;
|
|
878
878
|
/**
|
|
879
879
|
* Disable processing of inline comments.
|
|
880
880
|
*
|
|
@@ -886,7 +886,7 @@ interface BaseConfig<Rules extends RulesConfig = RulesConfig, OverrideRules exte
|
|
|
886
886
|
*
|
|
887
887
|
* @see [How do overrides work](https://eslint.org/docs/latest/use/configure/configuration-files-deprecated#how-do-overrides-work)
|
|
888
888
|
*/
|
|
889
|
-
overrides?: ConfigOverride<OverrideRules>[] | undefined;
|
|
889
|
+
overrides?: ConfigOverride$1<OverrideRules>[] | undefined;
|
|
890
890
|
/**
|
|
891
891
|
* Parser.
|
|
892
892
|
*
|
|
@@ -900,7 +900,7 @@ interface BaseConfig<Rules extends RulesConfig = RulesConfig, OverrideRules exte
|
|
|
900
900
|
* @see [Working with Custom Parsers](https://eslint.org/docs/latest/extend/custom-parsers)
|
|
901
901
|
* @see [Specifying Parser Options](https://eslint.org/docs/latest/use/configure/language-options-deprecated#specifying-parser-options)
|
|
902
902
|
*/
|
|
903
|
-
parserOptions?: JavaScriptParserOptionsConfig | undefined;
|
|
903
|
+
parserOptions?: JavaScriptParserOptionsConfig$1 | undefined;
|
|
904
904
|
/**
|
|
905
905
|
* Which third-party plugins define additional rules, environments, configs, etc. for ESLint to use.
|
|
906
906
|
*
|
|
@@ -924,12 +924,12 @@ interface BaseConfig<Rules extends RulesConfig = RulesConfig, OverrideRules exte
|
|
|
924
924
|
*
|
|
925
925
|
* @see [Settings](https://eslint.org/docs/latest/use/configure/configuration-files-deprecated#adding-shared-settings)
|
|
926
926
|
*/
|
|
927
|
-
settings?: SettingsConfig | undefined;
|
|
927
|
+
settings?: SettingsConfig$1 | undefined;
|
|
928
928
|
}
|
|
929
929
|
/**
|
|
930
930
|
* The overwrites that apply more differing configuration to specific files or directories.
|
|
931
931
|
*/
|
|
932
|
-
interface ConfigOverride<Rules extends RulesConfig = RulesConfig> extends BaseConfig<Rules> {
|
|
932
|
+
interface ConfigOverride$1<Rules extends RulesConfig$1 = RulesConfig$1> extends BaseConfig$1<Rules> {
|
|
933
933
|
/**
|
|
934
934
|
* The glob patterns for excluded files.
|
|
935
935
|
*/
|
|
@@ -944,7 +944,7 @@ interface ConfigOverride<Rules extends RulesConfig = RulesConfig> extends BaseCo
|
|
|
944
944
|
*
|
|
945
945
|
* @see [ESLint Legacy Configuration](https://eslint.org/docs/latest/use/configure/)
|
|
946
946
|
*/
|
|
947
|
-
interface LegacyConfigObject<Rules extends RulesConfig = RulesConfig, OverrideRules extends RulesConfig = Rules> extends BaseConfig<Rules, OverrideRules> {
|
|
947
|
+
interface LegacyConfigObject$1<Rules extends RulesConfig$1 = RulesConfig$1, OverrideRules extends RulesConfig$1 = Rules> extends BaseConfig$1<Rules, OverrideRules> {
|
|
948
948
|
/**
|
|
949
949
|
* Tell ESLint to ignore specific files and directories.
|
|
950
950
|
*
|
|
@@ -959,46 +959,46 @@ interface LegacyConfigObject<Rules extends RulesConfig = RulesConfig, OverrideRu
|
|
|
959
959
|
/**
|
|
960
960
|
* File information passed to a processor.
|
|
961
961
|
*/
|
|
962
|
-
interface ProcessorFile$
|
|
962
|
+
interface ProcessorFile$2 {
|
|
963
963
|
text: string;
|
|
964
964
|
filename: string;
|
|
965
965
|
}
|
|
966
966
|
/**
|
|
967
967
|
* A processor is an object that can preprocess and postprocess files.
|
|
968
968
|
*/
|
|
969
|
-
interface Processor<T extends string | ProcessorFile$
|
|
969
|
+
interface Processor$1<T extends string | ProcessorFile$2 = string | ProcessorFile$2> extends ObjectMetaProperties$1 {
|
|
970
970
|
/** If `true` then it means the processor supports autofix. */
|
|
971
971
|
supportsAutofix?: boolean | undefined;
|
|
972
972
|
/** The function to extract code blocks. */
|
|
973
973
|
preprocess?(text: string, filename: string): T[];
|
|
974
974
|
/** The function to merge messages. */
|
|
975
|
-
postprocess?(messages: LintMessage$
|
|
975
|
+
postprocess?(messages: LintMessage$2[][], filename: string): LintMessage$2[];
|
|
976
976
|
}
|
|
977
|
-
interface Plugin$
|
|
978
|
-
meta?: ObjectMetaProperties["meta"] & {
|
|
977
|
+
interface Plugin$3 extends ObjectMetaProperties$1 {
|
|
978
|
+
meta?: ObjectMetaProperties$1["meta"] & {
|
|
979
979
|
namespace?: string | undefined;
|
|
980
980
|
};
|
|
981
|
-
configs?: Record<string, LegacyConfigObject | ConfigObject | ConfigObject[]> | undefined;
|
|
982
|
-
environments?: Record<string, EnvironmentConfig> | undefined;
|
|
983
|
-
languages?: Record<string, Language> | undefined;
|
|
984
|
-
processors?: Record<string, Processor> | undefined;
|
|
985
|
-
rules?: Record<string, RuleDefinition> | undefined;
|
|
981
|
+
configs?: Record<string, LegacyConfigObject$1 | ConfigObject$1 | ConfigObject$1[]> | undefined;
|
|
982
|
+
environments?: Record<string, EnvironmentConfig$1> | undefined;
|
|
983
|
+
languages?: Record<string, Language$1> | undefined;
|
|
984
|
+
processors?: Record<string, Processor$1> | undefined;
|
|
985
|
+
rules?: Record<string, RuleDefinition$1> | undefined;
|
|
986
986
|
}
|
|
987
987
|
/**
|
|
988
988
|
* Generic options for the `Language` type.
|
|
989
989
|
*/
|
|
990
|
-
interface LanguageTypeOptions {
|
|
991
|
-
LangOptions: LanguageOptions;
|
|
992
|
-
Code: SourceCode$
|
|
990
|
+
interface LanguageTypeOptions$1 {
|
|
991
|
+
LangOptions: LanguageOptions$1;
|
|
992
|
+
Code: SourceCode$2;
|
|
993
993
|
RootNode: unknown;
|
|
994
994
|
Node: unknown;
|
|
995
995
|
}
|
|
996
996
|
/**
|
|
997
997
|
* Represents a plugin language.
|
|
998
998
|
*/
|
|
999
|
-
interface Language<Options extends LanguageTypeOptions = {
|
|
1000
|
-
LangOptions: LanguageOptions;
|
|
1001
|
-
Code: SourceCode$
|
|
999
|
+
interface Language$1<Options extends LanguageTypeOptions$1 = {
|
|
1000
|
+
LangOptions: LanguageOptions$1;
|
|
1001
|
+
Code: SourceCode$2;
|
|
1002
1002
|
RootNode: unknown;
|
|
1003
1003
|
Node: unknown;
|
|
1004
1004
|
}> {
|
|
@@ -1025,7 +1025,7 @@ interface Language<Options extends LanguageTypeOptions = {
|
|
|
1025
1025
|
/**
|
|
1026
1026
|
* Default language options. User-defined options are merged with this object.
|
|
1027
1027
|
*/
|
|
1028
|
-
defaultLanguageOptions?: LanguageOptions;
|
|
1028
|
+
defaultLanguageOptions?: LanguageOptions$1;
|
|
1029
1029
|
/**
|
|
1030
1030
|
* Validates languageOptions for this language.
|
|
1031
1031
|
*/
|
|
@@ -1046,26 +1046,26 @@ interface Language<Options extends LanguageTypeOptions = {
|
|
|
1046
1046
|
* throws errors for parsing errors but rather should return any parsing
|
|
1047
1047
|
* errors as parse of the ParseResult object.
|
|
1048
1048
|
*/
|
|
1049
|
-
parse(file: File, context: LanguageContext<Options["LangOptions"]>): ParseResult<Options["RootNode"]>;
|
|
1049
|
+
parse(file: File$1, context: LanguageContext$1<Options["LangOptions"]>): ParseResult$1<Options["RootNode"]>;
|
|
1050
1050
|
/**
|
|
1051
1051
|
* Creates SourceCode object that ESLint uses to work with a file.
|
|
1052
1052
|
*/
|
|
1053
|
-
createSourceCode(file: File, input: OkParseResult<Options["RootNode"]>, context: LanguageContext<Options["LangOptions"]>): Options["Code"];
|
|
1053
|
+
createSourceCode(file: File$1, input: OkParseResult$1<Options["RootNode"]>, context: LanguageContext$1<Options["LangOptions"]>): Options["Code"];
|
|
1054
1054
|
}
|
|
1055
1055
|
/**
|
|
1056
1056
|
* Plugin-defined options for the language.
|
|
1057
1057
|
*/
|
|
1058
|
-
type LanguageOptions = Record<string, unknown>;
|
|
1058
|
+
type LanguageOptions$1 = Record<string, unknown>;
|
|
1059
1059
|
/**
|
|
1060
1060
|
* The context object that is passed to the language plugin methods.
|
|
1061
1061
|
*/
|
|
1062
|
-
interface LanguageContext<LangOptions = LanguageOptions> {
|
|
1062
|
+
interface LanguageContext$1<LangOptions = LanguageOptions$1> {
|
|
1063
1063
|
languageOptions: LangOptions;
|
|
1064
1064
|
}
|
|
1065
1065
|
/**
|
|
1066
1066
|
* Represents a file read by ESLint.
|
|
1067
1067
|
*/
|
|
1068
|
-
interface File {
|
|
1068
|
+
interface File$1 {
|
|
1069
1069
|
/**
|
|
1070
1070
|
* The path that ESLint uses for this file. May be a virtual path
|
|
1071
1071
|
* if it was returned by a processor.
|
|
@@ -1090,7 +1090,7 @@ interface File {
|
|
|
1090
1090
|
/**
|
|
1091
1091
|
* Represents the successful result of parsing a file.
|
|
1092
1092
|
*/
|
|
1093
|
-
interface OkParseResult<RootNode = unknown> {
|
|
1093
|
+
interface OkParseResult$1<RootNode = unknown> {
|
|
1094
1094
|
/**
|
|
1095
1095
|
* Indicates if the parse was successful. If true, the parse was successful
|
|
1096
1096
|
* and ESLint should continue on to create a SourceCode object and run rules;
|
|
@@ -1110,7 +1110,7 @@ interface OkParseResult<RootNode = unknown> {
|
|
|
1110
1110
|
/**
|
|
1111
1111
|
* Represents the unsuccessful result of parsing a file.
|
|
1112
1112
|
*/
|
|
1113
|
-
interface NotOkParseResult {
|
|
1113
|
+
interface NotOkParseResult$1 {
|
|
1114
1114
|
/**
|
|
1115
1115
|
* Indicates if the parse was successful. If true, the parse was successful
|
|
1116
1116
|
* and ESLint should continue on to create a SourceCode object and run rules;
|
|
@@ -1121,33 +1121,33 @@ interface NotOkParseResult {
|
|
|
1121
1121
|
/**
|
|
1122
1122
|
* Any parsing errors, whether fatal or not. (only when ok: false)
|
|
1123
1123
|
*/
|
|
1124
|
-
errors: FileError[];
|
|
1124
|
+
errors: FileError$1[];
|
|
1125
1125
|
/**
|
|
1126
1126
|
* Any additional data that the parser wants to provide.
|
|
1127
1127
|
*/
|
|
1128
1128
|
[key: string]: any;
|
|
1129
1129
|
}
|
|
1130
|
-
type ParseResult<RootNode = unknown> = OkParseResult<RootNode> | NotOkParseResult;
|
|
1130
|
+
type ParseResult$1<RootNode = unknown> = OkParseResult$1<RootNode> | NotOkParseResult$1;
|
|
1131
1131
|
/**
|
|
1132
1132
|
* Represents inline configuration found in the source code.
|
|
1133
1133
|
*/
|
|
1134
|
-
interface InlineConfigElement {
|
|
1134
|
+
interface InlineConfigElement$1 {
|
|
1135
1135
|
/**
|
|
1136
1136
|
* The location of the inline config element.
|
|
1137
1137
|
*/
|
|
1138
|
-
loc: SourceLocation$
|
|
1138
|
+
loc: SourceLocation$3;
|
|
1139
1139
|
/**
|
|
1140
1140
|
* The interpreted configuration from the inline config element.
|
|
1141
1141
|
*/
|
|
1142
1142
|
config: {
|
|
1143
|
-
rules: RulesConfig;
|
|
1143
|
+
rules: RulesConfig$1;
|
|
1144
1144
|
};
|
|
1145
1145
|
}
|
|
1146
1146
|
/**
|
|
1147
1147
|
* Generic options for the `SourceCodeBase` type.
|
|
1148
1148
|
*/
|
|
1149
|
-
interface SourceCodeBaseTypeOptions {
|
|
1150
|
-
LangOptions: LanguageOptions;
|
|
1149
|
+
interface SourceCodeBaseTypeOptions$1 {
|
|
1150
|
+
LangOptions: LanguageOptions$1;
|
|
1151
1151
|
RootNode: unknown;
|
|
1152
1152
|
SyntaxElementWithLoc: unknown;
|
|
1153
1153
|
ConfigNode: unknown;
|
|
@@ -1155,8 +1155,8 @@ interface SourceCodeBaseTypeOptions {
|
|
|
1155
1155
|
/**
|
|
1156
1156
|
* Represents the basic interface for a source code object.
|
|
1157
1157
|
*/
|
|
1158
|
-
interface SourceCodeBase<Options extends SourceCodeBaseTypeOptions = {
|
|
1159
|
-
LangOptions: LanguageOptions;
|
|
1158
|
+
interface SourceCodeBase$1<Options extends SourceCodeBaseTypeOptions$1 = {
|
|
1159
|
+
LangOptions: LanguageOptions$1;
|
|
1160
1160
|
RootNode: unknown;
|
|
1161
1161
|
SyntaxElementWithLoc: unknown;
|
|
1162
1162
|
ConfigNode: unknown;
|
|
@@ -1176,17 +1176,17 @@ interface SourceCodeBase<Options extends SourceCodeBaseTypeOptions = {
|
|
|
1176
1176
|
* @param syntaxElement The node or token to get the location for.
|
|
1177
1177
|
* @returns The location of the node or token.
|
|
1178
1178
|
*/
|
|
1179
|
-
getLoc(syntaxElement: Options["SyntaxElementWithLoc"]): SourceLocation$
|
|
1179
|
+
getLoc(syntaxElement: Options["SyntaxElementWithLoc"]): SourceLocation$3;
|
|
1180
1180
|
/**
|
|
1181
1181
|
* Retrieves the equivalent of `range` for a given node or token.
|
|
1182
1182
|
* @param syntaxElement The node or token to get the range for.
|
|
1183
1183
|
* @returns The range of the node or token.
|
|
1184
1184
|
*/
|
|
1185
|
-
getRange(syntaxElement: Options["SyntaxElementWithLoc"]): SourceRange;
|
|
1185
|
+
getRange(syntaxElement: Options["SyntaxElementWithLoc"]): SourceRange$1;
|
|
1186
1186
|
/**
|
|
1187
1187
|
* Traversal of AST.
|
|
1188
1188
|
*/
|
|
1189
|
-
traverse(): Iterable<TraversalStep>;
|
|
1189
|
+
traverse(): Iterable<TraversalStep$1>;
|
|
1190
1190
|
/**
|
|
1191
1191
|
* Applies language options passed in from the ESLint core.
|
|
1192
1192
|
*/
|
|
@@ -1196,8 +1196,8 @@ interface SourceCodeBase<Options extends SourceCodeBaseTypeOptions = {
|
|
|
1196
1196
|
* along with any problems found in evaluating the directives.
|
|
1197
1197
|
*/
|
|
1198
1198
|
getDisableDirectives?(): {
|
|
1199
|
-
directives: Directive$
|
|
1200
|
-
problems: FileProblem[];
|
|
1199
|
+
directives: Directive$2[];
|
|
1200
|
+
problems: FileProblem$1[];
|
|
1201
1201
|
};
|
|
1202
1202
|
/**
|
|
1203
1203
|
* Returns an array of all inline configuration nodes found in the
|
|
@@ -1209,8 +1209,8 @@ interface SourceCodeBase<Options extends SourceCodeBaseTypeOptions = {
|
|
|
1209
1209
|
* called when ESLint is running with inline configuration allowed.
|
|
1210
1210
|
*/
|
|
1211
1211
|
applyInlineConfig?(): {
|
|
1212
|
-
configs: InlineConfigElement[];
|
|
1213
|
-
problems: FileProblem[];
|
|
1212
|
+
configs: InlineConfigElement$1[];
|
|
1213
|
+
problems: FileProblem$1[];
|
|
1214
1214
|
};
|
|
1215
1215
|
/**
|
|
1216
1216
|
* Called by ESLint core to indicate that it has finished providing
|
|
@@ -1223,12 +1223,12 @@ interface SourceCodeBase<Options extends SourceCodeBaseTypeOptions = {
|
|
|
1223
1223
|
/**
|
|
1224
1224
|
* Represents the source of a text file being linted.
|
|
1225
1225
|
*/
|
|
1226
|
-
interface TextSourceCode<Options extends SourceCodeBaseTypeOptions = {
|
|
1227
|
-
LangOptions: LanguageOptions;
|
|
1226
|
+
interface TextSourceCode$1<Options extends SourceCodeBaseTypeOptions$1 = {
|
|
1227
|
+
LangOptions: LanguageOptions$1;
|
|
1228
1228
|
RootNode: unknown;
|
|
1229
1229
|
SyntaxElementWithLoc: unknown;
|
|
1230
1230
|
ConfigNode: unknown;
|
|
1231
|
-
}> extends SourceCodeBase<Options> {
|
|
1231
|
+
}> extends SourceCodeBase$1<Options> {
|
|
1232
1232
|
/**
|
|
1233
1233
|
* The body of the file that you'd like rule developers to access.
|
|
1234
1234
|
*/
|
|
@@ -1237,27 +1237,27 @@ interface TextSourceCode<Options extends SourceCodeBaseTypeOptions = {
|
|
|
1237
1237
|
/**
|
|
1238
1238
|
* Represents the source of a binary file being linted.
|
|
1239
1239
|
*/
|
|
1240
|
-
interface BinarySourceCode<Options extends SourceCodeBaseTypeOptions = {
|
|
1241
|
-
LangOptions: LanguageOptions;
|
|
1240
|
+
interface BinarySourceCode$1<Options extends SourceCodeBaseTypeOptions$1 = {
|
|
1241
|
+
LangOptions: LanguageOptions$1;
|
|
1242
1242
|
RootNode: unknown;
|
|
1243
1243
|
SyntaxElementWithLoc: unknown;
|
|
1244
1244
|
ConfigNode: unknown;
|
|
1245
|
-
}> extends SourceCodeBase<Options> {
|
|
1245
|
+
}> extends SourceCodeBase$1<Options> {
|
|
1246
1246
|
/**
|
|
1247
1247
|
* The body of the file that you'd like rule developers to access.
|
|
1248
1248
|
*/
|
|
1249
1249
|
body: Uint8Array;
|
|
1250
1250
|
}
|
|
1251
|
-
type SourceCode$
|
|
1252
|
-
LangOptions: LanguageOptions;
|
|
1251
|
+
type SourceCode$2<Options extends SourceCodeBaseTypeOptions$1 = {
|
|
1252
|
+
LangOptions: LanguageOptions$1;
|
|
1253
1253
|
RootNode: unknown;
|
|
1254
1254
|
SyntaxElementWithLoc: unknown;
|
|
1255
1255
|
ConfigNode: unknown;
|
|
1256
|
-
}> = TextSourceCode<Options> | BinarySourceCode<Options>;
|
|
1256
|
+
}> = TextSourceCode$1<Options> | BinarySourceCode$1<Options>;
|
|
1257
1257
|
/**
|
|
1258
1258
|
* Represents a traversal step visiting the AST.
|
|
1259
1259
|
*/
|
|
1260
|
-
interface VisitTraversalStep {
|
|
1260
|
+
interface VisitTraversalStep$1 {
|
|
1261
1261
|
kind: 1;
|
|
1262
1262
|
target: unknown;
|
|
1263
1263
|
phase: 1 | 2;
|
|
@@ -1266,25 +1266,25 @@ interface VisitTraversalStep {
|
|
|
1266
1266
|
/**
|
|
1267
1267
|
* Represents a traversal step calling a function.
|
|
1268
1268
|
*/
|
|
1269
|
-
interface CallTraversalStep {
|
|
1269
|
+
interface CallTraversalStep$1 {
|
|
1270
1270
|
kind: 2;
|
|
1271
1271
|
target: string;
|
|
1272
1272
|
phase?: string;
|
|
1273
1273
|
args: unknown[];
|
|
1274
1274
|
}
|
|
1275
|
-
type TraversalStep = VisitTraversalStep | CallTraversalStep;
|
|
1275
|
+
type TraversalStep$1 = VisitTraversalStep$1 | CallTraversalStep$1;
|
|
1276
1276
|
/**
|
|
1277
1277
|
* The type of disable directive. This determines how ESLint will disable rules.
|
|
1278
1278
|
*/
|
|
1279
|
-
type DirectiveType = "disable" | "enable" | "disable-line" | "disable-next-line";
|
|
1279
|
+
type DirectiveType$1 = "disable" | "enable" | "disable-line" | "disable-next-line";
|
|
1280
1280
|
/**
|
|
1281
1281
|
* Represents a disable directive.
|
|
1282
1282
|
*/
|
|
1283
|
-
interface Directive$
|
|
1283
|
+
interface Directive$2 {
|
|
1284
1284
|
/**
|
|
1285
1285
|
* The type of directive.
|
|
1286
1286
|
*/
|
|
1287
|
-
type: DirectiveType;
|
|
1287
|
+
type: DirectiveType$1;
|
|
1288
1288
|
/**
|
|
1289
1289
|
* The node of the directive. May be in the AST or a comment/token.
|
|
1290
1290
|
*/
|
|
@@ -1308,7 +1308,7 @@ type InfiniteArray<T> = T | InfiniteArray<T>[];
|
|
|
1308
1308
|
* A config object that may appear inside of `extends`.
|
|
1309
1309
|
* `basePath` and nested `extends` are not allowed on extension config objects.
|
|
1310
1310
|
*/
|
|
1311
|
-
type ExtensionConfigObject = Omit<ConfigObject, "basePath"> & {
|
|
1311
|
+
type ExtensionConfigObject = Omit<ConfigObject$1, "basePath"> & {
|
|
1312
1312
|
extends?: never;
|
|
1313
1313
|
};
|
|
1314
1314
|
/**
|
|
@@ -1322,12 +1322,12 @@ type ExtendsElement = SimpleExtendsElement | InfiniteArray<ExtensionConfigObject
|
|
|
1322
1322
|
/**
|
|
1323
1323
|
* Config with extends. Valid only inside of `defineConfig()`.
|
|
1324
1324
|
*/
|
|
1325
|
-
interface ConfigWithExtends$1 extends ConfigObject {
|
|
1325
|
+
interface ConfigWithExtends$1 extends ConfigObject$1 {
|
|
1326
1326
|
extends?: ExtendsElement[];
|
|
1327
1327
|
}
|
|
1328
1328
|
//#endregion
|
|
1329
1329
|
//#region ../../node_modules/.pnpm/@eslint+config-helpers@0.5.3/node_modules/@eslint/config-helpers/dist/esm/index.d.ts
|
|
1330
|
-
type Plugin$
|
|
1330
|
+
type Plugin$2 = Plugin$3;
|
|
1331
1331
|
type ConfigWithExtends = ConfigWithExtends$1;
|
|
1332
1332
|
//#endregion
|
|
1333
1333
|
//#region ../../node_modules/.pnpm/@types+estree@1.0.8/node_modules/@types/estree/index.d.ts
|
|
@@ -1353,7 +1353,7 @@ interface BaseNodeWithoutComments {
|
|
|
1353
1353
|
// The type property should be a string literal. For example, Identifier
|
|
1354
1354
|
// has: `type: "Identifier"`
|
|
1355
1355
|
type: string;
|
|
1356
|
-
loc?: SourceLocation$
|
|
1356
|
+
loc?: SourceLocation$2 | null | undefined;
|
|
1357
1357
|
range?: [number, number] | undefined;
|
|
1358
1358
|
}
|
|
1359
1359
|
interface BaseNode extends BaseNodeWithoutComments {
|
|
@@ -1389,12 +1389,12 @@ interface Comment extends BaseNodeWithoutComments {
|
|
|
1389
1389
|
type: "Line" | "Block";
|
|
1390
1390
|
value: string;
|
|
1391
1391
|
}
|
|
1392
|
-
interface SourceLocation$
|
|
1392
|
+
interface SourceLocation$2 {
|
|
1393
1393
|
source?: string | null | undefined;
|
|
1394
|
-
start: Position;
|
|
1395
|
-
end: Position;
|
|
1394
|
+
start: Position$1;
|
|
1395
|
+
end: Position$1;
|
|
1396
1396
|
}
|
|
1397
|
-
interface Position {
|
|
1397
|
+
interface Position$1 {
|
|
1398
1398
|
/** >= 1 */
|
|
1399
1399
|
line: number;
|
|
1400
1400
|
/** >= 0 */
|
|
@@ -1403,10 +1403,10 @@ interface Position {
|
|
|
1403
1403
|
interface Program extends BaseNode {
|
|
1404
1404
|
type: "Program";
|
|
1405
1405
|
sourceType: "script" | "module";
|
|
1406
|
-
body: Array<Directive | Statement | ModuleDeclaration>;
|
|
1406
|
+
body: Array<Directive$1 | Statement | ModuleDeclaration>;
|
|
1407
1407
|
comments?: Comment[] | undefined;
|
|
1408
1408
|
}
|
|
1409
|
-
interface Directive extends BaseNode {
|
|
1409
|
+
interface Directive$1 extends BaseNode {
|
|
1410
1410
|
type: "ExpressionStatement";
|
|
1411
1411
|
expression: Literal;
|
|
1412
1412
|
directive: string;
|
|
@@ -1854,100 +1854,1214 @@ interface AwaitExpression extends BaseExpression {
|
|
|
1854
1854
|
argument: Expression;
|
|
1855
1855
|
}
|
|
1856
1856
|
//#endregion
|
|
1857
|
-
//#region ../../node_modules/.pnpm/@eslint+
|
|
1857
|
+
//#region ../../node_modules/.pnpm/@eslint+core@1.2.0/node_modules/@eslint/core/dist/esm/types.d.ts
|
|
1858
1858
|
/**
|
|
1859
|
-
*
|
|
1859
|
+
* Represents an error inside of a file.
|
|
1860
1860
|
*/
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
//#region ../../node_modules/.pnpm/eslint@10.1.0_jiti@2.6.1/node_modules/eslint/lib/types/index.d.ts
|
|
1868
|
-
//------------------------------------------------------------------------------
|
|
1869
|
-
// Exports
|
|
1870
|
-
//------------------------------------------------------------------------------
|
|
1871
|
-
declare namespace AST {
|
|
1872
|
-
type TokenType = "Boolean" | "Null" | "Identifier" | "PrivateIdentifier" | "Keyword" | "Punctuator" | "JSXIdentifier" | "JSXText" | "Numeric" | "String" | "Template" | "RegularExpression";
|
|
1873
|
-
interface Token {
|
|
1874
|
-
type: TokenType;
|
|
1875
|
-
value: string;
|
|
1876
|
-
range: Range;
|
|
1877
|
-
loc: SourceLocation;
|
|
1878
|
-
}
|
|
1879
|
-
interface SourceLocation {
|
|
1880
|
-
start: Position;
|
|
1881
|
-
end: Position;
|
|
1882
|
-
}
|
|
1883
|
-
type Range = SourceRange;
|
|
1884
|
-
interface Program extends Program {
|
|
1885
|
-
comments: Comment[];
|
|
1886
|
-
tokens: Token[];
|
|
1887
|
-
loc: SourceLocation;
|
|
1888
|
-
range: Range;
|
|
1889
|
-
}
|
|
1861
|
+
interface FileError {
|
|
1862
|
+
message: string;
|
|
1863
|
+
line: number;
|
|
1864
|
+
column: number;
|
|
1865
|
+
endLine?: number;
|
|
1866
|
+
endColumn?: number;
|
|
1890
1867
|
}
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1868
|
+
/**
|
|
1869
|
+
* Represents a problem found in a file.
|
|
1870
|
+
*/
|
|
1871
|
+
interface FileProblem {
|
|
1872
|
+
ruleId: string | null;
|
|
1873
|
+
message: string;
|
|
1874
|
+
loc: SourceLocation$1;
|
|
1894
1875
|
}
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
1920
|
-
|
|
1921
|
-
|
|
1922
|
-
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1876
|
+
/**
|
|
1877
|
+
* Represents the start and end coordinates of a node inside the source.
|
|
1878
|
+
*/
|
|
1879
|
+
interface SourceLocation$1 {
|
|
1880
|
+
start: Position;
|
|
1881
|
+
end: Position;
|
|
1882
|
+
}
|
|
1883
|
+
/**
|
|
1884
|
+
* Represents a location coordinate inside the source. ESLint-style formats
|
|
1885
|
+
* have just `line` and `column` while others may have `offset` as well.
|
|
1886
|
+
*/
|
|
1887
|
+
interface Position {
|
|
1888
|
+
line: number;
|
|
1889
|
+
column: number;
|
|
1890
|
+
}
|
|
1891
|
+
/**
|
|
1892
|
+
* Represents a range of characters in the source.
|
|
1893
|
+
*/
|
|
1894
|
+
type SourceRange = [number, number];
|
|
1895
|
+
/**
|
|
1896
|
+
* What the rule is responsible for finding:
|
|
1897
|
+
* - `problem` means the rule has noticed a potential error.
|
|
1898
|
+
* - `suggestion` means the rule suggests an alternate or better approach.
|
|
1899
|
+
* - `layout` means the rule is looking at spacing, indentation, etc.
|
|
1900
|
+
*/
|
|
1901
|
+
type RuleType = "problem" | "suggestion" | "layout";
|
|
1902
|
+
/**
|
|
1903
|
+
* The type of fix the rule can provide:
|
|
1904
|
+
* - `code` means the rule can fix syntax.
|
|
1905
|
+
* - `whitespace` means the rule can fix spacing and indentation.
|
|
1906
|
+
*/
|
|
1907
|
+
type RuleFixType = "code" | "whitespace";
|
|
1908
|
+
/**
|
|
1909
|
+
* An object containing visitor information for a rule. Each method is either the
|
|
1910
|
+
* name of a node type or a selector, or is a method that will be called at specific
|
|
1911
|
+
* times during the traversal.
|
|
1912
|
+
*/
|
|
1913
|
+
type RuleVisitor$1 = Record<string, ((...args: any[]) => void) | undefined>;
|
|
1914
|
+
/**
|
|
1915
|
+
* Rule meta information used for documentation.
|
|
1916
|
+
*/
|
|
1917
|
+
interface RulesMetaDocs {
|
|
1918
|
+
/**
|
|
1919
|
+
* A short description of the rule.
|
|
1920
|
+
*/
|
|
1921
|
+
description?: string | undefined;
|
|
1922
|
+
/**
|
|
1923
|
+
* The URL to the documentation for the rule.
|
|
1924
|
+
*/
|
|
1925
|
+
url?: string | undefined;
|
|
1926
|
+
/**
|
|
1927
|
+
* Indicates if the rule is generally recommended for all users.
|
|
1928
|
+
*
|
|
1929
|
+
* Note - this will always be a boolean for core rules, but may be used in any way by plugins.
|
|
1930
|
+
*/
|
|
1931
|
+
recommended?: unknown;
|
|
1932
|
+
/**
|
|
1933
|
+
* Indicates if the rule is frozen (no longer accepting feature requests).
|
|
1934
|
+
*/
|
|
1935
|
+
frozen?: boolean | undefined;
|
|
1936
|
+
/**
|
|
1937
|
+
* The dialects of the languages that the rule is intended to lint.
|
|
1938
|
+
* @example
|
|
1939
|
+
* ["JavaScript", "TypeScript"]
|
|
1940
|
+
*/
|
|
1941
|
+
dialects?: string[] | undefined;
|
|
1942
|
+
}
|
|
1943
|
+
/**
|
|
1944
|
+
* Meta information about a rule.
|
|
1945
|
+
*/
|
|
1946
|
+
interface RulesMeta<MessageIds extends string = string, RuleOptions = unknown[], ExtRuleDocs = unknown> {
|
|
1947
|
+
/**
|
|
1948
|
+
* Properties that are used when documenting the rule.
|
|
1949
|
+
*/
|
|
1950
|
+
docs?: (RulesMetaDocs & ExtRuleDocs) | undefined;
|
|
1951
|
+
/**
|
|
1952
|
+
* The type of rule.
|
|
1953
|
+
*/
|
|
1954
|
+
type?: RuleType | undefined;
|
|
1955
|
+
/**
|
|
1956
|
+
* The schema for the rule options. Required if the rule has options.
|
|
1957
|
+
*/
|
|
1958
|
+
schema?: JSONSchema4 | JSONSchema4[] | false | undefined;
|
|
1959
|
+
/**
|
|
1960
|
+
* Any default options to be recursively merged on top of any user-provided options.
|
|
1961
|
+
*/
|
|
1962
|
+
defaultOptions?: RuleOptions;
|
|
1963
|
+
/**
|
|
1964
|
+
* The messages that the rule can report.
|
|
1965
|
+
*/
|
|
1966
|
+
messages?: Record<MessageIds, string>;
|
|
1967
|
+
/**
|
|
1968
|
+
* Indicates whether the rule has been deprecated or provides additional metadata about the deprecation. Omit if not deprecated.
|
|
1969
|
+
*/
|
|
1970
|
+
deprecated?: boolean | DeprecatedInfo | undefined;
|
|
1971
|
+
/**
|
|
1972
|
+
* @deprecated Use deprecated.replacedBy instead.
|
|
1973
|
+
* The name of the rule(s) this rule was replaced by, if it was deprecated.
|
|
1974
|
+
*/
|
|
1975
|
+
replacedBy?: readonly string[] | undefined;
|
|
1976
|
+
/**
|
|
1977
|
+
* Indicates if the rule is fixable, and if so, what type of fix it provides.
|
|
1978
|
+
*/
|
|
1979
|
+
fixable?: RuleFixType | undefined;
|
|
1980
|
+
/**
|
|
1981
|
+
* Indicates if the rule may provide suggestions.
|
|
1982
|
+
*/
|
|
1983
|
+
hasSuggestions?: boolean | undefined;
|
|
1984
|
+
/**
|
|
1985
|
+
* The language the rule is intended to lint.
|
|
1986
|
+
* @deprecated Use `languages` instead.
|
|
1987
|
+
*/
|
|
1988
|
+
language?: string;
|
|
1989
|
+
/**
|
|
1990
|
+
* The dialects of `language` that the rule is intended to lint.
|
|
1991
|
+
* @deprecated Use `docs.dialects` instead.
|
|
1992
|
+
*/
|
|
1993
|
+
dialects?: string[];
|
|
1994
|
+
/**
|
|
1995
|
+
* Languages supported by this rule in the format `"plugin/language"`.
|
|
1996
|
+
* Use `"*"` for any language or `"plugin/*"` for any language from a specific plugin.
|
|
1997
|
+
* @example
|
|
1998
|
+
* ["js/js", "markdown/gfm", "json/jsonc", "css/css"]
|
|
1999
|
+
*/
|
|
2000
|
+
languages?: string[] | undefined;
|
|
2001
|
+
}
|
|
2002
|
+
/**
|
|
2003
|
+
* Provides additional metadata about a deprecation.
|
|
2004
|
+
*/
|
|
2005
|
+
interface DeprecatedInfo {
|
|
2006
|
+
/**
|
|
2007
|
+
* General message presented to the user, e.g. for the key rule why the rule
|
|
2008
|
+
* is deprecated or for info how to replace the rule.
|
|
2009
|
+
*/
|
|
2010
|
+
message?: string;
|
|
2011
|
+
/**
|
|
2012
|
+
* URL to more information about this deprecation in general.
|
|
2013
|
+
*/
|
|
2014
|
+
url?: string;
|
|
2015
|
+
/**
|
|
2016
|
+
* An empty array explicitly states that there is no replacement.
|
|
2017
|
+
*/
|
|
2018
|
+
replacedBy?: ReplacedByInfo[];
|
|
2019
|
+
/**
|
|
2020
|
+
* The package version since when the rule is deprecated (should use full
|
|
2021
|
+
* semver without a leading "v").
|
|
2022
|
+
*/
|
|
2023
|
+
deprecatedSince?: string;
|
|
2024
|
+
/**
|
|
2025
|
+
* The estimated version when the rule is removed (probably the next major
|
|
2026
|
+
* version). null means the rule is "frozen" (will be available but will not
|
|
2027
|
+
* be changed).
|
|
2028
|
+
*/
|
|
2029
|
+
availableUntil?: string | null;
|
|
2030
|
+
}
|
|
2031
|
+
/**
|
|
2032
|
+
* Provides metadata about a replacement
|
|
2033
|
+
*/
|
|
2034
|
+
interface ReplacedByInfo {
|
|
2035
|
+
/**
|
|
2036
|
+
* General message presented to the user, e.g. how to replace the rule
|
|
2037
|
+
*/
|
|
2038
|
+
message?: string;
|
|
2039
|
+
/**
|
|
2040
|
+
* URL to more information about this replacement in general
|
|
2041
|
+
*/
|
|
2042
|
+
url?: string;
|
|
2043
|
+
/**
|
|
2044
|
+
* Name should be "eslint" if the replacement is an ESLint core rule. Omit
|
|
2045
|
+
* the property if the replacement is in the same plugin.
|
|
2046
|
+
*/
|
|
2047
|
+
plugin?: ExternalSpecifier;
|
|
2048
|
+
/**
|
|
2049
|
+
* Name and documentation of the replacement rule
|
|
2050
|
+
*/
|
|
2051
|
+
rule?: ExternalSpecifier;
|
|
2052
|
+
}
|
|
2053
|
+
/**
|
|
2054
|
+
* Specifies the name and url of an external resource. At least one property
|
|
2055
|
+
* should be set.
|
|
2056
|
+
*/
|
|
2057
|
+
interface ExternalSpecifier {
|
|
2058
|
+
/**
|
|
2059
|
+
* Name of the referenced plugin / rule.
|
|
2060
|
+
*/
|
|
2061
|
+
name?: string;
|
|
2062
|
+
/**
|
|
2063
|
+
* URL pointing to documentation for the plugin / rule.
|
|
2064
|
+
*/
|
|
2065
|
+
url?: string;
|
|
2066
|
+
}
|
|
2067
|
+
/**
|
|
2068
|
+
* Generic type for `RuleContext`.
|
|
2069
|
+
*/
|
|
2070
|
+
interface RuleContextTypeOptions {
|
|
2071
|
+
LangOptions: LanguageOptions;
|
|
2072
|
+
Code: SourceCode$1;
|
|
2073
|
+
RuleOptions: unknown[];
|
|
2074
|
+
Node: unknown;
|
|
2075
|
+
MessageIds: string;
|
|
2076
|
+
}
|
|
2077
|
+
/**
|
|
2078
|
+
* Represents the context object that is passed to a rule. This object contains
|
|
2079
|
+
* information about the current state of the linting process and is the rule's
|
|
2080
|
+
* view into the outside world.
|
|
2081
|
+
*/
|
|
2082
|
+
interface RuleContext$1<Options extends RuleContextTypeOptions = RuleContextTypeOptions> {
|
|
2083
|
+
/**
|
|
2084
|
+
* The current working directory for the session.
|
|
2085
|
+
*/
|
|
2086
|
+
cwd: string;
|
|
2087
|
+
/**
|
|
2088
|
+
* The filename of the file being linted.
|
|
2089
|
+
*/
|
|
2090
|
+
filename: string;
|
|
2091
|
+
/**
|
|
2092
|
+
* The physical filename of the file being linted.
|
|
2093
|
+
*/
|
|
2094
|
+
physicalFilename: string;
|
|
2095
|
+
/**
|
|
2096
|
+
* The source code object that the rule is running on.
|
|
2097
|
+
*/
|
|
2098
|
+
sourceCode: Options["Code"];
|
|
2099
|
+
/**
|
|
2100
|
+
* Shared settings for the configuration.
|
|
2101
|
+
*/
|
|
2102
|
+
settings: SettingsConfig;
|
|
2103
|
+
/**
|
|
2104
|
+
* The language options for the configuration.
|
|
2105
|
+
*/
|
|
2106
|
+
languageOptions: Options["LangOptions"];
|
|
2107
|
+
/**
|
|
2108
|
+
* The rule ID.
|
|
2109
|
+
*/
|
|
2110
|
+
id: string;
|
|
2111
|
+
/**
|
|
2112
|
+
* The rule's configured options.
|
|
2113
|
+
*/
|
|
2114
|
+
options: Options["RuleOptions"];
|
|
2115
|
+
/**
|
|
2116
|
+
* The report function that the rule should use to report problems.
|
|
2117
|
+
* @param violation The violation to report.
|
|
2118
|
+
*/
|
|
2119
|
+
report(violation: ViolationReport<Options["Node"], Options["MessageIds"]>): void;
|
|
2120
|
+
}
|
|
2121
|
+
/**
|
|
2122
|
+
* Manager of text edits for a rule fix.
|
|
2123
|
+
*/
|
|
2124
|
+
interface RuleTextEditor<EditableSyntaxElement = unknown> {
|
|
2125
|
+
/**
|
|
2126
|
+
* Inserts text after the specified node or token.
|
|
2127
|
+
* @param syntaxElement The node or token to insert after.
|
|
2128
|
+
* @param text The edit to insert after the node or token.
|
|
2129
|
+
*/
|
|
2130
|
+
insertTextAfter(syntaxElement: EditableSyntaxElement, text: string): RuleTextEdit;
|
|
2131
|
+
/**
|
|
2132
|
+
* Inserts text after the specified range.
|
|
2133
|
+
* @param range The range to insert after.
|
|
2134
|
+
* @param text The edit to insert after the range.
|
|
2135
|
+
*/
|
|
2136
|
+
insertTextAfterRange(range: SourceRange, text: string): RuleTextEdit;
|
|
2137
|
+
/**
|
|
2138
|
+
* Inserts text before the specified node or token.
|
|
2139
|
+
* @param syntaxElement A syntax element with location information to insert before.
|
|
2140
|
+
* @param text The edit to insert before the node or token.
|
|
2141
|
+
*/
|
|
2142
|
+
insertTextBefore(syntaxElement: EditableSyntaxElement, text: string): RuleTextEdit;
|
|
2143
|
+
/**
|
|
2144
|
+
* Inserts text before the specified range.
|
|
2145
|
+
* @param range The range to insert before.
|
|
2146
|
+
* @param text The edit to insert before the range.
|
|
2147
|
+
*/
|
|
2148
|
+
insertTextBeforeRange(range: SourceRange, text: string): RuleTextEdit;
|
|
2149
|
+
/**
|
|
2150
|
+
* Removes the specified node or token.
|
|
2151
|
+
* @param syntaxElement A syntax element with location information to remove.
|
|
2152
|
+
* @returns The edit to remove the node or token.
|
|
2153
|
+
*/
|
|
2154
|
+
remove(syntaxElement: EditableSyntaxElement): RuleTextEdit;
|
|
2155
|
+
/**
|
|
2156
|
+
* Removes the specified range.
|
|
2157
|
+
* @param range The range to remove.
|
|
2158
|
+
* @returns The edit to remove the range.
|
|
2159
|
+
*/
|
|
2160
|
+
removeRange(range: SourceRange): RuleTextEdit;
|
|
2161
|
+
/**
|
|
2162
|
+
* Replaces the specified node or token with the given text.
|
|
2163
|
+
* @param syntaxElement A syntax element with location information to replace.
|
|
2164
|
+
* @param text The text to replace the node or token with.
|
|
2165
|
+
* @returns The edit to replace the node or token.
|
|
2166
|
+
*/
|
|
2167
|
+
replaceText(syntaxElement: EditableSyntaxElement, text: string): RuleTextEdit;
|
|
2168
|
+
/**
|
|
2169
|
+
* Replaces the specified range with the given text.
|
|
2170
|
+
* @param range The range to replace.
|
|
2171
|
+
* @param text The text to replace the range with.
|
|
2172
|
+
* @returns The edit to replace the range.
|
|
2173
|
+
*/
|
|
2174
|
+
replaceTextRange(range: SourceRange, text: string): RuleTextEdit;
|
|
2175
|
+
}
|
|
2176
|
+
/**
|
|
2177
|
+
* Represents a fix for a rule violation implemented as a text edit.
|
|
2178
|
+
*/
|
|
2179
|
+
interface RuleTextEdit {
|
|
2180
|
+
/**
|
|
2181
|
+
* The range to replace.
|
|
2182
|
+
*/
|
|
2183
|
+
range: SourceRange;
|
|
2184
|
+
/**
|
|
2185
|
+
* The text to insert.
|
|
2186
|
+
*/
|
|
2187
|
+
text: string;
|
|
2188
|
+
}
|
|
2189
|
+
/**
|
|
2190
|
+
* Fixes a violation.
|
|
2191
|
+
* @param fixer The text editor to apply the fix.
|
|
2192
|
+
* @returns The fix(es) for the violation.
|
|
2193
|
+
*/
|
|
2194
|
+
type RuleFixer = (fixer: RuleTextEditor) => RuleTextEdit | Iterable<RuleTextEdit> | null;
|
|
2195
|
+
/**
|
|
2196
|
+
* Data that can be used to fill placeholders in error messages.
|
|
2197
|
+
*/
|
|
2198
|
+
type MessagePlaceholderData = Record<string, string | number | boolean | bigint | null | undefined>;
|
|
2199
|
+
interface ViolationReportBase<MessageIds extends string = string> {
|
|
2200
|
+
/**
|
|
2201
|
+
* The data to insert into the message.
|
|
2202
|
+
*/
|
|
2203
|
+
data?: MessagePlaceholderData | undefined;
|
|
2204
|
+
/**
|
|
2205
|
+
* The fix to be applied for the violation.
|
|
2206
|
+
*/
|
|
2207
|
+
fix?: RuleFixer | null | undefined;
|
|
2208
|
+
/**
|
|
2209
|
+
* An array of suggested fixes for the problem. These fixes may change the
|
|
2210
|
+
* behavior of the code, so they are not applied automatically.
|
|
2211
|
+
*/
|
|
2212
|
+
suggest?: SuggestedEdit<MessageIds>[] | null | undefined;
|
|
2213
|
+
}
|
|
2214
|
+
type ViolationMessage<MessageIds extends string = string> = {
|
|
2215
|
+
message: string;
|
|
2216
|
+
} | {
|
|
2217
|
+
messageId: MessageIds;
|
|
2218
|
+
};
|
|
2219
|
+
type ViolationLocation<Node> = {
|
|
2220
|
+
loc: SourceLocation$1 | Position;
|
|
2221
|
+
} | {
|
|
2222
|
+
node: Node;
|
|
2223
|
+
};
|
|
2224
|
+
type ViolationReport<Node = unknown, MessageIds extends string = string> = ViolationReportBase<MessageIds> & ViolationMessage<MessageIds> & ViolationLocation<Node>;
|
|
2225
|
+
interface SuggestedEditBase {
|
|
2226
|
+
/**
|
|
2227
|
+
* The data to insert into the message.
|
|
2228
|
+
*/
|
|
2229
|
+
data?: MessagePlaceholderData | undefined;
|
|
2230
|
+
/**
|
|
2231
|
+
* The fix to be applied for the suggestion.
|
|
2232
|
+
*/
|
|
2233
|
+
fix: RuleFixer;
|
|
2234
|
+
}
|
|
2235
|
+
type SuggestionMessage<MessageIds extends string = string> = {
|
|
2236
|
+
desc: string;
|
|
2237
|
+
} | {
|
|
2238
|
+
messageId: MessageIds;
|
|
2239
|
+
};
|
|
2240
|
+
/**
|
|
2241
|
+
* A suggested edit for a rule violation.
|
|
2242
|
+
*/
|
|
2243
|
+
type SuggestedEdit<MessageIds extends string = string> = SuggestedEditBase & SuggestionMessage<MessageIds>;
|
|
2244
|
+
/**
|
|
2245
|
+
* The normalized version of a lint suggestion.
|
|
2246
|
+
*/
|
|
2247
|
+
interface LintSuggestion {
|
|
2248
|
+
/** A short description. */
|
|
2249
|
+
desc: string;
|
|
2250
|
+
/** Fix result info. */
|
|
2251
|
+
fix: RuleTextEdit;
|
|
2252
|
+
/** Id referencing a message for the description. */
|
|
2253
|
+
messageId?: string | undefined;
|
|
2254
|
+
}
|
|
2255
|
+
/**
|
|
2256
|
+
* The normalized version of a lint violation message.
|
|
2257
|
+
*/
|
|
2258
|
+
interface LintMessage$1 {
|
|
2259
|
+
/** The 1-based column number. */
|
|
2260
|
+
column: number;
|
|
2261
|
+
/** The 1-based line number. */
|
|
2262
|
+
line: number;
|
|
2263
|
+
/** The 1-based column number of the end location. */
|
|
2264
|
+
endColumn?: number | undefined;
|
|
2265
|
+
/** The 1-based line number of the end location. */
|
|
2266
|
+
endLine?: number | undefined;
|
|
2267
|
+
/** The ID of the rule which makes this message. */
|
|
2268
|
+
ruleId: string | null;
|
|
2269
|
+
/** The reported message. */
|
|
2270
|
+
message: string;
|
|
2271
|
+
/** The ID of the message in the rule's meta. */
|
|
2272
|
+
messageId?: string | undefined;
|
|
2273
|
+
/** If `true` then this is a fatal error. */
|
|
2274
|
+
fatal?: true | undefined;
|
|
2275
|
+
/** The severity of this message. */
|
|
2276
|
+
severity: Exclude<SeverityLevel, 0>;
|
|
2277
|
+
/** Information for autofix. */
|
|
2278
|
+
fix?: RuleTextEdit | undefined;
|
|
2279
|
+
/** Information for suggestions. */
|
|
2280
|
+
suggestions?: LintSuggestion[] | undefined;
|
|
2281
|
+
}
|
|
2282
|
+
/**
|
|
2283
|
+
* Generic options for the `RuleDefinition` type.
|
|
2284
|
+
*/
|
|
2285
|
+
interface RuleDefinitionTypeOptions {
|
|
2286
|
+
LangOptions: LanguageOptions;
|
|
2287
|
+
Code: SourceCode$1;
|
|
2288
|
+
RuleOptions: unknown[];
|
|
2289
|
+
Visitor: RuleVisitor$1;
|
|
2290
|
+
Node: unknown;
|
|
2291
|
+
MessageIds: string;
|
|
2292
|
+
ExtRuleDocs: unknown;
|
|
2293
|
+
}
|
|
2294
|
+
/**
|
|
2295
|
+
* The definition of an ESLint rule.
|
|
2296
|
+
*/
|
|
2297
|
+
interface RuleDefinition<Options extends RuleDefinitionTypeOptions = RuleDefinitionTypeOptions> {
|
|
2298
|
+
/**
|
|
2299
|
+
* The meta information for the rule.
|
|
2300
|
+
*/
|
|
2301
|
+
meta?: RulesMeta<Options["MessageIds"], Options["RuleOptions"], Options["ExtRuleDocs"]>;
|
|
2302
|
+
/**
|
|
2303
|
+
* Creates the visitor that ESLint uses to apply the rule during traversal.
|
|
2304
|
+
* @param context The rule context.
|
|
2305
|
+
* @returns The rule visitor.
|
|
2306
|
+
*/
|
|
2307
|
+
create(context: RuleContext$1<{
|
|
2308
|
+
LangOptions: Options["LangOptions"];
|
|
2309
|
+
Code: Options["Code"];
|
|
2310
|
+
RuleOptions: Options["RuleOptions"];
|
|
2311
|
+
Node: Options["Node"];
|
|
2312
|
+
MessageIds: Options["MessageIds"];
|
|
2313
|
+
}>): Options["Visitor"];
|
|
2314
|
+
}
|
|
2315
|
+
/**
|
|
2316
|
+
* The human readable severity level used in a configuration.
|
|
2317
|
+
*/
|
|
2318
|
+
type SeverityName = "off" | "warn" | "error";
|
|
2319
|
+
/**
|
|
2320
|
+
* The numeric severity level for a rule.
|
|
2321
|
+
*
|
|
2322
|
+
* - `0` means off.
|
|
2323
|
+
* - `1` means warn.
|
|
2324
|
+
* - `2` means error.
|
|
2325
|
+
*/
|
|
2326
|
+
type SeverityLevel = 0 | 1 | 2;
|
|
2327
|
+
/**
|
|
2328
|
+
* The severity of a rule in a configuration.
|
|
2329
|
+
*/
|
|
2330
|
+
type Severity = SeverityName | SeverityLevel;
|
|
2331
|
+
/**
|
|
2332
|
+
* Represents the metadata for an object, such as a plugin or processor.
|
|
2333
|
+
*/
|
|
2334
|
+
interface ObjectMetaProperties {
|
|
2335
|
+
/** @deprecated Use `meta.name` instead. */
|
|
2336
|
+
name?: string | undefined;
|
|
2337
|
+
/** @deprecated Use `meta.version` instead. */
|
|
2338
|
+
version?: string | undefined;
|
|
2339
|
+
meta?: {
|
|
2340
|
+
name?: string | undefined;
|
|
2341
|
+
version?: string | undefined;
|
|
2342
|
+
};
|
|
2343
|
+
}
|
|
2344
|
+
/**
|
|
2345
|
+
* Represents the configuration options for the core linter.
|
|
2346
|
+
*/
|
|
2347
|
+
interface LinterOptionsConfig {
|
|
2348
|
+
/**
|
|
2349
|
+
* Indicates whether or not inline configuration is evaluated.
|
|
2350
|
+
*/
|
|
2351
|
+
noInlineConfig?: boolean;
|
|
2352
|
+
/**
|
|
2353
|
+
* Indicates what to do when an unused disable directive is found.
|
|
2354
|
+
*/
|
|
2355
|
+
reportUnusedDisableDirectives?: boolean | Severity;
|
|
2356
|
+
/**
|
|
2357
|
+
* A severity value indicating if and how unused inline configs should be
|
|
2358
|
+
* tracked and reported.
|
|
2359
|
+
*/
|
|
2360
|
+
reportUnusedInlineConfigs?: Severity;
|
|
2361
|
+
}
|
|
2362
|
+
/**
|
|
2363
|
+
* The configuration for a rule.
|
|
2364
|
+
*/
|
|
2365
|
+
type RuleConfig<RuleOptions extends unknown[] = unknown[]> = Severity | [Severity, ...Partial<RuleOptions>];
|
|
2366
|
+
/**
|
|
2367
|
+
* A collection of rules and their configurations.
|
|
2368
|
+
*/
|
|
2369
|
+
interface RulesConfig {
|
|
2370
|
+
[key: string]: RuleConfig;
|
|
2371
|
+
}
|
|
2372
|
+
/**
|
|
2373
|
+
* A collection of settings.
|
|
2374
|
+
*/
|
|
2375
|
+
interface SettingsConfig {
|
|
2376
|
+
[key: string]: unknown;
|
|
2377
|
+
}
|
|
2378
|
+
/**
|
|
2379
|
+
* The configuration for a set of files.
|
|
2380
|
+
*/
|
|
2381
|
+
interface ConfigObject<Rules extends RulesConfig = RulesConfig> {
|
|
2382
|
+
/**
|
|
2383
|
+
* A string to identify the configuration object. Used in error messages and
|
|
2384
|
+
* inspection tools.
|
|
2385
|
+
*/
|
|
2386
|
+
name?: string;
|
|
2387
|
+
/**
|
|
2388
|
+
* Path to the directory where the configuration object should apply.
|
|
2389
|
+
* `files` and `ignores` patterns in the configuration object are
|
|
2390
|
+
* interpreted as relative to this path.
|
|
2391
|
+
*/
|
|
2392
|
+
basePath?: string;
|
|
2393
|
+
/**
|
|
2394
|
+
* An array of glob patterns indicating the files that the configuration
|
|
2395
|
+
* object should apply to. If not specified, the configuration object applies
|
|
2396
|
+
* to all files
|
|
2397
|
+
*/
|
|
2398
|
+
files?: (string | string[])[];
|
|
2399
|
+
/**
|
|
2400
|
+
* An array of glob patterns indicating the files that the configuration
|
|
2401
|
+
* object should not apply to. If not specified, the configuration object
|
|
2402
|
+
* applies to all files matched by files
|
|
2403
|
+
*/
|
|
2404
|
+
ignores?: string[];
|
|
2405
|
+
/**
|
|
2406
|
+
* The name of the language used for linting. This is used to determine the
|
|
2407
|
+
* parser and other language-specific settings.
|
|
2408
|
+
* @since 9.7.0
|
|
2409
|
+
*/
|
|
2410
|
+
language?: string;
|
|
2411
|
+
/**
|
|
2412
|
+
* An object containing settings related to how the language is configured for
|
|
2413
|
+
* linting.
|
|
2414
|
+
*/
|
|
2415
|
+
languageOptions?: LanguageOptions;
|
|
2416
|
+
/**
|
|
2417
|
+
* An object containing settings related to the linting process
|
|
2418
|
+
*/
|
|
2419
|
+
linterOptions?: LinterOptionsConfig;
|
|
2420
|
+
/**
|
|
2421
|
+
* Either an object containing preprocess() and postprocess() methods or a
|
|
2422
|
+
* string indicating the name of a processor inside of a plugin
|
|
2423
|
+
* (i.e., "pluginName/processorName").
|
|
2424
|
+
*/
|
|
2425
|
+
processor?: string | Processor;
|
|
2426
|
+
/**
|
|
2427
|
+
* An object containing a name-value mapping of plugin names to plugin objects.
|
|
2428
|
+
* When files is specified, these plugins are only available to the matching files.
|
|
2429
|
+
*/
|
|
2430
|
+
plugins?: Record<string, Plugin$1>;
|
|
2431
|
+
/**
|
|
2432
|
+
* An object containing the configured rules. When files or ignores are specified,
|
|
2433
|
+
* these rule configurations are only available to the matching files.
|
|
2434
|
+
*/
|
|
2435
|
+
rules?: Partial<Rules>;
|
|
2436
|
+
/**
|
|
2437
|
+
* An object containing name-value pairs of information that should be
|
|
2438
|
+
* available to all rules.
|
|
2439
|
+
*/
|
|
2440
|
+
settings?: SettingsConfig;
|
|
2441
|
+
}
|
|
2442
|
+
/** @deprecated Only supported in legacy eslintrc config format. */
|
|
2443
|
+
type GlobalAccess = boolean | "off" | "readable" | "readonly" | "writable" | "writeable";
|
|
2444
|
+
/** @deprecated Only supported in legacy eslintrc config format. */
|
|
2445
|
+
interface GlobalsConfig {
|
|
2446
|
+
[name: string]: GlobalAccess;
|
|
2447
|
+
}
|
|
2448
|
+
/**
|
|
2449
|
+
* The ECMAScript version of the code being linted.
|
|
2450
|
+
* @deprecated Only supported in legacy eslintrc config format.
|
|
2451
|
+
*/
|
|
2452
|
+
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";
|
|
2453
|
+
/**
|
|
2454
|
+
* The type of JavaScript source code.
|
|
2455
|
+
* @deprecated Only supported in legacy eslintrc config format.
|
|
2456
|
+
*/
|
|
2457
|
+
type JavaScriptSourceType = "script" | "module" | "commonjs";
|
|
2458
|
+
/**
|
|
2459
|
+
* Parser options.
|
|
2460
|
+
* @deprecated Only supported in legacy eslintrc config format.
|
|
2461
|
+
* @see [Specifying Parser Options](https://eslint.org/docs/latest/use/configure/language-options#specifying-parser-options)
|
|
2462
|
+
*/
|
|
2463
|
+
interface JavaScriptParserOptionsConfig {
|
|
2464
|
+
/**
|
|
2465
|
+
* Allow the use of reserved words as identifiers (if `ecmaVersion` is 3).
|
|
2466
|
+
*
|
|
2467
|
+
* @default false
|
|
2468
|
+
*/
|
|
2469
|
+
allowReserved?: boolean | undefined;
|
|
2470
|
+
/**
|
|
2471
|
+
* Accepts any valid ECMAScript version number or `'latest'`:
|
|
2472
|
+
*
|
|
2473
|
+
* - A version: es3, es5, es6, es7, es8, es9, es10, es11, es12, es13, es14, ..., or
|
|
2474
|
+
* - A year: es2015, es2016, es2017, es2018, es2019, es2020, es2021, es2022, es2023, ..., or
|
|
2475
|
+
* - `'latest'`
|
|
2476
|
+
*
|
|
2477
|
+
* When it's a version or a year, the value must be a number - so do not include the `es` prefix.
|
|
2478
|
+
*
|
|
2479
|
+
* 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
|
|
2480
|
+
*
|
|
2481
|
+
* @default 5
|
|
2482
|
+
*/
|
|
2483
|
+
ecmaVersion?: EcmaVersion$1 | undefined;
|
|
2484
|
+
/**
|
|
2485
|
+
* The type of JavaScript source code. Possible values are "script" for
|
|
2486
|
+
* traditional script files, "module" for ECMAScript modules (ESM), and
|
|
2487
|
+
* "commonjs" for CommonJS files.
|
|
2488
|
+
*
|
|
2489
|
+
* @default 'script'
|
|
2490
|
+
*
|
|
2491
|
+
* @see https://eslint.org/docs/latest/use/configure/language-options-deprecated#specifying-parser-options
|
|
2492
|
+
*/
|
|
2493
|
+
sourceType?: JavaScriptSourceType | undefined;
|
|
2494
|
+
/**
|
|
2495
|
+
* An object indicating which additional language features you'd like to use.
|
|
2496
|
+
*
|
|
2497
|
+
* @see https://eslint.org/docs/latest/use/configure/language-options-deprecated#specifying-parser-options
|
|
2498
|
+
*/
|
|
2499
|
+
ecmaFeatures?: {
|
|
2500
|
+
globalReturn?: boolean | undefined;
|
|
2501
|
+
impliedStrict?: boolean | undefined;
|
|
2502
|
+
jsx?: boolean | undefined;
|
|
2503
|
+
[key: string]: any;
|
|
2504
|
+
} | undefined;
|
|
2505
|
+
[key: string]: any;
|
|
2506
|
+
}
|
|
2507
|
+
/** @deprecated Only supported in legacy eslintrc config format. */
|
|
2508
|
+
interface EnvironmentConfig {
|
|
2509
|
+
/** The definition of global variables. */
|
|
2510
|
+
globals?: GlobalsConfig | undefined;
|
|
2511
|
+
/** The parser options that will be enabled under this environment. */
|
|
2512
|
+
parserOptions?: JavaScriptParserOptionsConfig | undefined;
|
|
2513
|
+
}
|
|
2514
|
+
/**
|
|
2515
|
+
* A configuration object that may have a `rules` block.
|
|
2516
|
+
*/
|
|
2517
|
+
interface HasRules<Rules extends RulesConfig = RulesConfig> {
|
|
2518
|
+
rules?: Partial<Rules> | undefined;
|
|
2519
|
+
}
|
|
2520
|
+
/**
|
|
2521
|
+
* ESLint legacy configuration.
|
|
2522
|
+
*
|
|
2523
|
+
* @see [ESLint Legacy Configuration](https://eslint.org/docs/latest/use/configure/)
|
|
2524
|
+
*/
|
|
2525
|
+
interface BaseConfig<Rules extends RulesConfig = RulesConfig, OverrideRules extends RulesConfig = Rules> extends HasRules<Rules> {
|
|
2526
|
+
$schema?: string | undefined;
|
|
2527
|
+
/**
|
|
2528
|
+
* An environment provides predefined global variables.
|
|
2529
|
+
*
|
|
2530
|
+
* @see [Environments](https://eslint.org/docs/latest/use/configure/language-options-deprecated#specifying-environments)
|
|
2531
|
+
*/
|
|
2532
|
+
env?: {
|
|
2533
|
+
[name: string]: boolean;
|
|
2534
|
+
} | undefined;
|
|
2535
|
+
/**
|
|
2536
|
+
* Extending configuration files.
|
|
2537
|
+
*
|
|
2538
|
+
* @see [Extends](https://eslint.org/docs/latest/use/configure/configuration-files-deprecated#extending-configuration-files)
|
|
2539
|
+
*/
|
|
2540
|
+
extends?: string | string[] | undefined;
|
|
2541
|
+
/**
|
|
2542
|
+
* Specifying globals.
|
|
2543
|
+
*
|
|
2544
|
+
* @see [Globals](https://eslint.org/docs/latest/use/configure/language-options-deprecated#specifying-globals)
|
|
2545
|
+
*/
|
|
2546
|
+
globals?: GlobalsConfig | undefined;
|
|
2547
|
+
/**
|
|
2548
|
+
* Disable processing of inline comments.
|
|
2549
|
+
*
|
|
2550
|
+
* @see [Disabling Inline Comments](https://eslint.org/docs/latest/use/configure/rules-deprecated#disabling-inline-comments)
|
|
2551
|
+
*/
|
|
2552
|
+
noInlineConfig?: boolean | undefined;
|
|
2553
|
+
/**
|
|
2554
|
+
* Overrides can be used to use a differing configuration for matching sub-directories and files.
|
|
2555
|
+
*
|
|
2556
|
+
* @see [How do overrides work](https://eslint.org/docs/latest/use/configure/configuration-files-deprecated#how-do-overrides-work)
|
|
2557
|
+
*/
|
|
2558
|
+
overrides?: ConfigOverride<OverrideRules>[] | undefined;
|
|
2559
|
+
/**
|
|
2560
|
+
* Parser.
|
|
2561
|
+
*
|
|
2562
|
+
* @see [Working with Custom Parsers](https://eslint.org/docs/latest/extend/custom-parsers)
|
|
2563
|
+
* @see [Specifying Parser](https://eslint.org/docs/latest/use/configure/parser-deprecated)
|
|
2564
|
+
*/
|
|
2565
|
+
parser?: string | undefined;
|
|
2566
|
+
/**
|
|
2567
|
+
* Parser options.
|
|
2568
|
+
*
|
|
2569
|
+
* @see [Working with Custom Parsers](https://eslint.org/docs/latest/extend/custom-parsers)
|
|
2570
|
+
* @see [Specifying Parser Options](https://eslint.org/docs/latest/use/configure/language-options-deprecated#specifying-parser-options)
|
|
2571
|
+
*/
|
|
2572
|
+
parserOptions?: JavaScriptParserOptionsConfig | undefined;
|
|
2573
|
+
/**
|
|
2574
|
+
* Which third-party plugins define additional rules, environments, configs, etc. for ESLint to use.
|
|
2575
|
+
*
|
|
2576
|
+
* @see [Configuring Plugins](https://eslint.org/docs/latest/use/configure/plugins-deprecated#configure-plugins)
|
|
2577
|
+
*/
|
|
2578
|
+
plugins?: string[] | undefined;
|
|
2579
|
+
/**
|
|
2580
|
+
* Specifying processor.
|
|
2581
|
+
*
|
|
2582
|
+
* @see [processor](https://eslint.org/docs/latest/use/configure/plugins-deprecated#specify-a-processor)
|
|
2583
|
+
*/
|
|
2584
|
+
processor?: string | undefined;
|
|
2585
|
+
/**
|
|
2586
|
+
* Report unused eslint-disable comments as warning.
|
|
2587
|
+
*
|
|
2588
|
+
* @see [Report unused eslint-disable comments](https://eslint.org/docs/latest/use/configure/rules-deprecated#report-unused-eslint-disable-comments)
|
|
2589
|
+
*/
|
|
2590
|
+
reportUnusedDisableDirectives?: boolean | undefined;
|
|
2591
|
+
/**
|
|
2592
|
+
* Settings.
|
|
2593
|
+
*
|
|
2594
|
+
* @see [Settings](https://eslint.org/docs/latest/use/configure/configuration-files-deprecated#adding-shared-settings)
|
|
2595
|
+
*/
|
|
2596
|
+
settings?: SettingsConfig | undefined;
|
|
2597
|
+
}
|
|
2598
|
+
/**
|
|
2599
|
+
* The overwrites that apply more differing configuration to specific files or directories.
|
|
2600
|
+
*/
|
|
2601
|
+
interface ConfigOverride<Rules extends RulesConfig = RulesConfig> extends BaseConfig<Rules> {
|
|
2602
|
+
/**
|
|
2603
|
+
* The glob patterns for excluded files.
|
|
2604
|
+
*/
|
|
2605
|
+
excludedFiles?: string | string[] | undefined;
|
|
2606
|
+
/**
|
|
2607
|
+
* The glob patterns for target files.
|
|
2608
|
+
*/
|
|
2609
|
+
files: string | string[];
|
|
2610
|
+
}
|
|
2611
|
+
/**
|
|
2612
|
+
* ESLint legacy configuration.
|
|
2613
|
+
*
|
|
2614
|
+
* @see [ESLint Legacy Configuration](https://eslint.org/docs/latest/use/configure/)
|
|
2615
|
+
*/
|
|
2616
|
+
interface LegacyConfigObject<Rules extends RulesConfig = RulesConfig, OverrideRules extends RulesConfig = Rules> extends BaseConfig<Rules, OverrideRules> {
|
|
2617
|
+
/**
|
|
2618
|
+
* Tell ESLint to ignore specific files and directories.
|
|
2619
|
+
*
|
|
2620
|
+
* @see [Ignore Patterns](https://eslint.org/docs/latest/use/configure/ignore-deprecated#ignorepatterns-in-config-files)
|
|
2621
|
+
*/
|
|
2622
|
+
ignorePatterns?: string | string[] | undefined;
|
|
2623
|
+
/**
|
|
2624
|
+
* @see [Using Configuration Files](https://eslint.org/docs/latest/use/configure/configuration-files-deprecated#using-configuration-files)
|
|
2625
|
+
*/
|
|
2626
|
+
root?: boolean | undefined;
|
|
2627
|
+
}
|
|
2628
|
+
/**
|
|
2629
|
+
* File information passed to a processor.
|
|
2630
|
+
*/
|
|
2631
|
+
interface ProcessorFile$1 {
|
|
2632
|
+
text: string;
|
|
2633
|
+
filename: string;
|
|
2634
|
+
}
|
|
2635
|
+
/**
|
|
2636
|
+
* A processor is an object that can preprocess and postprocess files.
|
|
2637
|
+
*/
|
|
2638
|
+
interface Processor<T extends string | ProcessorFile$1 = string | ProcessorFile$1> extends ObjectMetaProperties {
|
|
2639
|
+
/** If `true` then it means the processor supports autofix. */
|
|
2640
|
+
supportsAutofix?: boolean | undefined;
|
|
2641
|
+
/** The function to extract code blocks. */
|
|
2642
|
+
preprocess?(text: string, filename: string): T[];
|
|
2643
|
+
/** The function to merge messages. */
|
|
2644
|
+
postprocess?(messages: LintMessage$1[][], filename: string): LintMessage$1[];
|
|
2645
|
+
}
|
|
2646
|
+
interface Plugin$1 extends ObjectMetaProperties {
|
|
2647
|
+
meta?: ObjectMetaProperties["meta"] & {
|
|
2648
|
+
namespace?: string | undefined;
|
|
2649
|
+
};
|
|
2650
|
+
configs?: Record<string, LegacyConfigObject | ConfigObject | ConfigObject[]> | undefined;
|
|
2651
|
+
environments?: Record<string, EnvironmentConfig> | undefined;
|
|
2652
|
+
languages?: Record<string, Language> | undefined;
|
|
2653
|
+
processors?: Record<string, Processor> | undefined;
|
|
2654
|
+
rules?: Record<string, RuleDefinition> | undefined;
|
|
2655
|
+
}
|
|
2656
|
+
/**
|
|
2657
|
+
* Generic options for the `Language` type.
|
|
2658
|
+
*/
|
|
2659
|
+
interface LanguageTypeOptions {
|
|
2660
|
+
LangOptions: LanguageOptions;
|
|
2661
|
+
Code: SourceCode$1;
|
|
2662
|
+
RootNode: unknown;
|
|
2663
|
+
Node: unknown;
|
|
2664
|
+
}
|
|
2665
|
+
/**
|
|
2666
|
+
* Represents a plugin language.
|
|
2667
|
+
*/
|
|
2668
|
+
interface Language<Options extends LanguageTypeOptions = {
|
|
2669
|
+
LangOptions: LanguageOptions;
|
|
2670
|
+
Code: SourceCode$1;
|
|
2671
|
+
RootNode: unknown;
|
|
2672
|
+
Node: unknown;
|
|
2673
|
+
}> {
|
|
2674
|
+
/**
|
|
2675
|
+
* Indicates how ESLint should read the file.
|
|
2676
|
+
*/
|
|
2677
|
+
fileType: "text";
|
|
2678
|
+
/**
|
|
2679
|
+
* First line number returned from the parser (text mode only).
|
|
2680
|
+
*/
|
|
2681
|
+
lineStart: 0 | 1;
|
|
2682
|
+
/**
|
|
2683
|
+
* First column number returned from the parser (text mode only).
|
|
2684
|
+
*/
|
|
2685
|
+
columnStart: 0 | 1;
|
|
2686
|
+
/**
|
|
2687
|
+
* The property to read the node type from. Used in selector querying.
|
|
2688
|
+
*/
|
|
2689
|
+
nodeTypeKey: string;
|
|
2690
|
+
/**
|
|
2691
|
+
* The traversal path that tools should take when evaluating the AST
|
|
2692
|
+
*/
|
|
2693
|
+
visitorKeys?: Record<string, string[]>;
|
|
2694
|
+
/**
|
|
2695
|
+
* Default language options. User-defined options are merged with this object.
|
|
2696
|
+
*/
|
|
2697
|
+
defaultLanguageOptions?: Options["LangOptions"];
|
|
2698
|
+
/**
|
|
2699
|
+
* Validates languageOptions for this language.
|
|
2700
|
+
*/
|
|
2701
|
+
validateLanguageOptions(languageOptions: Options["LangOptions"]): void;
|
|
2702
|
+
/**
|
|
2703
|
+
* Normalizes languageOptions for this language.
|
|
2704
|
+
*/
|
|
2705
|
+
normalizeLanguageOptions?(languageOptions: Options["LangOptions"]): Options["LangOptions"];
|
|
2706
|
+
/**
|
|
2707
|
+
* Helper for esquery that allows languages to match nodes against
|
|
2708
|
+
* class. esquery currently has classes like `function` that will
|
|
2709
|
+
* match all the various function nodes. This method allows languages
|
|
2710
|
+
* to implement similar shorthands.
|
|
2711
|
+
*/
|
|
2712
|
+
matchesSelectorClass?(className: string, node: Options["Node"], ancestry: Options["Node"][]): boolean;
|
|
2713
|
+
/**
|
|
2714
|
+
* Parses the given file input into its component parts. This file should not
|
|
2715
|
+
* throws errors for parsing errors but rather should return any parsing
|
|
2716
|
+
* errors as parse of the ParseResult object.
|
|
2717
|
+
*/
|
|
2718
|
+
parse(file: File, context: LanguageContext<Options["LangOptions"]>): ParseResult<Options["RootNode"]>;
|
|
2719
|
+
/**
|
|
2720
|
+
* Creates SourceCode object that ESLint uses to work with a file.
|
|
2721
|
+
*/
|
|
2722
|
+
createSourceCode(file: File, input: OkParseResult<Options["RootNode"]>, context: LanguageContext<Options["LangOptions"]>): Options["Code"];
|
|
2723
|
+
}
|
|
2724
|
+
/**
|
|
2725
|
+
* Plugin-defined options for the language.
|
|
2726
|
+
*/
|
|
2727
|
+
type LanguageOptions = Record<string, unknown>;
|
|
2728
|
+
/**
|
|
2729
|
+
* The context object that is passed to the language plugin methods.
|
|
2730
|
+
*/
|
|
2731
|
+
interface LanguageContext<LangOptions = LanguageOptions> {
|
|
2732
|
+
languageOptions: LangOptions;
|
|
2733
|
+
}
|
|
2734
|
+
/**
|
|
2735
|
+
* Represents a file read by ESLint.
|
|
2736
|
+
*/
|
|
2737
|
+
interface File {
|
|
2738
|
+
/**
|
|
2739
|
+
* The path that ESLint uses for this file. May be a virtual path
|
|
2740
|
+
* if it was returned by a processor.
|
|
2741
|
+
*/
|
|
2742
|
+
path: string;
|
|
2743
|
+
/**
|
|
2744
|
+
* The path to the file on disk. This always maps directly to a file
|
|
2745
|
+
* regardless of whether it was returned from a processor.
|
|
2746
|
+
*/
|
|
2747
|
+
physicalPath: string;
|
|
2748
|
+
/**
|
|
2749
|
+
* Indicates if the original source contained a byte-order marker.
|
|
2750
|
+
* ESLint strips the BOM from the `body`, but this info is needed
|
|
2751
|
+
* to correctly apply autofixing.
|
|
2752
|
+
*/
|
|
2753
|
+
bom: boolean;
|
|
2754
|
+
/**
|
|
2755
|
+
* The body of the file to parse.
|
|
2756
|
+
*/
|
|
2757
|
+
body: string | Uint8Array;
|
|
2758
|
+
}
|
|
2759
|
+
/**
|
|
2760
|
+
* Represents the successful result of parsing a file.
|
|
2761
|
+
*/
|
|
2762
|
+
interface OkParseResult<RootNode = unknown> {
|
|
2763
|
+
/**
|
|
2764
|
+
* Indicates if the parse was successful. If true, the parse was successful
|
|
2765
|
+
* and ESLint should continue on to create a SourceCode object and run rules;
|
|
2766
|
+
* if false, ESLint should just report the error(s) without doing anything
|
|
2767
|
+
* else.
|
|
2768
|
+
*/
|
|
2769
|
+
ok: true;
|
|
2770
|
+
/**
|
|
2771
|
+
* The abstract syntax tree created by the parser. (only when ok: true)
|
|
2772
|
+
*/
|
|
2773
|
+
ast: RootNode;
|
|
2774
|
+
/**
|
|
2775
|
+
* Any additional data that the parser wants to provide.
|
|
2776
|
+
*/
|
|
2777
|
+
[key: string]: any;
|
|
2778
|
+
}
|
|
2779
|
+
/**
|
|
2780
|
+
* Represents the unsuccessful result of parsing a file.
|
|
2781
|
+
*/
|
|
2782
|
+
interface NotOkParseResult {
|
|
2783
|
+
/**
|
|
2784
|
+
* Indicates if the parse was successful. If true, the parse was successful
|
|
2785
|
+
* and ESLint should continue on to create a SourceCode object and run rules;
|
|
2786
|
+
* if false, ESLint should just report the error(s) without doing anything
|
|
2787
|
+
* else.
|
|
2788
|
+
*/
|
|
2789
|
+
ok: false;
|
|
2790
|
+
/**
|
|
2791
|
+
* Any parsing errors, whether fatal or not. (only when ok: false)
|
|
2792
|
+
*/
|
|
2793
|
+
errors: FileError[];
|
|
2794
|
+
/**
|
|
2795
|
+
* Any additional data that the parser wants to provide.
|
|
2796
|
+
*/
|
|
2797
|
+
[key: string]: any;
|
|
2798
|
+
}
|
|
2799
|
+
type ParseResult<RootNode = unknown> = OkParseResult<RootNode> | NotOkParseResult;
|
|
2800
|
+
/**
|
|
2801
|
+
* Represents inline configuration found in the source code.
|
|
2802
|
+
*/
|
|
2803
|
+
interface InlineConfigElement {
|
|
2804
|
+
/**
|
|
2805
|
+
* The location of the inline config element.
|
|
2806
|
+
*/
|
|
2807
|
+
loc: SourceLocation$1;
|
|
2808
|
+
/**
|
|
2809
|
+
* The interpreted configuration from the inline config element.
|
|
2810
|
+
*/
|
|
2811
|
+
config: {
|
|
2812
|
+
rules: RulesConfig;
|
|
2813
|
+
};
|
|
2814
|
+
}
|
|
2815
|
+
/**
|
|
2816
|
+
* Generic options for the `SourceCodeBase` type.
|
|
2817
|
+
*/
|
|
2818
|
+
interface SourceCodeBaseTypeOptions {
|
|
2819
|
+
LangOptions: LanguageOptions;
|
|
2820
|
+
RootNode: unknown;
|
|
2821
|
+
SyntaxElementWithLoc: unknown;
|
|
2822
|
+
ConfigNode: unknown;
|
|
2823
|
+
}
|
|
2824
|
+
/**
|
|
2825
|
+
* Represents the basic interface for a source code object.
|
|
2826
|
+
*/
|
|
2827
|
+
interface SourceCodeBase<Options extends SourceCodeBaseTypeOptions = {
|
|
2828
|
+
LangOptions: LanguageOptions;
|
|
2829
|
+
RootNode: unknown;
|
|
2830
|
+
SyntaxElementWithLoc: unknown;
|
|
2831
|
+
ConfigNode: unknown;
|
|
2832
|
+
}> {
|
|
2833
|
+
/**
|
|
2834
|
+
* Root of the AST.
|
|
2835
|
+
*/
|
|
2836
|
+
ast: Options["RootNode"];
|
|
2837
|
+
/**
|
|
2838
|
+
* The traversal path that tools should take when evaluating the AST.
|
|
2839
|
+
* When present, this overrides the `visitorKeys` on the language for
|
|
2840
|
+
* just this source code object.
|
|
2841
|
+
*/
|
|
2842
|
+
visitorKeys?: Record<string, string[]>;
|
|
2843
|
+
/**
|
|
2844
|
+
* Retrieves the equivalent of `loc` for a given node or token.
|
|
2845
|
+
* @param syntaxElement The node or token to get the location for.
|
|
2846
|
+
* @returns The location of the node or token.
|
|
2847
|
+
*/
|
|
2848
|
+
getLoc(syntaxElement: Options["SyntaxElementWithLoc"]): SourceLocation$1;
|
|
2849
|
+
/**
|
|
2850
|
+
* Retrieves the equivalent of `range` for a given node or token.
|
|
2851
|
+
* @param syntaxElement The node or token to get the range for.
|
|
2852
|
+
* @returns The range of the node or token.
|
|
2853
|
+
*/
|
|
2854
|
+
getRange(syntaxElement: Options["SyntaxElementWithLoc"]): SourceRange;
|
|
2855
|
+
/**
|
|
2856
|
+
* Traversal of AST.
|
|
2857
|
+
*/
|
|
2858
|
+
traverse(): Iterable<TraversalStep>;
|
|
2859
|
+
/**
|
|
2860
|
+
* Applies language options passed in from the ESLint core.
|
|
2861
|
+
*/
|
|
2862
|
+
applyLanguageOptions?(languageOptions: Options["LangOptions"]): void;
|
|
2863
|
+
/**
|
|
2864
|
+
* Return all of the inline areas where ESLint should be disabled/enabled
|
|
2865
|
+
* along with any problems found in evaluating the directives.
|
|
2866
|
+
*/
|
|
2867
|
+
getDisableDirectives?(): {
|
|
2868
|
+
directives: Directive[];
|
|
2869
|
+
problems: FileProblem[];
|
|
2870
|
+
};
|
|
2871
|
+
/**
|
|
2872
|
+
* Returns an array of all inline configuration nodes found in the
|
|
2873
|
+
* source code.
|
|
2874
|
+
*/
|
|
2875
|
+
getInlineConfigNodes?(): Options["ConfigNode"][];
|
|
2876
|
+
/**
|
|
2877
|
+
* Applies configuration found inside of the source code. This method is only
|
|
2878
|
+
* called when ESLint is running with inline configuration allowed.
|
|
2879
|
+
*/
|
|
2880
|
+
applyInlineConfig?(): {
|
|
2881
|
+
configs: InlineConfigElement[];
|
|
2882
|
+
problems: FileProblem[];
|
|
2883
|
+
};
|
|
2884
|
+
/**
|
|
2885
|
+
* Called by ESLint core to indicate that it has finished providing
|
|
2886
|
+
* information. We now add in all the missing variables and ensure that
|
|
2887
|
+
* state-changing methods cannot be called by rules.
|
|
2888
|
+
* @returns {void}
|
|
2889
|
+
*/
|
|
2890
|
+
finalize?(): void;
|
|
2891
|
+
}
|
|
2892
|
+
/**
|
|
2893
|
+
* Represents the source of a text file being linted.
|
|
2894
|
+
*/
|
|
2895
|
+
interface TextSourceCode<Options extends SourceCodeBaseTypeOptions = {
|
|
2896
|
+
LangOptions: LanguageOptions;
|
|
2897
|
+
RootNode: unknown;
|
|
2898
|
+
SyntaxElementWithLoc: unknown;
|
|
2899
|
+
ConfigNode: unknown;
|
|
2900
|
+
}> extends SourceCodeBase<Options> {
|
|
2901
|
+
/**
|
|
2902
|
+
* The body of the file that you'd like rule developers to access.
|
|
2903
|
+
*/
|
|
2904
|
+
text: string;
|
|
2905
|
+
}
|
|
2906
|
+
/**
|
|
2907
|
+
* Represents the source of a binary file being linted.
|
|
2908
|
+
*/
|
|
2909
|
+
interface BinarySourceCode<Options extends SourceCodeBaseTypeOptions = {
|
|
2910
|
+
LangOptions: LanguageOptions;
|
|
2911
|
+
RootNode: unknown;
|
|
2912
|
+
SyntaxElementWithLoc: unknown;
|
|
2913
|
+
ConfigNode: unknown;
|
|
2914
|
+
}> extends SourceCodeBase<Options> {
|
|
2915
|
+
/**
|
|
2916
|
+
* The body of the file that you'd like rule developers to access.
|
|
2917
|
+
*/
|
|
2918
|
+
body: Uint8Array;
|
|
2919
|
+
}
|
|
2920
|
+
type SourceCode$1<Options extends SourceCodeBaseTypeOptions = {
|
|
2921
|
+
LangOptions: LanguageOptions;
|
|
2922
|
+
RootNode: unknown;
|
|
2923
|
+
SyntaxElementWithLoc: unknown;
|
|
2924
|
+
ConfigNode: unknown;
|
|
2925
|
+
}> = TextSourceCode<Options> | BinarySourceCode<Options>;
|
|
2926
|
+
/**
|
|
2927
|
+
* Represents a traversal step visiting the AST.
|
|
2928
|
+
*/
|
|
2929
|
+
interface VisitTraversalStep {
|
|
2930
|
+
kind: 1;
|
|
2931
|
+
target: unknown;
|
|
2932
|
+
phase: 1 | 2;
|
|
2933
|
+
args: unknown[];
|
|
2934
|
+
}
|
|
2935
|
+
/**
|
|
2936
|
+
* Represents a traversal step calling a function.
|
|
2937
|
+
*/
|
|
2938
|
+
interface CallTraversalStep {
|
|
2939
|
+
kind: 2;
|
|
2940
|
+
target: string;
|
|
2941
|
+
phase?: string;
|
|
2942
|
+
args: unknown[];
|
|
2943
|
+
}
|
|
2944
|
+
type TraversalStep = VisitTraversalStep | CallTraversalStep;
|
|
2945
|
+
/**
|
|
2946
|
+
* The type of disable directive. This determines how ESLint will disable rules.
|
|
2947
|
+
*/
|
|
2948
|
+
type DirectiveType = "disable" | "enable" | "disable-line" | "disable-next-line";
|
|
2949
|
+
/**
|
|
2950
|
+
* Represents a disable directive.
|
|
2951
|
+
*/
|
|
2952
|
+
interface Directive {
|
|
2953
|
+
/**
|
|
2954
|
+
* The type of directive.
|
|
2955
|
+
*/
|
|
2956
|
+
type: DirectiveType;
|
|
2957
|
+
/**
|
|
2958
|
+
* The node of the directive. May be in the AST or a comment/token.
|
|
2959
|
+
*/
|
|
2960
|
+
node: unknown;
|
|
2961
|
+
/**
|
|
2962
|
+
* The value of the directive.
|
|
2963
|
+
*/
|
|
2964
|
+
value: string;
|
|
2965
|
+
/**
|
|
2966
|
+
* The justification for the directive.
|
|
2967
|
+
*/
|
|
2968
|
+
justification?: string;
|
|
2969
|
+
}
|
|
2970
|
+
//#endregion
|
|
2971
|
+
//#region ../../node_modules/.pnpm/@eslint+plugin-kit@0.7.0/node_modules/@eslint/plugin-kit/dist/esm/types.d.ts
|
|
2972
|
+
/**
|
|
2973
|
+
* Adds matching `:exit` selector properties for each key of a `RuleVisitor`.
|
|
2974
|
+
*/
|
|
2975
|
+
type CustomRuleVisitorWithExit$1<RuleVisitorType extends RuleVisitor$1> = { [Key in keyof RuleVisitorType as Key | `${Key & string}:exit`]: RuleVisitorType[Key] };
|
|
2976
|
+
//#endregion
|
|
2977
|
+
//#region ../../node_modules/.pnpm/@eslint+plugin-kit@0.7.0/node_modules/@eslint/plugin-kit/dist/esm/index.d.ts
|
|
2978
|
+
type RuleVisitor = RuleVisitor$1;
|
|
2979
|
+
type CustomRuleVisitorWithExit<RuleVisitorType extends RuleVisitor> = CustomRuleVisitorWithExit$1<RuleVisitorType>;
|
|
2980
|
+
//#endregion
|
|
2981
|
+
//#region ../../node_modules/.pnpm/eslint@10.2.0_jiti@2.6.1/node_modules/eslint/lib/types/index.d.ts
|
|
2982
|
+
//------------------------------------------------------------------------------
|
|
2983
|
+
// Exports
|
|
2984
|
+
//------------------------------------------------------------------------------
|
|
2985
|
+
declare namespace AST {
|
|
2986
|
+
type TokenType = "Boolean" | "Null" | "Identifier" | "PrivateIdentifier" | "Keyword" | "Punctuator" | "JSXIdentifier" | "JSXText" | "Numeric" | "String" | "Template" | "RegularExpression";
|
|
2987
|
+
interface Token {
|
|
2988
|
+
type: TokenType;
|
|
2989
|
+
value: string;
|
|
2990
|
+
range: Range;
|
|
2991
|
+
loc: SourceLocation;
|
|
2992
|
+
}
|
|
2993
|
+
interface SourceLocation {
|
|
2994
|
+
start: Position$1;
|
|
2995
|
+
end: Position$1;
|
|
2996
|
+
}
|
|
2997
|
+
type Range = SourceRange;
|
|
2998
|
+
interface Program extends Program {
|
|
2999
|
+
comments: Comment[];
|
|
3000
|
+
tokens: Token[];
|
|
3001
|
+
loc: SourceLocation;
|
|
3002
|
+
range: Range;
|
|
3003
|
+
}
|
|
3004
|
+
}
|
|
3005
|
+
interface JSXIdentifier extends BaseNode {
|
|
3006
|
+
type: "JSXIdentifier";
|
|
3007
|
+
name: string;
|
|
3008
|
+
}
|
|
3009
|
+
declare namespace Scope {
|
|
3010
|
+
interface ScopeManager {
|
|
3011
|
+
scopes: Scope[];
|
|
3012
|
+
globalScope: Scope | null;
|
|
3013
|
+
acquire(node: Node$1, inner?: boolean): Scope | null;
|
|
3014
|
+
getDeclaredVariables(node: Node$1): Variable[];
|
|
3015
|
+
addGlobals(names: ReadonlyArray<string>): void;
|
|
3016
|
+
}
|
|
3017
|
+
interface Scope {
|
|
3018
|
+
type: "block" | "catch" | "class" | "class-field-initializer" | "class-static-block" | "for" | "function" | "function-expression-name" | "global" | "module" | "switch" | "with";
|
|
3019
|
+
isStrict: boolean;
|
|
3020
|
+
upper: Scope | null;
|
|
3021
|
+
childScopes: Scope[];
|
|
3022
|
+
variableScope: Scope;
|
|
3023
|
+
block: Node$1;
|
|
3024
|
+
variables: Variable[];
|
|
3025
|
+
set: Map<string, Variable>;
|
|
3026
|
+
references: Reference[];
|
|
3027
|
+
through: Reference[];
|
|
3028
|
+
functionExpressionScope: boolean;
|
|
3029
|
+
implicit?: {
|
|
3030
|
+
variables: Variable[];
|
|
3031
|
+
set: Map<string, Variable>;
|
|
3032
|
+
};
|
|
3033
|
+
}
|
|
3034
|
+
interface Variable {
|
|
3035
|
+
name: string;
|
|
3036
|
+
scope: Scope;
|
|
3037
|
+
identifiers: Identifier[];
|
|
3038
|
+
references: Reference[];
|
|
3039
|
+
defs: Definition[];
|
|
3040
|
+
}
|
|
3041
|
+
interface Reference {
|
|
3042
|
+
identifier: Identifier | JSXIdentifier;
|
|
3043
|
+
from: Scope;
|
|
3044
|
+
resolved: Variable | null;
|
|
3045
|
+
writeExpr?: Expression | null;
|
|
3046
|
+
init?: boolean;
|
|
3047
|
+
isWrite(): boolean;
|
|
3048
|
+
isRead(): boolean;
|
|
3049
|
+
isWriteOnly(): boolean;
|
|
3050
|
+
isReadOnly(): boolean;
|
|
3051
|
+
isReadWrite(): boolean;
|
|
3052
|
+
}
|
|
3053
|
+
type DefinitionType = {
|
|
3054
|
+
type: "CatchClause";
|
|
3055
|
+
node: CatchClause;
|
|
3056
|
+
parent: null;
|
|
3057
|
+
} | {
|
|
3058
|
+
type: "ClassName";
|
|
3059
|
+
node: ClassDeclaration | ClassExpression;
|
|
3060
|
+
parent: null;
|
|
3061
|
+
} | {
|
|
3062
|
+
type: "FunctionName";
|
|
3063
|
+
node: FunctionDeclaration | FunctionExpression;
|
|
3064
|
+
parent: null;
|
|
1951
3065
|
} | {
|
|
1952
3066
|
type: "ImplicitGlobalVariable";
|
|
1953
3067
|
node: AssignmentExpression | ForInStatement | ForOfStatement;
|
|
@@ -1986,7 +3100,7 @@ declare class SourceCode implements TextSourceCode<{
|
|
|
1986
3100
|
constructor(text: string, ast: AST.Program);
|
|
1987
3101
|
constructor(config: SourceCode.Config);
|
|
1988
3102
|
static splitLines(text: string): string[];
|
|
1989
|
-
getLoc(syntaxElement: AST.Token | Node$1): SourceLocation$
|
|
3103
|
+
getLoc(syntaxElement: AST.Token | Node$1): SourceLocation$2;
|
|
1990
3104
|
getRange(syntaxElement: AST.Token | Node$1): SourceRange;
|
|
1991
3105
|
getText(node?: Node$1, beforeCount?: number, afterCount?: number): string;
|
|
1992
3106
|
getLines(): string[];
|
|
@@ -1994,8 +3108,8 @@ declare class SourceCode implements TextSourceCode<{
|
|
|
1994
3108
|
getAncestors(node: Node$1): Node$1[];
|
|
1995
3109
|
getDeclaredVariables(node: Node$1): Scope.Variable[];
|
|
1996
3110
|
getNodeByRangeIndex(index: number): Node$1 | null;
|
|
1997
|
-
getLocFromIndex(index: number): Position;
|
|
1998
|
-
getIndexFromLoc(location: Position): number; // Inherited methods from TokenStore
|
|
3111
|
+
getLocFromIndex(index: number): Position$1;
|
|
3112
|
+
getIndexFromLoc(location: Position$1): number; // Inherited methods from TokenStore
|
|
1999
3113
|
// ---------------------------------
|
|
2000
3114
|
getTokenByRangeStart(offset: number, options?: {
|
|
2001
3115
|
includeComments: false;
|
|
@@ -2176,7 +3290,7 @@ declare namespace SourceCode {
|
|
|
2176
3290
|
// #endregion
|
|
2177
3291
|
type JSSyntaxElement = {
|
|
2178
3292
|
type: string;
|
|
2179
|
-
loc?: SourceLocation$
|
|
3293
|
+
loc?: SourceLocation$2 | null | undefined;
|
|
2180
3294
|
};
|
|
2181
3295
|
declare namespace Rule {
|
|
2182
3296
|
interface RuleModule extends RuleDefinition<{
|
|
@@ -2537,7 +3651,7 @@ declare namespace ESLint {
|
|
|
2537
3651
|
type ConfigData<Rules extends Linter.RulesRecord = RulesConfig> = Omit<Linter.LegacyConfig<Rules>, "$schema">;
|
|
2538
3652
|
type Environment = EnvironmentConfig;
|
|
2539
3653
|
type ObjectMetaProperties = ObjectMetaProperties;
|
|
2540
|
-
type Plugin = Plugin$
|
|
3654
|
+
type Plugin = Plugin$1;
|
|
2541
3655
|
type FixType = "directive" | "problem" | "suggestion" | "layout";
|
|
2542
3656
|
type CacheStrategy = "content" | "metadata";
|
|
2543
3657
|
/** The options with which to configure the ESLint instance. */
|
|
@@ -2930,7 +4044,7 @@ declare class FlatConfigComposer<T extends object = ConfigWithExtends, ConfigNam
|
|
|
2930
4044
|
*
|
|
2931
4045
|
* The `plugins: { foo }` will be replaced from all configs with a new plugin that is a merge of it and the `bar` plugin
|
|
2932
4046
|
*/
|
|
2933
|
-
replacePlugin(name: string, replacement: Awaitable$1<Plugin$
|
|
4047
|
+
replacePlugin(name: string, replacement: Awaitable$1<Plugin$2> | ((original: Plugin$2) => Awaitable$1<Plugin$2>)): this;
|
|
2934
4048
|
/**
|
|
2935
4049
|
* Replace a specific config by name or index.
|
|
2936
4050
|
*
|
|
@@ -3004,12 +4118,60 @@ interface TailwindcssOption {
|
|
|
3004
4118
|
tailwindConfig?: string;
|
|
3005
4119
|
}
|
|
3006
4120
|
type TailwindcssConfig = boolean | TailwindcssOption;
|
|
4121
|
+
interface UnocssOption {
|
|
4122
|
+
/**
|
|
4123
|
+
* UnoCSS config file path, e.g. `uno.config.ts`.
|
|
4124
|
+
* When omitted, fallback to default project-root discovery.
|
|
4125
|
+
*/
|
|
4126
|
+
configPath?: string;
|
|
4127
|
+
/**
|
|
4128
|
+
* Enable UnoCSS attributify support.
|
|
4129
|
+
*/
|
|
4130
|
+
attributify?: boolean;
|
|
4131
|
+
/**
|
|
4132
|
+
* Enable UnoCSS strict mode.
|
|
4133
|
+
*/
|
|
4134
|
+
strict?: boolean;
|
|
4135
|
+
}
|
|
4136
|
+
type UnocssConfig = boolean | UnocssOption;
|
|
3007
4137
|
interface StylelintBridgeOption extends IcebreakerStylelintOptions {
|
|
3008
4138
|
cwd?: string;
|
|
3009
4139
|
}
|
|
3010
4140
|
type StylelintBridgeConfig = boolean | StylelintBridgeOption;
|
|
3011
4141
|
type ResolvableUserConfig = TypedFlatConfigItem$1 | TypedFlatConfigItem$1[] | FlatConfigComposer<any, any> | Linter.Config[];
|
|
3012
|
-
type
|
|
4142
|
+
type BaseFormatterOptions = Exclude<OptionsConfig['formatters'], boolean | undefined>;
|
|
4143
|
+
interface IcebreakerFormatterOptions extends Omit<BaseFormatterOptions, 'css' | 'html' | 'graphql' | 'markdown'> {
|
|
4144
|
+
/**
|
|
4145
|
+
* Enable formatting support for CSS, Less, Sass, and SCSS.
|
|
4146
|
+
* Icebreaker additionally supports `oxfmt`.
|
|
4147
|
+
*/
|
|
4148
|
+
css?: 'prettier' | 'oxfmt' | boolean;
|
|
4149
|
+
/**
|
|
4150
|
+
* Enable formatting support for HTML.
|
|
4151
|
+
* Icebreaker additionally supports `oxfmt`.
|
|
4152
|
+
*/
|
|
4153
|
+
html?: 'prettier' | 'oxfmt' | boolean;
|
|
4154
|
+
/**
|
|
4155
|
+
* Enable formatting support for Markdown.
|
|
4156
|
+
* Icebreaker additionally supports `oxfmt`.
|
|
4157
|
+
*/
|
|
4158
|
+
markdown?: 'prettier' | 'dprint' | 'oxfmt' | boolean;
|
|
4159
|
+
/**
|
|
4160
|
+
* Enable formatting support for GraphQL.
|
|
4161
|
+
* Icebreaker additionally supports `oxfmt`.
|
|
4162
|
+
*/
|
|
4163
|
+
graphql?: 'prettier' | 'oxfmt' | boolean;
|
|
4164
|
+
/**
|
|
4165
|
+
* Custom options passed to `format/oxfmt`.
|
|
4166
|
+
*/
|
|
4167
|
+
oxfmtOptions?: Record<string, unknown>;
|
|
4168
|
+
}
|
|
4169
|
+
type UserDefinedOptions = Omit<OptionsConfig, 'formatters' | 'unocss'> & TypedFlatConfigItem$1 & {
|
|
4170
|
+
/**
|
|
4171
|
+
* Enable external formatters for non-JS file types.
|
|
4172
|
+
* Icebreaker additionally supports `oxfmt` for css/html/markdown/graphql.
|
|
4173
|
+
*/
|
|
4174
|
+
formatters?: boolean | IcebreakerFormatterOptions;
|
|
3013
4175
|
/**
|
|
3014
4176
|
* Enable Mini Program support.
|
|
3015
4177
|
* @default false
|
|
@@ -3020,6 +4182,11 @@ type UserDefinedOptions = OptionsConfig & TypedFlatConfigItem$1 & {
|
|
|
3020
4182
|
* @default false
|
|
3021
4183
|
*/
|
|
3022
4184
|
tailwindcss?: TailwindcssConfig;
|
|
4185
|
+
/**
|
|
4186
|
+
* Enable UnoCSS support.
|
|
4187
|
+
* @default false
|
|
4188
|
+
*/
|
|
4189
|
+
unocss?: UnocssConfig;
|
|
3023
4190
|
/**
|
|
3024
4191
|
* Bridge Stylelint diagnostics into ESLint for style files.
|
|
3025
4192
|
* @default false
|
|
@@ -3068,4 +4235,4 @@ type IcebreakerLegacyEslintConfig = ReturnType<typeof icebreakerLegacy>;
|
|
|
3068
4235
|
//#region src/preset.d.ts
|
|
3069
4236
|
declare function getPresets(options?: UserDefinedOptions, mode?: 'legacy'): [UserDefinedOptions, ...UserConfigItem[]];
|
|
3070
4237
|
//#endregion
|
|
3071
|
-
export { type ConfigNames, type FlatConfigComposer, IcebreakerEslintConfig, IcebreakerLegacyEslintConfig, type StylelintBridgeConfig, type StylelintBridgeOption, type TailwindcssConfig, type TailwindcssOption, type TypedFlatConfigItem, type UserConfigItem, type UserDefinedOptions, getPresets, icebreaker, icebreakerLegacy };
|
|
4238
|
+
export { type ConfigNames, type FlatConfigComposer, IcebreakerEslintConfig, type IcebreakerFormatterOptions, IcebreakerLegacyEslintConfig, type StylelintBridgeConfig, type StylelintBridgeOption, type TailwindcssConfig, type TailwindcssOption, type TypedFlatConfigItem, type UnocssConfig, type UnocssOption, type UserConfigItem, type UserDefinedOptions, getPresets, icebreaker, icebreakerLegacy };
|