Initial import with skill sheet working
This commit is contained in:
201
node_modules/@eslint/core/LICENSE
generated
vendored
Normal file
201
node_modules/@eslint/core/LICENSE
generated
vendored
Normal file
@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
29
node_modules/@eslint/core/README.md
generated
vendored
Normal file
29
node_modules/@eslint/core/README.md
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
# ESLint Core
|
||||
|
||||
## Overview
|
||||
|
||||
This package is the future home of the rewritten, runtime-agnostic ESLint core.
|
||||
|
||||
Right now, it exports the core types necessary to implement language plugins.
|
||||
|
||||
## License
|
||||
|
||||
Apache 2.0
|
||||
|
||||
<!-- NOTE: This section is autogenerated. Do not manually edit.-->
|
||||
<!--sponsorsstart-->
|
||||
|
||||
## Sponsors
|
||||
|
||||
The following companies, organizations, and individuals support ESLint's ongoing maintenance and development. [Become a Sponsor](https://eslint.org/donate)
|
||||
to get your logo on our READMEs and [website](https://eslint.org/sponsors).
|
||||
|
||||
<h3>Platinum Sponsors</h3>
|
||||
<p><a href="https://automattic.com"><img src="https://images.opencollective.com/automattic/d0ef3e1/logo.png" alt="Automattic" height="128"></a> <a href="https://www.airbnb.com/"><img src="https://images.opencollective.com/airbnb/d327d66/logo.png" alt="Airbnb" height="128"></a></p><h3>Gold Sponsors</h3>
|
||||
<p><a href="https://trunk.io/"><img src="https://images.opencollective.com/trunkio/fb92d60/avatar.png" alt="trunk.io" height="96"></a></p><h3>Silver Sponsors</h3>
|
||||
<p><a href="https://www.serptriumph.com/"><img src="https://images.opencollective.com/serp-triumph5/fea3074/logo.png" alt="SERP Triumph" height="64"></a> <a href="https://www.jetbrains.com/"><img src="https://images.opencollective.com/jetbrains/fe76f99/logo.png" alt="JetBrains" height="64"></a> <a href="https://liftoff.io/"><img src="https://images.opencollective.com/liftoff/5c4fa84/logo.png" alt="Liftoff" height="64"></a> <a href="https://americanexpress.io"><img src="https://avatars.githubusercontent.com/u/3853301?v=4" alt="American Express" height="64"></a> <a href="https://www.workleap.com"><img src="https://avatars.githubusercontent.com/u/53535748?u=d1e55d7661d724bf2281c1bfd33cb8f99fe2465f&v=4" alt="Workleap" height="64"></a></p><h3>Bronze Sponsors</h3>
|
||||
<p><a href="https://cybozu.co.jp/"><img src="https://images.opencollective.com/cybozu/933e46d/logo.png" alt="Cybozu" height="32"></a> <a href="https://syntax.fm"><img src="https://github.com/syntaxfm.png" alt="Syntax" height="32"></a> <a href="https://www.wordhint.net/"><img src="https://images.opencollective.com/wordhint/be86813/avatar.png" alt="WordHint" height="32"></a> <a href="https://www.crosswordsolver.org/anagram-solver/"><img src="https://images.opencollective.com/anagram-solver/2666271/logo.png" alt="Anagram Solver" height="32"></a> <a href="https://icons8.com/"><img src="https://images.opencollective.com/icons8/7fa1641/logo.png" alt="Icons8" height="32"></a> <a href="https://discord.com"><img src="https://images.opencollective.com/discordapp/f9645d9/logo.png" alt="Discord" height="32"></a> <a href="https://www.gitbook.com"><img src="https://avatars.githubusercontent.com/u/7111340?v=4" alt="GitBook" height="32"></a> <a href="https://nx.dev"><img src="https://avatars.githubusercontent.com/u/23692104?v=4" alt="Nx" height="32"></a> <a href="https://herocoders.com"><img src="https://avatars.githubusercontent.com/u/37549774?v=4" alt="HeroCoders" height="32"></a></p>
|
||||
<h3>Technology Sponsors</h3>
|
||||
Technology sponsors allow us to use their products and services for free as part of a contribution to the open source ecosystem and our work.
|
||||
<p><a href="https://netlify.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/netlify-icon.svg" alt="Netlify" height="32"></a> <a href="https://algolia.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/algolia-icon.svg" alt="Algolia" height="32"></a> <a href="https://1password.com"><img src="https://raw.githubusercontent.com/eslint/eslint.org/main/src/assets/images/techsponsors/1password-icon.svg" alt="1Password" height="32"></a></p>
|
||||
<!--sponsorsend-->
|
735
node_modules/@eslint/core/dist/cjs/types.d.cts
generated
vendored
Normal file
735
node_modules/@eslint/core/dist/cjs/types.d.cts
generated
vendored
Normal file
@ -0,0 +1,735 @@
|
||||
/**
|
||||
* @fileoverview Shared types for ESLint Core.
|
||||
*/
|
||||
import { JSONSchema4 } from "json-schema";
|
||||
/**
|
||||
* Represents an error inside of a file.
|
||||
*/
|
||||
export interface FileError {
|
||||
message: string;
|
||||
line: number;
|
||||
column: number;
|
||||
endLine?: number;
|
||||
endColumn?: number;
|
||||
}
|
||||
/**
|
||||
* Represents a problem found in a file.
|
||||
*/
|
||||
export interface FileProblem {
|
||||
ruleId: string | null;
|
||||
message: string;
|
||||
loc: SourceLocation;
|
||||
}
|
||||
/**
|
||||
* Represents the start and end coordinates of a node inside the source.
|
||||
*/
|
||||
export interface SourceLocation {
|
||||
start: Position;
|
||||
end: Position;
|
||||
}
|
||||
/**
|
||||
* Represents the start and end coordinates of a node inside the source with an offset.
|
||||
*/
|
||||
export interface SourceLocationWithOffset {
|
||||
start: PositionWithOffset;
|
||||
end: PositionWithOffset;
|
||||
}
|
||||
/**
|
||||
* Represents a location coordinate inside the source. ESLint-style formats
|
||||
* have just `line` and `column` while others may have `offset` as well.
|
||||
*/
|
||||
export interface Position {
|
||||
line: number;
|
||||
column: number;
|
||||
}
|
||||
/**
|
||||
* Represents a location coordinate inside the source with an offset.
|
||||
*/
|
||||
export interface PositionWithOffset extends Position {
|
||||
offset: number;
|
||||
}
|
||||
/**
|
||||
* Represents a range of characters in the source.
|
||||
*/
|
||||
export type SourceRange = [number, number];
|
||||
/**
|
||||
* What the rule is responsible for finding:
|
||||
* - `problem` means the rule has noticed a potential error.
|
||||
* - `suggestion` means the rule suggests an alternate or better approach.
|
||||
* - `layout` means the rule is looking at spacing, indentation, etc.
|
||||
*/
|
||||
export type RuleType = "problem" | "suggestion" | "layout";
|
||||
/**
|
||||
* The type of fix the rule can provide:
|
||||
* - `code` means the rule can fix syntax.
|
||||
* - `whitespace` means the rule can fix spacing and indentation.
|
||||
*/
|
||||
export type RuleFixType = "code" | "whitespace";
|
||||
/**
|
||||
* An object containing visitor information for a rule. Each method is either the
|
||||
* name of a node type or a selector, or is a method that will be called at specific
|
||||
* times during the traversal.
|
||||
*/
|
||||
export interface RuleVisitor {
|
||||
/**
|
||||
* Called for each node in the AST or at specific times during the traversal.
|
||||
*/
|
||||
[key: string]: (...args: any[]) => void;
|
||||
}
|
||||
/**
|
||||
* Rule meta information used for documentation.
|
||||
*/
|
||||
export interface RulesMetaDocs {
|
||||
/**
|
||||
* A short description of the rule.
|
||||
*/
|
||||
description?: string | undefined;
|
||||
/**
|
||||
* The URL to the documentation for the rule.
|
||||
*/
|
||||
url?: string | undefined;
|
||||
/**
|
||||
* The category the rule falls under.
|
||||
* @deprecated No longer used.
|
||||
*/
|
||||
category?: string | undefined;
|
||||
/**
|
||||
* Indicates if the rule is generally recommended for all users.
|
||||
*/
|
||||
recommended?: boolean | undefined;
|
||||
}
|
||||
/**
|
||||
* Meta information about a rule.
|
||||
*/
|
||||
export interface RulesMeta<MessageIds extends string = string, ExtRuleDocs = unknown> {
|
||||
/**
|
||||
* Properties that are used when documenting the rule.
|
||||
*/
|
||||
docs?: (RulesMetaDocs & ExtRuleDocs) | undefined;
|
||||
/**
|
||||
* The type of rule.
|
||||
*/
|
||||
type?: RuleType | undefined;
|
||||
/**
|
||||
* The schema for the rule options. Required if the rule has options.
|
||||
*/
|
||||
schema?: JSONSchema4 | JSONSchema4[] | false | undefined;
|
||||
/**
|
||||
* The messages that the rule can report.
|
||||
*/
|
||||
messages?: Record<MessageIds, string>;
|
||||
/**
|
||||
* The deprecated rules for the rule.
|
||||
*/
|
||||
deprecated?: boolean | undefined;
|
||||
/**
|
||||
* When a rule is deprecated, indicates the rule ID(s) that should be used instead.
|
||||
*/
|
||||
replacedBy?: string[] | undefined;
|
||||
/**
|
||||
* Indicates if the rule is fixable, and if so, what type of fix it provides.
|
||||
*/
|
||||
fixable?: RuleFixType | undefined;
|
||||
/**
|
||||
* Indicates if the rule may provide suggestions.
|
||||
*/
|
||||
hasSuggestions?: boolean | undefined;
|
||||
}
|
||||
/**
|
||||
* Generic type for `RuleContext`.
|
||||
*/
|
||||
export interface RuleContextTypeOptions {
|
||||
LangOptions: LanguageOptions;
|
||||
Code: SourceCode;
|
||||
RuleOptions: unknown[];
|
||||
Node: unknown;
|
||||
}
|
||||
/**
|
||||
* Represents the context object that is passed to a rule. This object contains
|
||||
* information about the current state of the linting process and is the rule's
|
||||
* view into the outside world.
|
||||
*/
|
||||
export interface RuleContext<Options extends RuleContextTypeOptions = {
|
||||
LangOptions: LanguageOptions;
|
||||
Code: SourceCode;
|
||||
RuleOptions: unknown[];
|
||||
Node: unknown;
|
||||
}> {
|
||||
/**
|
||||
* The current working directory for the session.
|
||||
*/
|
||||
cwd: string;
|
||||
/**
|
||||
* Returns the current working directory for the session.
|
||||
* @deprecated Use `cwd` instead.
|
||||
*/
|
||||
getCwd(): string;
|
||||
/**
|
||||
* The filename of the file being linted.
|
||||
*/
|
||||
filename: string;
|
||||
/**
|
||||
* Returns the filename of the file being linted.
|
||||
* @deprecated Use `filename` instead.
|
||||
*/
|
||||
getFilename(): string;
|
||||
/**
|
||||
* The physical filename of the file being linted.
|
||||
*/
|
||||
physicalFilename: string;
|
||||
/**
|
||||
* Returns the physical filename of the file being linted.
|
||||
* @deprecated Use `physicalFilename` instead.
|
||||
*/
|
||||
getPhysicalFilename(): string;
|
||||
/**
|
||||
* The source code object that the rule is running on.
|
||||
*/
|
||||
sourceCode: Options["Code"];
|
||||
/**
|
||||
* Returns the source code object that the rule is running on.
|
||||
* @deprecated Use `sourceCode` instead.
|
||||
*/
|
||||
getSourceCode(): Options["Code"];
|
||||
/**
|
||||
* Shared settings for the configuration.
|
||||
*/
|
||||
settings: SettingsConfig;
|
||||
/**
|
||||
* Parser-specific options for the configuration.
|
||||
* @deprecated Use `languageOptions.parserOptions` instead.
|
||||
*/
|
||||
parserOptions: Record<string, unknown>;
|
||||
/**
|
||||
* The language options for the configuration.
|
||||
*/
|
||||
languageOptions: Options["LangOptions"];
|
||||
/**
|
||||
* The CommonJS path to the parser used while parsing this file.
|
||||
* @deprecated No longer used.
|
||||
*/
|
||||
parserPath: string | undefined;
|
||||
/**
|
||||
* The rule ID.
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* The rule's configured options.
|
||||
*/
|
||||
options: Options["RuleOptions"];
|
||||
/**
|
||||
* The report function that the rule should use to report problems.
|
||||
* @param violation The violation to report.
|
||||
*/
|
||||
report(violation: ViolationReport<Options["Node"]>): void;
|
||||
}
|
||||
/**
|
||||
* Manager of text edits for a rule fix.
|
||||
*/
|
||||
export interface RuleTextEditor<EditableSyntaxElement = unknown> {
|
||||
/**
|
||||
* Inserts text after the specified node or token.
|
||||
* @param syntaxElement The node or token to insert after.
|
||||
* @param text The edit to insert after the node or token.
|
||||
*/
|
||||
insertTextAfter(syntaxElement: EditableSyntaxElement, text: string): RuleTextEdit;
|
||||
/**
|
||||
* Inserts text after the specified range.
|
||||
* @param range The range to insert after.
|
||||
* @param text The edit to insert after the range.
|
||||
*/
|
||||
insertTextAfterRange(range: SourceRange, text: string): RuleTextEdit;
|
||||
/**
|
||||
* Inserts text before the specified node or token.
|
||||
* @param syntaxElement A syntax element with location information to insert before.
|
||||
* @param text The edit to insert before the node or token.
|
||||
*/
|
||||
insertTextBefore(syntaxElement: EditableSyntaxElement, text: string): RuleTextEdit;
|
||||
/**
|
||||
* Inserts text before the specified range.
|
||||
* @param range The range to insert before.
|
||||
* @param text The edit to insert before the range.
|
||||
*/
|
||||
insertTextBeforeRange(range: SourceRange, text: string): RuleTextEdit;
|
||||
/**
|
||||
* Removes the specified node or token.
|
||||
* @param syntaxElement A syntax element with location information to remove.
|
||||
* @returns The edit to remove the node or token.
|
||||
*/
|
||||
remove(syntaxElement: EditableSyntaxElement): RuleTextEdit;
|
||||
/**
|
||||
* Removes the specified range.
|
||||
* @param range The range to remove.
|
||||
* @returns The edit to remove the range.
|
||||
*/
|
||||
removeRange(range: SourceRange): RuleTextEdit;
|
||||
/**
|
||||
* Replaces the specified node or token with the given text.
|
||||
* @param syntaxElement A syntax element with location information to replace.
|
||||
* @param text The text to replace the node or token with.
|
||||
* @returns The edit to replace the node or token.
|
||||
*/
|
||||
replaceText(syntaxElement: EditableSyntaxElement, text: string): RuleTextEdit;
|
||||
/**
|
||||
* Replaces the specified range with the given text.
|
||||
* @param range The range to replace.
|
||||
* @param text The text to replace the range with.
|
||||
* @returns The edit to replace the range.
|
||||
*/
|
||||
replaceTextRange(range: SourceRange, text: string): RuleTextEdit;
|
||||
}
|
||||
/**
|
||||
* Represents a fix for a rule violation implemented as a text edit.
|
||||
*/
|
||||
export interface RuleTextEdit {
|
||||
/**
|
||||
* The range to replace.
|
||||
*/
|
||||
range: SourceRange;
|
||||
/**
|
||||
* The text to insert.
|
||||
*/
|
||||
text: string;
|
||||
}
|
||||
interface ViolationReportBase {
|
||||
/**
|
||||
* The type of node that the violation is for.
|
||||
* @deprecated May be removed in the future.
|
||||
*/
|
||||
nodeType?: string | undefined;
|
||||
/**
|
||||
* The data to insert into the message.
|
||||
*/
|
||||
data?: Record<string, string> | undefined;
|
||||
/**
|
||||
* The fix to be applied for the violation.
|
||||
* @param fixer The text editor to apply the fix.
|
||||
* @returns The fix(es) for the violation.
|
||||
*/
|
||||
fix?(fixer: RuleTextEditor): RuleTextEdit | Iterable<RuleTextEdit> | null;
|
||||
/**
|
||||
* An array of suggested fixes for the problem. These fixes may change the
|
||||
* behavior of the code, so they are not applied automatically.
|
||||
*/
|
||||
suggest?: SuggestedEdit[];
|
||||
}
|
||||
type ViolationMessage = {
|
||||
message: string;
|
||||
} | {
|
||||
messageId: string;
|
||||
};
|
||||
type ViolationLocation<Node> = {
|
||||
loc: SourceLocation;
|
||||
} | {
|
||||
node: Node;
|
||||
};
|
||||
export type ViolationReport<Node = unknown> = ViolationReportBase & ViolationMessage & ViolationLocation<Node>;
|
||||
interface SuggestedEditBase {
|
||||
/**
|
||||
* The data to insert into the message.
|
||||
*/
|
||||
data?: Record<string, string> | undefined;
|
||||
/**
|
||||
* The fix to be applied for the suggestion.
|
||||
* @param fixer The text editor to apply the fix.
|
||||
* @returns The fix for the suggestion.
|
||||
*/
|
||||
fix?(fixer: RuleTextEditor): RuleTextEdit | Iterable<RuleTextEdit> | null;
|
||||
}
|
||||
type SuggestionMessage = {
|
||||
desc: string;
|
||||
} | {
|
||||
messageId: string;
|
||||
};
|
||||
/**
|
||||
* A suggested edit for a rule violation.
|
||||
*/
|
||||
export type SuggestedEdit = SuggestedEditBase & SuggestionMessage;
|
||||
/**
|
||||
* Generic options for the `RuleDefinition` type.
|
||||
*/
|
||||
export interface RuleDefinitionTypeOptions {
|
||||
LangOptions: LanguageOptions;
|
||||
Code: SourceCode;
|
||||
RuleOptions: unknown[];
|
||||
Visitor: RuleVisitor;
|
||||
Node: unknown;
|
||||
MessageIds: string;
|
||||
ExtRuleDocs: unknown;
|
||||
}
|
||||
/**
|
||||
* The definition of an ESLint rule.
|
||||
*/
|
||||
export interface RuleDefinition<Options extends RuleDefinitionTypeOptions> {
|
||||
/**
|
||||
* The meta information for the rule.
|
||||
*/
|
||||
meta?: RulesMeta<Options["MessageIds"], Options["ExtRuleDocs"]>;
|
||||
/**
|
||||
* Creates the visitor that ESLint uses to apply the rule during traversal.
|
||||
* @param context The rule context.
|
||||
* @returns The rule visitor.
|
||||
*/
|
||||
create(context: RuleContext<{
|
||||
LangOptions: Options["LangOptions"];
|
||||
Code: Options["Code"];
|
||||
RuleOptions: Options["RuleOptions"];
|
||||
Node: Options["Node"];
|
||||
}>): Options["Visitor"];
|
||||
}
|
||||
/**
|
||||
* The human readable severity level used in a configuration.
|
||||
*/
|
||||
export type SeverityName = "off" | "warn" | "error";
|
||||
/**
|
||||
* The numeric severity level for a rule.
|
||||
*
|
||||
* - `0` means off.
|
||||
* - `1` means warn.
|
||||
* - `2` means error.
|
||||
*/
|
||||
export type SeverityLevel = 0 | 1 | 2;
|
||||
/**
|
||||
* The severity of a rule in a configuration.
|
||||
*/
|
||||
export type Severity = SeverityName | SeverityLevel;
|
||||
/**
|
||||
* Represents the configuration options for the core linter.
|
||||
*/
|
||||
export interface LinterOptionsConfig {
|
||||
/**
|
||||
* Indicates whether or not inline configuration is evaluated.
|
||||
*/
|
||||
noInlineConfig?: boolean;
|
||||
/**
|
||||
* Indicates what to do when an unused disable directive is found.
|
||||
*/
|
||||
reportUnusedDisableDirectives?: boolean | Severity;
|
||||
}
|
||||
/**
|
||||
* Shared settings that are accessible from within plugins.
|
||||
*/
|
||||
export type SettingsConfig = Record<string, unknown>;
|
||||
/**
|
||||
* The configuration for a rule.
|
||||
*/
|
||||
export type RuleConfig = Severity | [Severity, ...unknown[]];
|
||||
/**
|
||||
* A collection of rules and their configurations.
|
||||
*/
|
||||
export type RulesConfig = Record<string, RuleConfig>;
|
||||
/**
|
||||
* Generic options for the `Language` type.
|
||||
*/
|
||||
export interface LanguageTypeOptions {
|
||||
LangOptions: LanguageOptions;
|
||||
Code: SourceCode;
|
||||
RootNode: unknown;
|
||||
Node: unknown;
|
||||
}
|
||||
/**
|
||||
* Represents a plugin language.
|
||||
*/
|
||||
export interface Language<Options extends LanguageTypeOptions = {
|
||||
LangOptions: LanguageOptions;
|
||||
Code: SourceCode;
|
||||
RootNode: unknown;
|
||||
Node: unknown;
|
||||
}> {
|
||||
/**
|
||||
* Indicates how ESLint should read the file.
|
||||
*/
|
||||
fileType: "text";
|
||||
/**
|
||||
* First line number returned from the parser (text mode only).
|
||||
*/
|
||||
lineStart: 0 | 1;
|
||||
/**
|
||||
* First column number returned from the parser (text mode only).
|
||||
*/
|
||||
columnStart: 0 | 1;
|
||||
/**
|
||||
* The property to read the node type from. Used in selector querying.
|
||||
*/
|
||||
nodeTypeKey: string;
|
||||
/**
|
||||
* The traversal path that tools should take when evaluating the AST
|
||||
*/
|
||||
visitorKeys?: Record<string, string[]>;
|
||||
/**
|
||||
* Default language options. User-defined options are merged with this object.
|
||||
*/
|
||||
defaultLanguageOptions?: LanguageOptions;
|
||||
/**
|
||||
* Validates languageOptions for this language.
|
||||
*/
|
||||
validateLanguageOptions(languageOptions: Options["LangOptions"]): void;
|
||||
/**
|
||||
* Normalizes languageOptions for this language.
|
||||
*/
|
||||
normalizeLanguageOptions?(languageOptions: Options["LangOptions"]): Options["LangOptions"];
|
||||
/**
|
||||
* Helper for esquery that allows languages to match nodes against
|
||||
* class. esquery currently has classes like `function` that will
|
||||
* match all the various function nodes. This method allows languages
|
||||
* to implement similar shorthands.
|
||||
*/
|
||||
matchesSelectorClass?(className: string, node: Options["Node"], ancestry: Options["Node"][]): boolean;
|
||||
/**
|
||||
* Parses the given file input into its component parts. This file should not
|
||||
* throws errors for parsing errors but rather should return any parsing
|
||||
* errors as parse of the ParseResult object.
|
||||
*/
|
||||
parse(file: File, context: LanguageContext<Options["LangOptions"]>): ParseResult<Options["RootNode"]>;
|
||||
/**
|
||||
* Creates SourceCode object that ESLint uses to work with a file.
|
||||
*/
|
||||
createSourceCode(file: File, input: OkParseResult<Options["RootNode"]>, context: LanguageContext<Options["LangOptions"]>): Options["Code"];
|
||||
}
|
||||
/**
|
||||
* Plugin-defined options for the language.
|
||||
*/
|
||||
export type LanguageOptions = Record<string, unknown>;
|
||||
/**
|
||||
* The context object that is passed to the language plugin methods.
|
||||
*/
|
||||
export interface LanguageContext<LangOptions = LanguageOptions> {
|
||||
languageOptions: LangOptions;
|
||||
}
|
||||
/**
|
||||
* Represents a file read by ESLint.
|
||||
*/
|
||||
export interface File {
|
||||
/**
|
||||
* The path that ESLint uses for this file. May be a virtual path
|
||||
* if it was returned by a processor.
|
||||
*/
|
||||
path: string;
|
||||
/**
|
||||
* The path to the file on disk. This always maps directly to a file
|
||||
* regardless of whether it was returned from a processor.
|
||||
*/
|
||||
physicalPath: string;
|
||||
/**
|
||||
* Indicates if the original source contained a byte-order marker.
|
||||
* ESLint strips the BOM from the `body`, but this info is needed
|
||||
* to correctly apply autofixing.
|
||||
*/
|
||||
bom: boolean;
|
||||
/**
|
||||
* The body of the file to parse.
|
||||
*/
|
||||
body: string | Uint8Array;
|
||||
}
|
||||
/**
|
||||
* Represents the successful result of parsing a file.
|
||||
*/
|
||||
export interface OkParseResult<RootNode = unknown> {
|
||||
/**
|
||||
* Indicates if the parse was successful. If true, the parse was successful
|
||||
* and ESLint should continue on to create a SourceCode object and run rules;
|
||||
* if false, ESLint should just report the error(s) without doing anything
|
||||
* else.
|
||||
*/
|
||||
ok: true;
|
||||
/**
|
||||
* The abstract syntax tree created by the parser. (only when ok: true)
|
||||
*/
|
||||
ast: RootNode;
|
||||
/**
|
||||
* Any additional data that the parser wants to provide.
|
||||
*/
|
||||
[key: string]: any;
|
||||
}
|
||||
/**
|
||||
* Represents the unsuccessful result of parsing a file.
|
||||
*/
|
||||
export interface NotOkParseResult {
|
||||
/**
|
||||
* Indicates if the parse was successful. If true, the parse was successful
|
||||
* and ESLint should continue on to create a SourceCode object and run rules;
|
||||
* if false, ESLint should just report the error(s) without doing anything
|
||||
* else.
|
||||
*/
|
||||
ok: false;
|
||||
/**
|
||||
* Any parsing errors, whether fatal or not. (only when ok: false)
|
||||
*/
|
||||
errors: FileError[];
|
||||
/**
|
||||
* Any additional data that the parser wants to provide.
|
||||
*/
|
||||
[key: string]: any;
|
||||
}
|
||||
export type ParseResult<RootNode = unknown> = OkParseResult<RootNode> | NotOkParseResult;
|
||||
/**
|
||||
* Represents inline configuration found in the source code.
|
||||
*/
|
||||
interface InlineConfigElement {
|
||||
/**
|
||||
* The location of the inline config element.
|
||||
*/
|
||||
loc: SourceLocation;
|
||||
/**
|
||||
* The interpreted configuration from the inline config element.
|
||||
*/
|
||||
config: {
|
||||
rules: RulesConfig;
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Generic options for the `SourceCodeBase` type.
|
||||
*/
|
||||
interface SourceCodeBaseTypeOptions {
|
||||
LangOptions: LanguageOptions;
|
||||
RootNode: unknown;
|
||||
SyntaxElementWithLoc: unknown;
|
||||
ConfigNode: unknown;
|
||||
}
|
||||
/**
|
||||
* Represents the basic interface for a source code object.
|
||||
*/
|
||||
interface SourceCodeBase<Options extends SourceCodeBaseTypeOptions = {
|
||||
LangOptions: LanguageOptions;
|
||||
RootNode: unknown;
|
||||
SyntaxElementWithLoc: unknown;
|
||||
ConfigNode: unknown;
|
||||
}> {
|
||||
/**
|
||||
* Root of the AST.
|
||||
*/
|
||||
ast: Options["RootNode"];
|
||||
/**
|
||||
* The traversal path that tools should take when evaluating the AST.
|
||||
* When present, this overrides the `visitorKeys` on the language for
|
||||
* just this source code object.
|
||||
*/
|
||||
visitorKeys?: Record<string, string[]>;
|
||||
/**
|
||||
* Retrieves the equivalent of `loc` for a given node or token.
|
||||
* @param syntaxElement The node or token to get the location for.
|
||||
* @returns The location of the node or token.
|
||||
*/
|
||||
getLoc(syntaxElement: Options["SyntaxElementWithLoc"]): SourceLocation;
|
||||
/**
|
||||
* Retrieves the equivalent of `range` for a given node or token.
|
||||
* @param syntaxElement The node or token to get the range for.
|
||||
* @returns The range of the node or token.
|
||||
*/
|
||||
getRange(syntaxElement: Options["SyntaxElementWithLoc"]): SourceRange;
|
||||
/**
|
||||
* Traversal of AST.
|
||||
*/
|
||||
traverse(): Iterable<TraversalStep>;
|
||||
/**
|
||||
* Applies language options passed in from the ESLint core.
|
||||
*/
|
||||
applyLanguageOptions?(languageOptions: Options["LangOptions"]): void;
|
||||
/**
|
||||
* Return all of the inline areas where ESLint should be disabled/enabled
|
||||
* along with any problems found in evaluating the directives.
|
||||
*/
|
||||
getDisableDirectives?(): {
|
||||
directives: Directive[];
|
||||
problems: FileProblem[];
|
||||
};
|
||||
/**
|
||||
* Returns an array of all inline configuration nodes found in the
|
||||
* source code.
|
||||
*/
|
||||
getInlineConfigNodes?(): Options["ConfigNode"][];
|
||||
/**
|
||||
* Applies configuration found inside of the source code. This method is only
|
||||
* called when ESLint is running with inline configuration allowed.
|
||||
*/
|
||||
applyInlineConfig?(): {
|
||||
configs: InlineConfigElement[];
|
||||
problems: FileProblem[];
|
||||
};
|
||||
/**
|
||||
* Called by ESLint core to indicate that it has finished providing
|
||||
* information. We now add in all the missing variables and ensure that
|
||||
* state-changing methods cannot be called by rules.
|
||||
* @returns {void}
|
||||
*/
|
||||
finalize?(): void;
|
||||
}
|
||||
/**
|
||||
* Represents the source of a text file being linted.
|
||||
*/
|
||||
export interface TextSourceCode<Options extends SourceCodeBaseTypeOptions = {
|
||||
LangOptions: LanguageOptions;
|
||||
RootNode: unknown;
|
||||
SyntaxElementWithLoc: unknown;
|
||||
ConfigNode: unknown;
|
||||
}> extends SourceCodeBase<Options> {
|
||||
/**
|
||||
* The body of the file that you'd like rule developers to access.
|
||||
*/
|
||||
text: string;
|
||||
}
|
||||
/**
|
||||
* Represents the source of a binary file being linted.
|
||||
*/
|
||||
export interface BinarySourceCode<Options extends SourceCodeBaseTypeOptions = {
|
||||
LangOptions: LanguageOptions;
|
||||
RootNode: unknown;
|
||||
SyntaxElementWithLoc: unknown;
|
||||
ConfigNode: unknown;
|
||||
}> extends SourceCodeBase<Options> {
|
||||
/**
|
||||
* The body of the file that you'd like rule developers to access.
|
||||
*/
|
||||
body: Uint8Array;
|
||||
}
|
||||
export type SourceCode<Options extends SourceCodeBaseTypeOptions = {
|
||||
LangOptions: LanguageOptions;
|
||||
RootNode: unknown;
|
||||
SyntaxElementWithLoc: unknown;
|
||||
ConfigNode: unknown;
|
||||
}> = TextSourceCode<Options> | BinarySourceCode<Options>;
|
||||
/**
|
||||
* Represents a traversal step visiting the AST.
|
||||
*/
|
||||
export interface VisitTraversalStep {
|
||||
kind: 1;
|
||||
target: unknown;
|
||||
phase: 1 | 2;
|
||||
args: unknown[];
|
||||
}
|
||||
/**
|
||||
* Represents a traversal step calling a function.
|
||||
*/
|
||||
export interface CallTraversalStep {
|
||||
kind: 2;
|
||||
target: string;
|
||||
phase?: string;
|
||||
args: unknown[];
|
||||
}
|
||||
export type TraversalStep = VisitTraversalStep | CallTraversalStep;
|
||||
/**
|
||||
* The type of disable directive. This determines how ESLint will disable rules.
|
||||
*/
|
||||
export type DirectiveType = "disable" | "enable" | "disable-line" | "disable-next-line";
|
||||
/**
|
||||
* Represents a disable directive.
|
||||
*/
|
||||
export interface Directive {
|
||||
/**
|
||||
* The type of directive.
|
||||
*/
|
||||
type: DirectiveType;
|
||||
/**
|
||||
* The node of the directive. May be in the AST or a comment/token.
|
||||
*/
|
||||
node: unknown;
|
||||
/**
|
||||
* The value of the directive.
|
||||
*/
|
||||
value: string;
|
||||
/**
|
||||
* The justification for the directive.
|
||||
*/
|
||||
justification?: string;
|
||||
}
|
||||
export {};
|
735
node_modules/@eslint/core/dist/esm/types.d.ts
generated
vendored
Normal file
735
node_modules/@eslint/core/dist/esm/types.d.ts
generated
vendored
Normal file
@ -0,0 +1,735 @@
|
||||
/**
|
||||
* @fileoverview Shared types for ESLint Core.
|
||||
*/
|
||||
import { JSONSchema4 } from "json-schema";
|
||||
/**
|
||||
* Represents an error inside of a file.
|
||||
*/
|
||||
export interface FileError {
|
||||
message: string;
|
||||
line: number;
|
||||
column: number;
|
||||
endLine?: number;
|
||||
endColumn?: number;
|
||||
}
|
||||
/**
|
||||
* Represents a problem found in a file.
|
||||
*/
|
||||
export interface FileProblem {
|
||||
ruleId: string | null;
|
||||
message: string;
|
||||
loc: SourceLocation;
|
||||
}
|
||||
/**
|
||||
* Represents the start and end coordinates of a node inside the source.
|
||||
*/
|
||||
export interface SourceLocation {
|
||||
start: Position;
|
||||
end: Position;
|
||||
}
|
||||
/**
|
||||
* Represents the start and end coordinates of a node inside the source with an offset.
|
||||
*/
|
||||
export interface SourceLocationWithOffset {
|
||||
start: PositionWithOffset;
|
||||
end: PositionWithOffset;
|
||||
}
|
||||
/**
|
||||
* Represents a location coordinate inside the source. ESLint-style formats
|
||||
* have just `line` and `column` while others may have `offset` as well.
|
||||
*/
|
||||
export interface Position {
|
||||
line: number;
|
||||
column: number;
|
||||
}
|
||||
/**
|
||||
* Represents a location coordinate inside the source with an offset.
|
||||
*/
|
||||
export interface PositionWithOffset extends Position {
|
||||
offset: number;
|
||||
}
|
||||
/**
|
||||
* Represents a range of characters in the source.
|
||||
*/
|
||||
export type SourceRange = [number, number];
|
||||
/**
|
||||
* What the rule is responsible for finding:
|
||||
* - `problem` means the rule has noticed a potential error.
|
||||
* - `suggestion` means the rule suggests an alternate or better approach.
|
||||
* - `layout` means the rule is looking at spacing, indentation, etc.
|
||||
*/
|
||||
export type RuleType = "problem" | "suggestion" | "layout";
|
||||
/**
|
||||
* The type of fix the rule can provide:
|
||||
* - `code` means the rule can fix syntax.
|
||||
* - `whitespace` means the rule can fix spacing and indentation.
|
||||
*/
|
||||
export type RuleFixType = "code" | "whitespace";
|
||||
/**
|
||||
* An object containing visitor information for a rule. Each method is either the
|
||||
* name of a node type or a selector, or is a method that will be called at specific
|
||||
* times during the traversal.
|
||||
*/
|
||||
export interface RuleVisitor {
|
||||
/**
|
||||
* Called for each node in the AST or at specific times during the traversal.
|
||||
*/
|
||||
[key: string]: (...args: any[]) => void;
|
||||
}
|
||||
/**
|
||||
* Rule meta information used for documentation.
|
||||
*/
|
||||
export interface RulesMetaDocs {
|
||||
/**
|
||||
* A short description of the rule.
|
||||
*/
|
||||
description?: string | undefined;
|
||||
/**
|
||||
* The URL to the documentation for the rule.
|
||||
*/
|
||||
url?: string | undefined;
|
||||
/**
|
||||
* The category the rule falls under.
|
||||
* @deprecated No longer used.
|
||||
*/
|
||||
category?: string | undefined;
|
||||
/**
|
||||
* Indicates if the rule is generally recommended for all users.
|
||||
*/
|
||||
recommended?: boolean | undefined;
|
||||
}
|
||||
/**
|
||||
* Meta information about a rule.
|
||||
*/
|
||||
export interface RulesMeta<MessageIds extends string = string, ExtRuleDocs = unknown> {
|
||||
/**
|
||||
* Properties that are used when documenting the rule.
|
||||
*/
|
||||
docs?: (RulesMetaDocs & ExtRuleDocs) | undefined;
|
||||
/**
|
||||
* The type of rule.
|
||||
*/
|
||||
type?: RuleType | undefined;
|
||||
/**
|
||||
* The schema for the rule options. Required if the rule has options.
|
||||
*/
|
||||
schema?: JSONSchema4 | JSONSchema4[] | false | undefined;
|
||||
/**
|
||||
* The messages that the rule can report.
|
||||
*/
|
||||
messages?: Record<MessageIds, string>;
|
||||
/**
|
||||
* The deprecated rules for the rule.
|
||||
*/
|
||||
deprecated?: boolean | undefined;
|
||||
/**
|
||||
* When a rule is deprecated, indicates the rule ID(s) that should be used instead.
|
||||
*/
|
||||
replacedBy?: string[] | undefined;
|
||||
/**
|
||||
* Indicates if the rule is fixable, and if so, what type of fix it provides.
|
||||
*/
|
||||
fixable?: RuleFixType | undefined;
|
||||
/**
|
||||
* Indicates if the rule may provide suggestions.
|
||||
*/
|
||||
hasSuggestions?: boolean | undefined;
|
||||
}
|
||||
/**
|
||||
* Generic type for `RuleContext`.
|
||||
*/
|
||||
export interface RuleContextTypeOptions {
|
||||
LangOptions: LanguageOptions;
|
||||
Code: SourceCode;
|
||||
RuleOptions: unknown[];
|
||||
Node: unknown;
|
||||
}
|
||||
/**
|
||||
* Represents the context object that is passed to a rule. This object contains
|
||||
* information about the current state of the linting process and is the rule's
|
||||
* view into the outside world.
|
||||
*/
|
||||
export interface RuleContext<Options extends RuleContextTypeOptions = {
|
||||
LangOptions: LanguageOptions;
|
||||
Code: SourceCode;
|
||||
RuleOptions: unknown[];
|
||||
Node: unknown;
|
||||
}> {
|
||||
/**
|
||||
* The current working directory for the session.
|
||||
*/
|
||||
cwd: string;
|
||||
/**
|
||||
* Returns the current working directory for the session.
|
||||
* @deprecated Use `cwd` instead.
|
||||
*/
|
||||
getCwd(): string;
|
||||
/**
|
||||
* The filename of the file being linted.
|
||||
*/
|
||||
filename: string;
|
||||
/**
|
||||
* Returns the filename of the file being linted.
|
||||
* @deprecated Use `filename` instead.
|
||||
*/
|
||||
getFilename(): string;
|
||||
/**
|
||||
* The physical filename of the file being linted.
|
||||
*/
|
||||
physicalFilename: string;
|
||||
/**
|
||||
* Returns the physical filename of the file being linted.
|
||||
* @deprecated Use `physicalFilename` instead.
|
||||
*/
|
||||
getPhysicalFilename(): string;
|
||||
/**
|
||||
* The source code object that the rule is running on.
|
||||
*/
|
||||
sourceCode: Options["Code"];
|
||||
/**
|
||||
* Returns the source code object that the rule is running on.
|
||||
* @deprecated Use `sourceCode` instead.
|
||||
*/
|
||||
getSourceCode(): Options["Code"];
|
||||
/**
|
||||
* Shared settings for the configuration.
|
||||
*/
|
||||
settings: SettingsConfig;
|
||||
/**
|
||||
* Parser-specific options for the configuration.
|
||||
* @deprecated Use `languageOptions.parserOptions` instead.
|
||||
*/
|
||||
parserOptions: Record<string, unknown>;
|
||||
/**
|
||||
* The language options for the configuration.
|
||||
*/
|
||||
languageOptions: Options["LangOptions"];
|
||||
/**
|
||||
* The CommonJS path to the parser used while parsing this file.
|
||||
* @deprecated No longer used.
|
||||
*/
|
||||
parserPath: string | undefined;
|
||||
/**
|
||||
* The rule ID.
|
||||
*/
|
||||
id: string;
|
||||
/**
|
||||
* The rule's configured options.
|
||||
*/
|
||||
options: Options["RuleOptions"];
|
||||
/**
|
||||
* The report function that the rule should use to report problems.
|
||||
* @param violation The violation to report.
|
||||
*/
|
||||
report(violation: ViolationReport<Options["Node"]>): void;
|
||||
}
|
||||
/**
|
||||
* Manager of text edits for a rule fix.
|
||||
*/
|
||||
export interface RuleTextEditor<EditableSyntaxElement = unknown> {
|
||||
/**
|
||||
* Inserts text after the specified node or token.
|
||||
* @param syntaxElement The node or token to insert after.
|
||||
* @param text The edit to insert after the node or token.
|
||||
*/
|
||||
insertTextAfter(syntaxElement: EditableSyntaxElement, text: string): RuleTextEdit;
|
||||
/**
|
||||
* Inserts text after the specified range.
|
||||
* @param range The range to insert after.
|
||||
* @param text The edit to insert after the range.
|
||||
*/
|
||||
insertTextAfterRange(range: SourceRange, text: string): RuleTextEdit;
|
||||
/**
|
||||
* Inserts text before the specified node or token.
|
||||
* @param syntaxElement A syntax element with location information to insert before.
|
||||
* @param text The edit to insert before the node or token.
|
||||
*/
|
||||
insertTextBefore(syntaxElement: EditableSyntaxElement, text: string): RuleTextEdit;
|
||||
/**
|
||||
* Inserts text before the specified range.
|
||||
* @param range The range to insert before.
|
||||
* @param text The edit to insert before the range.
|
||||
*/
|
||||
insertTextBeforeRange(range: SourceRange, text: string): RuleTextEdit;
|
||||
/**
|
||||
* Removes the specified node or token.
|
||||
* @param syntaxElement A syntax element with location information to remove.
|
||||
* @returns The edit to remove the node or token.
|
||||
*/
|
||||
remove(syntaxElement: EditableSyntaxElement): RuleTextEdit;
|
||||
/**
|
||||
* Removes the specified range.
|
||||
* @param range The range to remove.
|
||||
* @returns The edit to remove the range.
|
||||
*/
|
||||
removeRange(range: SourceRange): RuleTextEdit;
|
||||
/**
|
||||
* Replaces the specified node or token with the given text.
|
||||
* @param syntaxElement A syntax element with location information to replace.
|
||||
* @param text The text to replace the node or token with.
|
||||
* @returns The edit to replace the node or token.
|
||||
*/
|
||||
replaceText(syntaxElement: EditableSyntaxElement, text: string): RuleTextEdit;
|
||||
/**
|
||||
* Replaces the specified range with the given text.
|
||||
* @param range The range to replace.
|
||||
* @param text The text to replace the range with.
|
||||
* @returns The edit to replace the range.
|
||||
*/
|
||||
replaceTextRange(range: SourceRange, text: string): RuleTextEdit;
|
||||
}
|
||||
/**
|
||||
* Represents a fix for a rule violation implemented as a text edit.
|
||||
*/
|
||||
export interface RuleTextEdit {
|
||||
/**
|
||||
* The range to replace.
|
||||
*/
|
||||
range: SourceRange;
|
||||
/**
|
||||
* The text to insert.
|
||||
*/
|
||||
text: string;
|
||||
}
|
||||
interface ViolationReportBase {
|
||||
/**
|
||||
* The type of node that the violation is for.
|
||||
* @deprecated May be removed in the future.
|
||||
*/
|
||||
nodeType?: string | undefined;
|
||||
/**
|
||||
* The data to insert into the message.
|
||||
*/
|
||||
data?: Record<string, string> | undefined;
|
||||
/**
|
||||
* The fix to be applied for the violation.
|
||||
* @param fixer The text editor to apply the fix.
|
||||
* @returns The fix(es) for the violation.
|
||||
*/
|
||||
fix?(fixer: RuleTextEditor): RuleTextEdit | Iterable<RuleTextEdit> | null;
|
||||
/**
|
||||
* An array of suggested fixes for the problem. These fixes may change the
|
||||
* behavior of the code, so they are not applied automatically.
|
||||
*/
|
||||
suggest?: SuggestedEdit[];
|
||||
}
|
||||
type ViolationMessage = {
|
||||
message: string;
|
||||
} | {
|
||||
messageId: string;
|
||||
};
|
||||
type ViolationLocation<Node> = {
|
||||
loc: SourceLocation;
|
||||
} | {
|
||||
node: Node;
|
||||
};
|
||||
export type ViolationReport<Node = unknown> = ViolationReportBase & ViolationMessage & ViolationLocation<Node>;
|
||||
interface SuggestedEditBase {
|
||||
/**
|
||||
* The data to insert into the message.
|
||||
*/
|
||||
data?: Record<string, string> | undefined;
|
||||
/**
|
||||
* The fix to be applied for the suggestion.
|
||||
* @param fixer The text editor to apply the fix.
|
||||
* @returns The fix for the suggestion.
|
||||
*/
|
||||
fix?(fixer: RuleTextEditor): RuleTextEdit | Iterable<RuleTextEdit> | null;
|
||||
}
|
||||
type SuggestionMessage = {
|
||||
desc: string;
|
||||
} | {
|
||||
messageId: string;
|
||||
};
|
||||
/**
|
||||
* A suggested edit for a rule violation.
|
||||
*/
|
||||
export type SuggestedEdit = SuggestedEditBase & SuggestionMessage;
|
||||
/**
|
||||
* Generic options for the `RuleDefinition` type.
|
||||
*/
|
||||
export interface RuleDefinitionTypeOptions {
|
||||
LangOptions: LanguageOptions;
|
||||
Code: SourceCode;
|
||||
RuleOptions: unknown[];
|
||||
Visitor: RuleVisitor;
|
||||
Node: unknown;
|
||||
MessageIds: string;
|
||||
ExtRuleDocs: unknown;
|
||||
}
|
||||
/**
|
||||
* The definition of an ESLint rule.
|
||||
*/
|
||||
export interface RuleDefinition<Options extends RuleDefinitionTypeOptions> {
|
||||
/**
|
||||
* The meta information for the rule.
|
||||
*/
|
||||
meta?: RulesMeta<Options["MessageIds"], Options["ExtRuleDocs"]>;
|
||||
/**
|
||||
* Creates the visitor that ESLint uses to apply the rule during traversal.
|
||||
* @param context The rule context.
|
||||
* @returns The rule visitor.
|
||||
*/
|
||||
create(context: RuleContext<{
|
||||
LangOptions: Options["LangOptions"];
|
||||
Code: Options["Code"];
|
||||
RuleOptions: Options["RuleOptions"];
|
||||
Node: Options["Node"];
|
||||
}>): Options["Visitor"];
|
||||
}
|
||||
/**
|
||||
* The human readable severity level used in a configuration.
|
||||
*/
|
||||
export type SeverityName = "off" | "warn" | "error";
|
||||
/**
|
||||
* The numeric severity level for a rule.
|
||||
*
|
||||
* - `0` means off.
|
||||
* - `1` means warn.
|
||||
* - `2` means error.
|
||||
*/
|
||||
export type SeverityLevel = 0 | 1 | 2;
|
||||
/**
|
||||
* The severity of a rule in a configuration.
|
||||
*/
|
||||
export type Severity = SeverityName | SeverityLevel;
|
||||
/**
|
||||
* Represents the configuration options for the core linter.
|
||||
*/
|
||||
export interface LinterOptionsConfig {
|
||||
/**
|
||||
* Indicates whether or not inline configuration is evaluated.
|
||||
*/
|
||||
noInlineConfig?: boolean;
|
||||
/**
|
||||
* Indicates what to do when an unused disable directive is found.
|
||||
*/
|
||||
reportUnusedDisableDirectives?: boolean | Severity;
|
||||
}
|
||||
/**
|
||||
* Shared settings that are accessible from within plugins.
|
||||
*/
|
||||
export type SettingsConfig = Record<string, unknown>;
|
||||
/**
|
||||
* The configuration for a rule.
|
||||
*/
|
||||
export type RuleConfig = Severity | [Severity, ...unknown[]];
|
||||
/**
|
||||
* A collection of rules and their configurations.
|
||||
*/
|
||||
export type RulesConfig = Record<string, RuleConfig>;
|
||||
/**
|
||||
* Generic options for the `Language` type.
|
||||
*/
|
||||
export interface LanguageTypeOptions {
|
||||
LangOptions: LanguageOptions;
|
||||
Code: SourceCode;
|
||||
RootNode: unknown;
|
||||
Node: unknown;
|
||||
}
|
||||
/**
|
||||
* Represents a plugin language.
|
||||
*/
|
||||
export interface Language<Options extends LanguageTypeOptions = {
|
||||
LangOptions: LanguageOptions;
|
||||
Code: SourceCode;
|
||||
RootNode: unknown;
|
||||
Node: unknown;
|
||||
}> {
|
||||
/**
|
||||
* Indicates how ESLint should read the file.
|
||||
*/
|
||||
fileType: "text";
|
||||
/**
|
||||
* First line number returned from the parser (text mode only).
|
||||
*/
|
||||
lineStart: 0 | 1;
|
||||
/**
|
||||
* First column number returned from the parser (text mode only).
|
||||
*/
|
||||
columnStart: 0 | 1;
|
||||
/**
|
||||
* The property to read the node type from. Used in selector querying.
|
||||
*/
|
||||
nodeTypeKey: string;
|
||||
/**
|
||||
* The traversal path that tools should take when evaluating the AST
|
||||
*/
|
||||
visitorKeys?: Record<string, string[]>;
|
||||
/**
|
||||
* Default language options. User-defined options are merged with this object.
|
||||
*/
|
||||
defaultLanguageOptions?: LanguageOptions;
|
||||
/**
|
||||
* Validates languageOptions for this language.
|
||||
*/
|
||||
validateLanguageOptions(languageOptions: Options["LangOptions"]): void;
|
||||
/**
|
||||
* Normalizes languageOptions for this language.
|
||||
*/
|
||||
normalizeLanguageOptions?(languageOptions: Options["LangOptions"]): Options["LangOptions"];
|
||||
/**
|
||||
* Helper for esquery that allows languages to match nodes against
|
||||
* class. esquery currently has classes like `function` that will
|
||||
* match all the various function nodes. This method allows languages
|
||||
* to implement similar shorthands.
|
||||
*/
|
||||
matchesSelectorClass?(className: string, node: Options["Node"], ancestry: Options["Node"][]): boolean;
|
||||
/**
|
||||
* Parses the given file input into its component parts. This file should not
|
||||
* throws errors for parsing errors but rather should return any parsing
|
||||
* errors as parse of the ParseResult object.
|
||||
*/
|
||||
parse(file: File, context: LanguageContext<Options["LangOptions"]>): ParseResult<Options["RootNode"]>;
|
||||
/**
|
||||
* Creates SourceCode object that ESLint uses to work with a file.
|
||||
*/
|
||||
createSourceCode(file: File, input: OkParseResult<Options["RootNode"]>, context: LanguageContext<Options["LangOptions"]>): Options["Code"];
|
||||
}
|
||||
/**
|
||||
* Plugin-defined options for the language.
|
||||
*/
|
||||
export type LanguageOptions = Record<string, unknown>;
|
||||
/**
|
||||
* The context object that is passed to the language plugin methods.
|
||||
*/
|
||||
export interface LanguageContext<LangOptions = LanguageOptions> {
|
||||
languageOptions: LangOptions;
|
||||
}
|
||||
/**
|
||||
* Represents a file read by ESLint.
|
||||
*/
|
||||
export interface File {
|
||||
/**
|
||||
* The path that ESLint uses for this file. May be a virtual path
|
||||
* if it was returned by a processor.
|
||||
*/
|
||||
path: string;
|
||||
/**
|
||||
* The path to the file on disk. This always maps directly to a file
|
||||
* regardless of whether it was returned from a processor.
|
||||
*/
|
||||
physicalPath: string;
|
||||
/**
|
||||
* Indicates if the original source contained a byte-order marker.
|
||||
* ESLint strips the BOM from the `body`, but this info is needed
|
||||
* to correctly apply autofixing.
|
||||
*/
|
||||
bom: boolean;
|
||||
/**
|
||||
* The body of the file to parse.
|
||||
*/
|
||||
body: string | Uint8Array;
|
||||
}
|
||||
/**
|
||||
* Represents the successful result of parsing a file.
|
||||
*/
|
||||
export interface OkParseResult<RootNode = unknown> {
|
||||
/**
|
||||
* Indicates if the parse was successful. If true, the parse was successful
|
||||
* and ESLint should continue on to create a SourceCode object and run rules;
|
||||
* if false, ESLint should just report the error(s) without doing anything
|
||||
* else.
|
||||
*/
|
||||
ok: true;
|
||||
/**
|
||||
* The abstract syntax tree created by the parser. (only when ok: true)
|
||||
*/
|
||||
ast: RootNode;
|
||||
/**
|
||||
* Any additional data that the parser wants to provide.
|
||||
*/
|
||||
[key: string]: any;
|
||||
}
|
||||
/**
|
||||
* Represents the unsuccessful result of parsing a file.
|
||||
*/
|
||||
export interface NotOkParseResult {
|
||||
/**
|
||||
* Indicates if the parse was successful. If true, the parse was successful
|
||||
* and ESLint should continue on to create a SourceCode object and run rules;
|
||||
* if false, ESLint should just report the error(s) without doing anything
|
||||
* else.
|
||||
*/
|
||||
ok: false;
|
||||
/**
|
||||
* Any parsing errors, whether fatal or not. (only when ok: false)
|
||||
*/
|
||||
errors: FileError[];
|
||||
/**
|
||||
* Any additional data that the parser wants to provide.
|
||||
*/
|
||||
[key: string]: any;
|
||||
}
|
||||
export type ParseResult<RootNode = unknown> = OkParseResult<RootNode> | NotOkParseResult;
|
||||
/**
|
||||
* Represents inline configuration found in the source code.
|
||||
*/
|
||||
interface InlineConfigElement {
|
||||
/**
|
||||
* The location of the inline config element.
|
||||
*/
|
||||
loc: SourceLocation;
|
||||
/**
|
||||
* The interpreted configuration from the inline config element.
|
||||
*/
|
||||
config: {
|
||||
rules: RulesConfig;
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Generic options for the `SourceCodeBase` type.
|
||||
*/
|
||||
interface SourceCodeBaseTypeOptions {
|
||||
LangOptions: LanguageOptions;
|
||||
RootNode: unknown;
|
||||
SyntaxElementWithLoc: unknown;
|
||||
ConfigNode: unknown;
|
||||
}
|
||||
/**
|
||||
* Represents the basic interface for a source code object.
|
||||
*/
|
||||
interface SourceCodeBase<Options extends SourceCodeBaseTypeOptions = {
|
||||
LangOptions: LanguageOptions;
|
||||
RootNode: unknown;
|
||||
SyntaxElementWithLoc: unknown;
|
||||
ConfigNode: unknown;
|
||||
}> {
|
||||
/**
|
||||
* Root of the AST.
|
||||
*/
|
||||
ast: Options["RootNode"];
|
||||
/**
|
||||
* The traversal path that tools should take when evaluating the AST.
|
||||
* When present, this overrides the `visitorKeys` on the language for
|
||||
* just this source code object.
|
||||
*/
|
||||
visitorKeys?: Record<string, string[]>;
|
||||
/**
|
||||
* Retrieves the equivalent of `loc` for a given node or token.
|
||||
* @param syntaxElement The node or token to get the location for.
|
||||
* @returns The location of the node or token.
|
||||
*/
|
||||
getLoc(syntaxElement: Options["SyntaxElementWithLoc"]): SourceLocation;
|
||||
/**
|
||||
* Retrieves the equivalent of `range` for a given node or token.
|
||||
* @param syntaxElement The node or token to get the range for.
|
||||
* @returns The range of the node or token.
|
||||
*/
|
||||
getRange(syntaxElement: Options["SyntaxElementWithLoc"]): SourceRange;
|
||||
/**
|
||||
* Traversal of AST.
|
||||
*/
|
||||
traverse(): Iterable<TraversalStep>;
|
||||
/**
|
||||
* Applies language options passed in from the ESLint core.
|
||||
*/
|
||||
applyLanguageOptions?(languageOptions: Options["LangOptions"]): void;
|
||||
/**
|
||||
* Return all of the inline areas where ESLint should be disabled/enabled
|
||||
* along with any problems found in evaluating the directives.
|
||||
*/
|
||||
getDisableDirectives?(): {
|
||||
directives: Directive[];
|
||||
problems: FileProblem[];
|
||||
};
|
||||
/**
|
||||
* Returns an array of all inline configuration nodes found in the
|
||||
* source code.
|
||||
*/
|
||||
getInlineConfigNodes?(): Options["ConfigNode"][];
|
||||
/**
|
||||
* Applies configuration found inside of the source code. This method is only
|
||||
* called when ESLint is running with inline configuration allowed.
|
||||
*/
|
||||
applyInlineConfig?(): {
|
||||
configs: InlineConfigElement[];
|
||||
problems: FileProblem[];
|
||||
};
|
||||
/**
|
||||
* Called by ESLint core to indicate that it has finished providing
|
||||
* information. We now add in all the missing variables and ensure that
|
||||
* state-changing methods cannot be called by rules.
|
||||
* @returns {void}
|
||||
*/
|
||||
finalize?(): void;
|
||||
}
|
||||
/**
|
||||
* Represents the source of a text file being linted.
|
||||
*/
|
||||
export interface TextSourceCode<Options extends SourceCodeBaseTypeOptions = {
|
||||
LangOptions: LanguageOptions;
|
||||
RootNode: unknown;
|
||||
SyntaxElementWithLoc: unknown;
|
||||
ConfigNode: unknown;
|
||||
}> extends SourceCodeBase<Options> {
|
||||
/**
|
||||
* The body of the file that you'd like rule developers to access.
|
||||
*/
|
||||
text: string;
|
||||
}
|
||||
/**
|
||||
* Represents the source of a binary file being linted.
|
||||
*/
|
||||
export interface BinarySourceCode<Options extends SourceCodeBaseTypeOptions = {
|
||||
LangOptions: LanguageOptions;
|
||||
RootNode: unknown;
|
||||
SyntaxElementWithLoc: unknown;
|
||||
ConfigNode: unknown;
|
||||
}> extends SourceCodeBase<Options> {
|
||||
/**
|
||||
* The body of the file that you'd like rule developers to access.
|
||||
*/
|
||||
body: Uint8Array;
|
||||
}
|
||||
export type SourceCode<Options extends SourceCodeBaseTypeOptions = {
|
||||
LangOptions: LanguageOptions;
|
||||
RootNode: unknown;
|
||||
SyntaxElementWithLoc: unknown;
|
||||
ConfigNode: unknown;
|
||||
}> = TextSourceCode<Options> | BinarySourceCode<Options>;
|
||||
/**
|
||||
* Represents a traversal step visiting the AST.
|
||||
*/
|
||||
export interface VisitTraversalStep {
|
||||
kind: 1;
|
||||
target: unknown;
|
||||
phase: 1 | 2;
|
||||
args: unknown[];
|
||||
}
|
||||
/**
|
||||
* Represents a traversal step calling a function.
|
||||
*/
|
||||
export interface CallTraversalStep {
|
||||
kind: 2;
|
||||
target: string;
|
||||
phase?: string;
|
||||
args: unknown[];
|
||||
}
|
||||
export type TraversalStep = VisitTraversalStep | CallTraversalStep;
|
||||
/**
|
||||
* The type of disable directive. This determines how ESLint will disable rules.
|
||||
*/
|
||||
export type DirectiveType = "disable" | "enable" | "disable-line" | "disable-next-line";
|
||||
/**
|
||||
* Represents a disable directive.
|
||||
*/
|
||||
export interface Directive {
|
||||
/**
|
||||
* The type of directive.
|
||||
*/
|
||||
type: DirectiveType;
|
||||
/**
|
||||
* The node of the directive. May be in the AST or a comment/token.
|
||||
*/
|
||||
node: unknown;
|
||||
/**
|
||||
* The value of the directive.
|
||||
*/
|
||||
value: string;
|
||||
/**
|
||||
* The justification for the directive.
|
||||
*/
|
||||
justification?: string;
|
||||
}
|
||||
export {};
|
45
node_modules/@eslint/core/package.json
generated
vendored
Normal file
45
node_modules/@eslint/core/package.json
generated
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
{
|
||||
"name": "@eslint/core",
|
||||
"version": "0.9.0",
|
||||
"description": "Runtime-agnostic core of ESLint",
|
||||
"type": "module",
|
||||
"types": "./dist/esm/types.d.ts",
|
||||
"exports": {
|
||||
"types": {
|
||||
"import": "./dist/esm/types.d.ts",
|
||||
"require": "./dist/cjs/types.d.cts"
|
||||
}
|
||||
},
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"scripts": {
|
||||
"build:cts": "node -e \"fs.cpSync('dist/esm/types.d.ts', 'dist/cjs/types.d.cts')\"",
|
||||
"build": "tsc && npm run build:cts",
|
||||
"test:jsr": "npx jsr@latest publish --dry-run"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/eslint/rewrite.git"
|
||||
},
|
||||
"keywords": [
|
||||
"eslint",
|
||||
"core"
|
||||
],
|
||||
"author": "Nicholas C. Zakas",
|
||||
"license": "Apache-2.0",
|
||||
"bugs": {
|
||||
"url": "https://github.com/eslint/rewrite/issues"
|
||||
},
|
||||
"homepage": "https://github.com/eslint/rewrite#readme",
|
||||
"devDependencies": {
|
||||
"json-schema": "^0.4.0",
|
||||
"typescript": "^5.4.5"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^18.18.0 || ^20.9.0 || >=21.1.0"
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user