@types/babel__code-frame

  • Version 7.0.6
  • Published
  • 5.94 kB
  • No dependencies
  • MIT license

Install

npm i @types/babel__code-frame
yarn add @types/babel__code-frame
pnpm add @types/babel__code-frame

Overview

TypeScript definitions for @babel/code-frame

Index

Functions

function codeFrame

codeFrame: (
rawLines: string,
lineNumber: number,
colNumber: number,
options?: BabelCodeFrameOptions
) => string;
  • Generate errors that contain a code frame that point to source locations.

    Parameter rawLines

    Raw lines to frame

    Parameter lineNumber

    Line number (1 indexed)

    Parameter colNumber

    Column number

    Parameter options

    Additional options

    Returns

    Framed code

function codeFrameColumns

codeFrameColumns: (
rawLines: string,
location: SourceLocation,
options?: BabelCodeFrameOptions
) => string;

    Interfaces

    interface BabelCodeFrameOptions

    interface BabelCodeFrameOptions {}

      property forceColor

      forceColor?: boolean | undefined;
      • Forcibly syntax highlight the code as JavaScript (for non-terminals); overrides highlightCode. default: false

      property highlightCode

      highlightCode?: boolean | undefined;
      • Syntax highlight the code as JavaScript for terminals. default: false

      property linesAbove

      linesAbove?: number | undefined;
      • The number of lines to show above the error. default: 2

      property linesBelow

      linesBelow?: number | undefined;
      • The number of lines to show below the error. default: 3

      property message

      message?: string | undefined;
      • Pass in a string to be displayed inline (if possible) next to the highlighted location in the code. If it can't be positioned inline, it will be placed above the code frame. default: nothing

      interface SourceLocation

      interface SourceLocation {}

        property end

        end?: { line: number; column?: number | undefined } | undefined;

          property start

          start: { line: number; column?: number | undefined };

            Package Files (1)

            Dependencies (0)

            No dependencies.

            Dev Dependencies (0)

            No dev dependencies.

            Peer Dependencies (0)

            No peer dependencies.

            Badge

            To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

            You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/babel__code-frame.

            • Markdown
              [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/babel__code-frame)
            • HTML
              <a href="https://www.jsdocs.io/package/@types/babel__code-frame"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>