Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / @typescript-eslint / experimental-utils / _ts3.4 / dist / ts-eslint / ESLint.d.ts
1 import { Linter } from './Linter';\r
2 declare class ESLintBase {\r
3     /**\r
4      * Creates a new instance of the main ESLint API.\r
5      * @param options The options for this instance.\r
6      */\r
7     constructor(options?: ESLint.ESLintOptions);\r
8     /**\r
9      * This method calculates the configuration for a given file, which can be useful for debugging purposes.\r
10      * - It resolves and merges extends and overrides settings into the top level configuration.\r
11      * - It resolves the parser setting to absolute paths.\r
12      * - It normalizes the plugins setting to align short names. (e.g., eslint-plugin-foo → foo)\r
13      * - It adds the processor setting if a legacy file extension processor is matched.\r
14      * - It doesn't interpret the env setting to the globals and parserOptions settings, so the result object contains\r
15      *   the env setting as is.\r
16      * @param filePath The path to the file whose configuration you would like to calculate. Directory paths are forbidden\r
17      *                 because ESLint cannot handle the overrides setting.\r
18      * @returns The promise that will be fulfilled with a configuration object.\r
19      */\r
20     calculateConfigForFile(filePath: string): Promise<Linter.Config>;\r
21     /**\r
22      * This method checks if a given file is ignored by your configuration.\r
23      * @param filePath The path to the file you want to check.\r
24      * @returns The promise that will be fulfilled with whether the file is ignored or not. If the file is ignored, then\r
25      *          it will return true.\r
26      */\r
27     isPathIgnored(filePath: string): Promise<boolean>;\r
28     /**\r
29      * This method lints the files that match the glob patterns and then returns the results.\r
30      * @param patterns The lint target files. This can contain any of file paths, directory paths, and glob patterns.\r
31      * @returns The promise that will be fulfilled with an array of LintResult objects.\r
32      */\r
33     lintFiles(patterns: string | string[]): Promise<ESLint.LintResult[]>;\r
34     /**\r
35      * This method lints the given source code text and then returns the results.\r
36      *\r
37      * By default, this method uses the configuration that applies to files in the current working directory (the cwd\r
38      * constructor option). If you want to use a different configuration, pass options.filePath, and ESLint will load the\r
39      * same configuration that eslint.lintFiles() would use for a file at options.filePath.\r
40      *\r
41      * If the options.filePath value is configured to be ignored, this method returns an empty array. If the\r
42      * options.warnIgnored option is set along with the options.filePath option, this method returns a LintResult object.\r
43      * In that case, the result may contain a warning that indicates the file was ignored.\r
44      * @param code The source code text to check.\r
45      * @param options The options.\r
46      * @returns The promise that will be fulfilled with an array of LintResult objects. This is an array (despite there\r
47      *          being only one lint result) in order to keep the interfaces between this and the eslint.lintFiles()\r
48      *          method similar.\r
49      */\r
50     lintText(code: string, options?: ESLint.LintTextOptions): Promise<ESLint.LintResult[]>;\r
51     /**\r
52      * This method loads a formatter. Formatters convert lint results to a human- or machine-readable string.\r
53      * @param name TThe path to the file you want to check.\r
54      * The following values are allowed:\r
55      * - undefined. In this case, loads the "stylish" built-in formatter.\r
56      * - A name of built-in formatters.\r
57      * - A name of third-party formatters. For examples:\r
58      * -- `foo` will load eslint-formatter-foo.\r
59      * -- `@foo` will load `@foo/eslint-formatter`.\r
60      * -- `@foo/bar` will load `@foo/eslint-formatter-bar`.\r
61      * - A path to the file that defines a formatter. The path must contain one or more path separators (/) in order to distinguish if it's a path or not. For example, start with ./.\r
62      * @returns The promise that will be fulfilled with a Formatter object.\r
63      */\r
64     loadFormatter(name?: string): Promise<ESLint.Formatter>;\r
65     /**\r
66      * This method copies the given results and removes warnings. The returned value contains only errors.\r
67      * @param results The LintResult objects to filter.\r
68      * @returns The filtered LintResult objects.\r
69      */\r
70     static getErrorResults(results: ESLint.LintResult): ESLint.LintResult;\r
71     /**\r
72      * This method writes code modified by ESLint's autofix feature into its respective file. If any of the modified\r
73      * files don't exist, this method does nothing.\r
74      * @param results The LintResult objects to write.\r
75      * @returns The promise that will be fulfilled after all files are written.\r
76      */\r
77     static outputFixes(results: ESLint.LintResult): Promise<void>;\r
78     /**\r
79      * The version text.\r
80      */\r
81     static readonly version: string;\r
82 }\r
83 declare namespace ESLint {\r
84     interface ESLintOptions {\r
85         /**\r
86          * If false is present, ESLint suppresses directive comments in source code.\r
87          * If this option is false, it overrides the noInlineConfig setting in your configurations.\r
88          */\r
89         allowInlineConfig?: boolean;\r
90         /**\r
91          * Configuration object, extended by all configurations used with this instance.\r
92          * You can use this option to define the default settings that will be used if your configuration files don't\r
93          * configure it.\r
94          */\r
95         baseConfig?: Linter.Config | null;\r
96         /**\r
97          * If true is present, the eslint.lintFiles() method caches lint results and uses it if each target file is not\r
98          * changed. Please mind that ESLint doesn't clear the cache when you upgrade ESLint plugins. In that case, you have\r
99          * to remove the cache file manually. The eslint.lintText() method doesn't use caches even if you pass the\r
100          * options.filePath to the method.\r
101          */\r
102         cache?: boolean;\r
103         /**\r
104          * The eslint.lintFiles() method writes caches into this file.\r
105          */\r
106         cacheLocation?: string;\r
107         /**\r
108          * The working directory. This must be an absolute path.\r
109          */\r
110         cwd?: string;\r
111         /**\r
112          * Unless set to false, the eslint.lintFiles() method will throw an error when no target files are found.\r
113          */\r
114         errorOnUnmatchedPattern?: boolean;\r
115         /**\r
116          * If you pass directory paths to the eslint.lintFiles() method, ESLint checks the files in those directories that\r
117          * have the given extensions. For example, when passing the src/ directory and extensions is [".js", ".ts"], ESLint\r
118          * will lint *.js and *.ts files in src/. If extensions is null, ESLint checks *.js files and files that match\r
119          * overrides[].files patterns in your configuration.\r
120          * Note: This option only applies when you pass directory paths to the eslint.lintFiles() method.\r
121          * If you pass glob patterns, ESLint will lint all files matching the glob pattern regardless of extension.\r
122          */\r
123         extensions?: string[] | null;\r
124         /**\r
125          * If true is present, the eslint.lintFiles() and eslint.lintText() methods work in autofix mode.\r
126          * If a predicate function is present, the methods pass each lint message to the function, then use only the\r
127          * lint messages for which the function returned true.\r
128          */\r
129         fix?: boolean | ((message: LintMessage) => boolean);\r
130         /**\r
131          * The types of the rules that the eslint.lintFiles() and eslint.lintText() methods use for autofix.\r
132          */\r
133         fixTypes?: string[];\r
134         /**\r
135          * If false is present, the eslint.lintFiles() method doesn't interpret glob patterns.\r
136          */\r
137         globInputPaths?: boolean;\r
138         /**\r
139          * If false is present, the eslint.lintFiles() method doesn't respect `.eslintignore` files or ignorePatterns in\r
140          * your configuration.\r
141          */\r
142         ignore?: boolean;\r
143         /**\r
144          * The path to a file ESLint uses instead of `$CWD/.eslintignore`.\r
145          * If a path is present and the file doesn't exist, this constructor will throw an error.\r
146          */\r
147         ignorePath?: string;\r
148         /**\r
149          * Configuration object, overrides all configurations used with this instance.\r
150          * You can use this option to define the settings that will be used even if your configuration files configure it.\r
151          */\r
152         overrideConfig?: Linter.ConfigOverride | null;\r
153         /**\r
154          * The path to a configuration file, overrides all configurations used with this instance.\r
155          * The options.overrideConfig option is applied after this option is applied.\r
156          */\r
157         overrideConfigFile?: string | null;\r
158         /**\r
159          * The plugin implementations that ESLint uses for the plugins setting of your configuration.\r
160          * This is a map-like object. Those keys are plugin IDs and each value is implementation.\r
161          */\r
162         plugins?: Record<string, Linter.Plugin> | null;\r
163         /**\r
164          * The severity to report unused eslint-disable directives.\r
165          * If this option is a severity, it overrides the reportUnusedDisableDirectives setting in your configurations.\r
166          */\r
167         reportUnusedDisableDirectives?: Linter.SeverityString | null;\r
168         /**\r
169          * The path to a directory where plugins should be resolved from.\r
170          * If null is present, ESLint loads plugins from the location of the configuration file that contains the plugin\r
171          * setting.\r
172          * If a path is present, ESLint loads all plugins from there.\r
173          */\r
174         resolvePluginsRelativeTo?: string | null;\r
175         /**\r
176          * An array of paths to directories to load custom rules from.\r
177          */\r
178         rulePaths?: string[];\r
179         /**\r
180          * If false is present, ESLint doesn't load configuration files (.eslintrc.* files).\r
181          * Only the configuration of the constructor options is valid.\r
182          */\r
183         useEslintrc?: boolean;\r
184     }\r
185     interface DeprecatedRuleInfo {\r
186         /**\r
187          *  The rule ID.\r
188          */\r
189         ruleId: string;\r
190         /**\r
191          *  The rule IDs that replace this deprecated rule.\r
192          */\r
193         replacedBy: string[];\r
194     }\r
195     /**\r
196      * The LintResult value is the information of the linting result of each file.\r
197      */\r
198     interface LintResult {\r
199         /**\r
200          * The number of errors. This includes fixable errors.\r
201          */\r
202         errorCount: number;\r
203         /**\r
204          * The absolute path to the file of this result. This is the string "<text>" if the file path is unknown (when you\r
205          * didn't pass the options.filePath option to the eslint.lintText() method).\r
206          */\r
207         filePath: string;\r
208         /**\r
209          * The number of errors that can be fixed automatically by the fix constructor option.\r
210          */\r
211         fixableErrorCount: number;\r
212         /**\r
213          * The number of warnings that can be fixed automatically by the fix constructor option.\r
214          */\r
215         fixableWarningCount: number;\r
216         /**\r
217          * The array of LintMessage objects.\r
218          */\r
219         messages: Linter.LintMessage[];\r
220         /**\r
221          * The source code of the file that was linted, with as many fixes applied as possible.\r
222          */\r
223         output?: string;\r
224         /**\r
225          * The original source code text. This property is undefined if any messages didn't exist or the output\r
226          * property exists.\r
227          */\r
228         source?: string;\r
229         /**\r
230          * The information about the deprecated rules that were used to check this file.\r
231          */\r
232         usedDeprecatedRules: DeprecatedRuleInfo[];\r
233         /**\r
234          * The number of warnings. This includes fixable warnings.\r
235          */\r
236         warningCount: number;\r
237     }\r
238     interface LintTextOptions {\r
239         /**\r
240          * The path to the file of the source code text. If omitted, the result.filePath becomes the string "<text>".\r
241          */\r
242         filePath?: string;\r
243         /**\r
244          * If true is present and the options.filePath is a file ESLint should ignore, this method returns a lint result\r
245          * contains a warning message.\r
246          */\r
247         warnIgnored?: boolean;\r
248     }\r
249     /**\r
250      * The LintMessage value is the information of each linting error.\r
251      */\r
252     interface LintMessage {\r
253         /**\r
254          * The 1-based column number of the begin point of this message.\r
255          */\r
256         column: number;\r
257         /**\r
258          * The 1-based column number of the end point of this message. This property is undefined if this message\r
259          * is not a range.\r
260          */\r
261         endColumn: number | undefined;\r
262         /**\r
263          * The 1-based line number of the end point of this message. This property is undefined if this\r
264          * message is not a range.\r
265          */\r
266         endLine: number | undefined;\r
267         /**\r
268          * The EditInfo object of autofix. This property is undefined if this message is not fixable.\r
269          */\r
270         fix: EditInfo | undefined;\r
271         /**\r
272          * The 1-based line number of the begin point of this message.\r
273          */\r
274         line: number;\r
275         /**\r
276          * The error message\r
277          */\r
278         message: string;\r
279         /**\r
280          * The rule name that generates this lint message. If this message is generated by the ESLint core rather than\r
281          * rules, this is null.\r
282          */\r
283         ruleId: string | null;\r
284         /**\r
285          * The severity of this message. 1 means warning and 2 means error.\r
286          */\r
287         severity: 1 | 2;\r
288         /**\r
289          * The list of suggestions. Each suggestion is the pair of a description and an EditInfo object to fix code. API\r
290          * users such as editor integrations can choose one of them to fix the problem of this message. This property is\r
291          * undefined if this message doesn't have any suggestions.\r
292          */\r
293         suggestions: {\r
294             desc: string;\r
295             fix: EditInfo;\r
296         }[] | undefined;\r
297     }\r
298     /**\r
299      * The EditInfo value is information to edit text.\r
300      *\r
301      * This edit information means replacing the range of the range property by the text property value. It's like\r
302      * sourceCodeText.slice(0, edit.range[0]) + edit.text + sourceCodeText.slice(edit.range[1]). Therefore, it's an add\r
303      * if the range[0] and range[1] property values are the same value, and it's removal if the text property value is\r
304      * empty string.\r
305      */\r
306     interface EditInfo {\r
307         /**\r
308          * The pair of 0-based indices in source code text to remove.\r
309          */\r
310         range: [\r
311             number,\r
312             number\r
313         ];\r
314         /**\r
315          * The text to add.\r
316          */\r
317         text: string;\r
318     }\r
319     /**\r
320      * The Formatter value is the object to convert the LintResult objects to text.\r
321      */\r
322     interface Formatter {\r
323         /**\r
324          * The method to convert the LintResult objects to text\r
325          */\r
326         format(results: LintResult[]): string;\r
327     }\r
328 }\r
329 declare const _ESLint: typeof ESLintBase;\r
330 /**\r
331  * The ESLint class is the primary class to use in Node.js applications.\r
332  * This class depends on the Node.js fs module and the file system, so you cannot use it in browsers.\r
333  *\r
334  * If you want to lint code on browsers, use the Linter class instead.\r
335  *\r
336  * @since 7.0.0\r
337  */\r
338 declare class ESLint extends _ESLint {\r
339 }\r
340 export { ESLint };\r
341 //# sourceMappingURL=ESLint.d.ts.map\r