+++ /dev/null
-import { TSESTree, ParserServices } from '../ts-estree';\r
-import { ParserOptions as TSParserOptions } from './ParserOptions';\r
-import { RuleCreateFunction, RuleFix, RuleModule } from './Rule';\r
-import { Scope } from './Scope';\r
-import { SourceCode } from './SourceCode';\r
-declare class LinterBase {\r
- /**\r
- * Initialize the Linter.\r
- * @param config the config object\r
- */\r
- constructor(config?: Linter.LinterOptions);\r
- /**\r
- * Define a new parser module\r
- * @param parserId Name of the parser\r
- * @param parserModule The parser object\r
- */\r
- defineParser(parserId: string, parserModule: Linter.ParserModule): void;\r
- /**\r
- * Defines a new linting rule.\r
- * @param ruleId A unique rule identifier\r
- * @param ruleModule Function from context to object mapping AST node types to event handlers\r
- */\r
- defineRule<TMessageIds extends string, TOptions extends readonly unknown[]>(ruleId: string, ruleModule: RuleModule<TMessageIds, TOptions> | RuleCreateFunction): void;\r
- /**\r
- * Defines many new linting rules.\r
- * @param rulesToDefine map from unique rule identifier to rule\r
- */\r
- defineRules<TMessageIds extends string, TOptions extends readonly unknown[]>(rulesToDefine: Record<string, RuleModule<TMessageIds, TOptions> | RuleCreateFunction>): void;\r
- /**\r
- * Gets an object with all loaded rules.\r
- * @returns All loaded rules\r
- */\r
- getRules(): Map<string, RuleModule<string, unknown[]>>;\r
- /**\r
- * Gets the `SourceCode` object representing the parsed source.\r
- * @returns The `SourceCode` object.\r
- */\r
- getSourceCode(): SourceCode;\r
- /**\r
- * Verifies the text against the rules specified by the second argument.\r
- * @param textOrSourceCode The text to parse or a SourceCode object.\r
- * @param config An ESLintConfig instance to configure everything.\r
- * @param filenameOrOptions The optional filename of the file being checked.\r
- * If this is not set, the filename will default to '<input>' in the rule context.\r
- * If this is an object, then it has "filename", "allowInlineConfig", and some properties.\r
- * @returns The results as an array of messages or an empty array if no messages.\r
- */\r
- verify(textOrSourceCode: SourceCode | string, config: Linter.Config, filenameOrOptions?: string | Linter.VerifyOptions): Linter.LintMessage[];\r
- /**\r
- * Performs multiple autofix passes over the text until as many fixes as possible have been applied.\r
- * @param text The source text to apply fixes to.\r
- * @param config The ESLint config object to use.\r
- * @param options The ESLint options object to use.\r
- * @returns The result of the fix operation as returned from the SourceCodeFixer.\r
- */\r
- verifyAndFix(code: string, config: Linter.Config, options: Linter.FixOptions): Linter.FixReport;\r
- /**\r
- * The version from package.json.\r
- */\r
- readonly version: string;\r
- /**\r
- * The version from package.json.\r
- */\r
- static readonly version: string;\r
-}\r
-declare namespace Linter {\r
- export interface LinterOptions {\r
- /**\r
- * path to a directory that should be considered as the current working directory.\r
- */\r
- cwd?: string;\r
- }\r
- export type Severity = 0 | 1 | 2;\r
- export type SeverityString = 'off' | 'warn' | 'error';\r
- export type RuleLevel = Severity | SeverityString;\r
- export type RuleLevelAndOptions = [\r
- RuleLevel,\r
- ...unknown[]\r
- ];\r
- export type RuleEntry = RuleLevel | RuleLevelAndOptions;\r
- export type RulesRecord = Partial<Record<string, RuleEntry>>;\r
- interface BaseConfig {\r
- $schema?: string;\r
- /**\r
- * The environment settings.\r
- */\r
- env?: {\r
- [name: string]: boolean;\r
- };\r
- /**\r
- * The path to other config files or the package name of shareable configs.\r
- */\r
- extends?: string | string[];\r
- /**\r
- * The global variable settings.\r
- */\r
- globals?: {\r
- [name: string]: boolean;\r
- };\r
- /**\r
- * The flag that disables directive comments.\r
- */\r
- noInlineConfig?: boolean;\r
- /**\r
- * The override settings per kind of files.\r
- */\r
- overrides?: ConfigOverride[];\r
- /**\r
- * The path to a parser or the package name of a parser.\r
- */\r
- parser?: string;\r
- /**\r
- * The parser options.\r
- */\r
- parserOptions?: ParserOptions;\r
- /**\r
- * The plugin specifiers.\r
- */\r
- plugins?: string[];\r
- /**\r
- * The processor specifier.\r
- */\r
- processor?: string;\r
- /**\r
- * The flag to report unused `eslint-disable` comments.\r
- */\r
- reportUnusedDisableDirectives?: boolean;\r
- /**\r
- * The rule settings.\r
- */\r
- rules?: RulesRecord;\r
- /**\r
- * The shared settings.\r
- */\r
- settings?: {\r
- [name: string]: unknown;\r
- };\r
- }\r
- export interface ConfigOverride extends BaseConfig {\r
- excludedFiles?: string | string[];\r
- files: string | string[];\r
- }\r
- export interface Config extends BaseConfig {\r
- /**\r
- * The glob patterns that ignore to lint.\r
- */\r
- ignorePatterns?: string | string[];\r
- /**\r
- * The root flag.\r
- */\r
- root?: boolean;\r
- }\r
- export type ParserOptions = TSParserOptions;\r
- export interface VerifyOptions {\r
- /**\r
- * Allow/disallow inline comments' ability to change config once it is set. Defaults to true if not supplied.\r
- * Useful if you want to validate JS without comments overriding rules.\r
- */\r
- allowInlineConfig?: boolean;\r
- /**\r
- * if `true` then the linter doesn't make `fix` properties into the lint result.\r
- */\r
- disableFixes?: boolean;\r
- /**\r
- * the filename of the source code.\r
- */\r
- filename?: string;\r
- /**\r
- * the predicate function that selects adopt code blocks.\r
- */\r
- filterCodeBlock?: (filename: string, text: string) => boolean;\r
- /**\r
- * postprocessor for report messages.\r
- * If provided, this should accept an array of the message lists\r
- * for each code block returned from the preprocessor, apply a mapping to\r
- * the messages as appropriate, and return a one-dimensional array of\r
- * messages.\r
- */\r
- postprocess?: Processor['postprocess'];\r
- /**\r
- * preprocessor for source text.\r
- * If provided, this should accept a string of source text, and return an array of code blocks to lint.\r
- */\r
- preprocess?: Processor['preprocess'];\r
- /**\r
- * Adds reported errors for unused `eslint-disable` directives.\r
- */\r
- reportUnusedDisableDirectives?: boolean | SeverityString;\r
- }\r
- export interface FixOptions extends VerifyOptions {\r
- /**\r
- * Determines whether fixes should be applied.\r
- */\r
- fix?: boolean;\r
- }\r
- export interface LintSuggestion {\r
- desc: string;\r
- fix: RuleFix;\r
- messageId?: string;\r
- }\r
- export interface LintMessage {\r
- /**\r
- * The 1-based column number.\r
- */\r
- column: number;\r
- /**\r
- * The 1-based column number of the end location.\r
- */\r
- endColumn?: number;\r
- /**\r
- * The 1-based line number of the end location.\r
- */\r
- endLine?: number;\r
- /**\r
- * If `true` then this is a fatal error.\r
- */\r
- fatal?: true;\r
- /**\r
- * Information for autofix.\r
- */\r
- fix?: RuleFix;\r
- /**\r
- * The 1-based line number.\r
- */\r
- line: number;\r
- /**\r
- * The error message.\r
- */\r
- message: string;\r
- messageId?: string;\r
- nodeType: string;\r
- /**\r
- * The ID of the rule which makes this message.\r
- */\r
- ruleId: string | null;\r
- /**\r
- * The severity of this message.\r
- */\r
- severity: Severity;\r
- source: string | null;\r
- /**\r
- * Information for suggestions\r
- */\r
- suggestions?: LintSuggestion[];\r
- }\r
- export interface FixReport {\r
- /**\r
- * True, if the code was fixed\r
- */\r
- fixed: boolean;\r
- /**\r
- * Fixed code text (might be the same as input if no fixes were applied).\r
- */\r
- output: string;\r
- /**\r
- * Collection of all messages for the given code\r
- */\r
- messages: LintMessage[];\r
- }\r
- export type ParserModule = {\r
- parse(text: string, options?: ParserOptions): TSESTree.Program;\r
- } | {\r
- parseForESLint(text: string, options?: ParserOptions): ESLintParseResult;\r
- };\r
- export interface ESLintParseResult {\r
- ast: TSESTree.Program;\r
- parserServices?: ParserServices;\r
- scopeManager?: Scope.ScopeManager;\r
- visitorKeys?: SourceCode.VisitorKeys;\r
- }\r
- export interface Processor {\r
- /**\r
- * The function to extract code blocks.\r
- */\r
- preprocess?: (text: string, filename: string) => Array<string | {\r
- text: string;\r
- filename: string;\r
- }>;\r
- /**\r
- * The function to merge messages.\r
- */\r
- postprocess?: (messagesList: Linter.LintMessage[][], filename: string) => Linter.LintMessage[];\r
- /**\r
- * If `true` then it means the processor supports autofix.\r
- */\r
- supportsAutofix?: boolean;\r
- }\r
- export interface Environment {\r
- /**\r
- * The definition of global variables.\r
- */\r
- globals?: Record<string, Linter.Config>;\r
- /**\r
- * The parser options that will be enabled under this environment.\r
- */\r
- parserOptions?: ParserOptions;\r
- }\r
- export interface Plugin {\r
- /**\r
- * The definition of plugin configs.\r
- */\r
- configs?: Record<string, Linter.Config>;\r
- /**\r
- * The definition of plugin environments.\r
- */\r
- environments?: Record<string, Environment>;\r
- /**\r
- * The definition of plugin processors.\r
- */\r
- processors?: Record<string, Processor>;\r
- /**\r
- * The definition of plugin rules.\r
- */\r
- rules?: Record<string, RuleCreateFunction | RuleModule<string, unknown[]>>;\r
- }\r
- export {};\r
-}\r
-declare const Linter_base: typeof LinterBase;\r
-/**\r
- * The Linter object does the actual evaluation of the JavaScript code. It doesn't do any filesystem operations, it\r
- * simply parses and reports on the code. In particular, the Linter object does not process configuration objects\r
- * or files.\r
- */\r
-declare class Linter extends Linter_base {\r
-}\r
-export { Linter };\r
-//# sourceMappingURL=Linter.d.ts.map\r