UNPKG

1.36 kBTypeScriptView Raw
1export declare class Line {
2}
3export declare class CodeLine extends Line {
4 contents: string;
5 constructor(contents: string);
6}
7export declare class MessageSubstitutionLine extends Line {
8 key: string;
9 message: string;
10 constructor(key: string, message: string);
11}
12export declare class ErrorLine extends Line {
13 startCol: number;
14 constructor(startCol: number);
15}
16export declare class MultilineErrorLine extends ErrorLine {
17 constructor(startCol: number);
18}
19export declare class EndErrorLine extends ErrorLine {
20 endCol: number;
21 message: string;
22 constructor(startCol: number, endCol: number, message: string);
23}
24export declare const ZERO_LENGTH_ERROR = "~nil";
25/**
26 * Maps a line of text from a .lint file to an appropriate Line object
27 */
28export declare function parseLine(text: string): Line;
29/**
30 * Maps a Line object to a matching line of text that could be in a .lint file.
31 * This is almost the inverse of parseLine.
32 * If you ran `printLine(parseLine(someText), code)`, the whitespace in the result may be different than in someText
33 * @param line - A Line object to convert to text
34 * @param code - If line represents error markup, this is the line of code preceding the markup.
35 * Otherwise, this parameter is not required.
36 */
37export declare function printLine(line: Line, code?: string): string | null;