UNPKG

1.53 kBTypeScriptView Raw
1import { FormatResult } from "./vendor/format.js";
2export interface LintResult {
3 /**
4 * The absolute path to the file that was linted.
5 */
6 filePath: string;
7 /**
8 * An array of message objects. See below for more info about messages.
9 */
10 messages: LintMessage[];
11 /**
12 * The number of errors for the given file.
13 */
14 errorCount: number;
15 /**
16 * The number of warnings for the given file.
17 */
18 warningCount: number;
19 /**
20 * The source code for the given file. This property is omitted if this file has no errors/warnings or if the `output` property is present.
21 */
22 source: string;
23 /**
24 * The source code for the given file with as many fixes applied as possible. This property is omitted if no fix is available.
25 */
26 output?: string;
27}
28export declare const enum LintSeverity {
29 Warning = 1,
30 Error = 2
31}
32export interface LintMessage {
33 /**
34 * the id of the rule that produced the error or warning.
35 */
36 ruleId: string;
37 /**
38 * the severity of the failure, 1 for warnings and 2 for errors.
39 */
40 severity: LintSeverity;
41 /**
42 * the human readable description of the error.
43 */
44 message: string;
45 /**
46 * the line where the issue is located.
47 */
48 line: number;
49 /**
50 * the column where the issue is located.
51 */
52 column: number;
53 /**
54 * the type of the node in the AST
55 */
56 nodeType: string;
57}
58export declare function lint(result: FormatResult): LintResult;