UNPKG

989 BTypeScriptView Raw
1interface BabelCodeFrameOptions {
2 /** Syntax highlight the code as JavaScript for terminals. default: false */
3 highlightCode?: boolean | undefined;
4 /** The number of lines to show above the error. default: 2 */
5 linesBelow?: number | undefined;
6 /** The number of lines to show below the error. default: 3 */
7 linesAbove?: number | undefined;
8 /**
9 * Forcibly syntax highlight the code as JavaScript (for non-terminals);
10 * overrides highlightCode.
11 * default: false
12 */
13 forceColor?: boolean | undefined;
14}
15
16/**
17 * Generate errors that contain a code frame that point to source locations.
18 *
19 * @param rawLines Raw lines to frame
20 * @param lineNumber Line number (1 indexed)
21 * @param colNumber Column number
22 * @param options Additional options
23 *
24 * @returns Framed code
25 */
26declare function codeFrame(
27 rawLines: string,
28 lineNumber: number,
29 colNumber: number,
30 options?: BabelCodeFrameOptions,
31): string;
32
33export = codeFrame;