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