1 import { Linter } from './Linter';
\r
2 import { RuleListener, RuleMetaData, RuleModule } from './Rule';
\r
3 declare class CLIEngineBase {
\r
5 * Creates a new instance of the core CLI engine.
\r
6 * @param providedOptions The options for this instance.
\r
8 constructor(options: CLIEngine.Options);
\r
10 * Add a plugin by passing its configuration
\r
11 * @param name Name of the plugin.
\r
12 * @param pluginObject Plugin configuration object.
\r
14 addPlugin(name: string, pluginObject: Linter.Plugin): void;
\r
16 * Executes the current configuration on an array of file and directory names.
\r
17 * @param patterns An array of file and directory names.
\r
18 * @returns The results for all files that were linted.
\r
20 executeOnFiles(patterns: string[]): CLIEngine.LintReport;
\r
22 * Executes the current configuration on text.
\r
23 * @param text A string of JavaScript code to lint.
\r
24 * @param filename An optional string representing the texts filename.
\r
25 * @param warnIgnored Always warn when a file is ignored
\r
26 * @returns The results for the linting.
\r
28 executeOnText(text: string, filename?: string, warnIgnored?: boolean): CLIEngine.LintReport;
\r
30 * Returns a configuration object for the given file based on the CLI options.
\r
31 * This is the same logic used by the ESLint CLI executable to determine configuration for each file it processes.
\r
32 * @param filePath The path of the file to retrieve a config object for.
\r
33 * @returns A configuration object for the file.
\r
35 getConfigForFile(filePath: string): Linter.Config;
\r
37 * Returns the formatter representing the given format.
\r
38 * @param format The name of the format to load or the path to a custom formatter.
\r
39 * @returns The formatter function.
\r
41 getFormatter(format?: string): CLIEngine.Formatter;
\r
43 * Checks if a given path is ignored by ESLint.
\r
44 * @param filePath The path of the file to check.
\r
45 * @returns Whether or not the given path is ignored.
\r
47 isPathIgnored(filePath: string): boolean;
\r
49 * Resolves the patterns passed into `executeOnFiles()` into glob-based patterns for easier handling.
\r
50 * @param patterns The file patterns passed on the command line.
\r
51 * @returns The equivalent glob patterns.
\r
53 resolveFileGlobPatterns(patterns: string[]): string[];
\r
54 getRules<TMessageIds extends string = string, TOptions extends readonly unknown[] = unknown[], TRuleListener extends RuleListener = RuleListener>(): Map<string, RuleModule<TMessageIds, TOptions, TRuleListener>>;
\r
56 * Returns results that only contains errors.
\r
57 * @param results The results to filter.
\r
58 * @returns The filtered results.
\r
60 static getErrorResults(results: CLIEngine.LintResult[]): CLIEngine.LintResult[];
\r
62 * Returns the formatter representing the given format or null if the `format` is not a string.
\r
63 * @param format The name of the format to load or the path to a custom formatter.
\r
64 * @returns The formatter function.
\r
66 static getFormatter(format?: string): CLIEngine.Formatter;
\r
68 * Outputs fixes from the given results to files.
\r
69 * @param report The report object created by CLIEngine.
\r
71 static outputFixes(report: CLIEngine.LintReport): void;
\r
72 static version: string;
\r
74 declare namespace CLIEngine {
\r
76 allowInlineConfig?: boolean;
\r
77 baseConfig?: false | {
\r
78 [name: string]: unknown;
\r
82 cacheLocation?: string;
\r
83 configFile?: string;
\r
86 errorOnUnmatchedPattern?: boolean;
\r
87 extensions?: string[];
\r
91 ignorePath?: string;
\r
92 ignorePattern?: string | string[];
\r
93 useEslintrc?: boolean;
\r
95 parserOptions?: Linter.ParserOptions;
\r
97 resolvePluginsRelativeTo?: string;
\r
99 [name: string]: Linter.RuleLevel | Linter.RuleLevelAndOptions;
\r
101 rulePaths?: string[];
\r
102 reportUnusedDisableDirectives?: boolean;
\r
104 interface LintResult {
\r
106 messages: Linter.LintMessage[];
\r
107 errorCount: number;
\r
108 warningCount: number;
\r
109 fixableErrorCount: number;
\r
110 fixableWarningCount: number;
\r
114 interface LintReport {
\r
115 results: LintResult[];
\r
116 errorCount: number;
\r
117 warningCount: number;
\r
118 fixableErrorCount: number;
\r
119 fixableWarningCount: number;
\r
120 usedDeprecatedRules: DeprecatedRuleUse[];
\r
122 interface DeprecatedRuleUse {
\r
124 replacedBy: string[];
\r
126 interface LintResultData<TMessageIds extends string> {
\r
128 [ruleId: string]: RuleMetaData<TMessageIds>;
\r
131 type Formatter = <TMessageIds extends string>(results: LintResult[], data?: LintResultData<TMessageIds>) => string;
\r
133 declare const CLIEngine_base: typeof CLIEngineBase;
\r
135 * The underlying utility that runs the ESLint command line interface. This object will read the filesystem for
\r
136 * configuration and file information but will not output any results. Instead, it allows you direct access to the
\r
137 * important information so you can deal with the output yourself.
\r
138 * @deprecated use the ESLint class instead
\r
140 declare class CLIEngine extends CLIEngine_base {
\r
142 export { CLIEngine };
\r
143 //# sourceMappingURL=CLIEngine.d.ts.map
\r