@babel/code-frame

  • Version 8.0.0
  • Published
  • 32.6 kB
  • 2 dependencies
  • MIT license

Install

npm i @babel/code-frame
yarn add @babel/code-frame
pnpm add @babel/code-frame

Overview

Generate errors that contain a code frame that point to source locations.

Index

Functions

function codeFrameColumns

codeFrameColumns: (
rawLines: string,
loc: NodeLocation,
opts?: Options
) => string;

    function highlight

    highlight: (text: string) => string;

      Interfaces

      interface Options

      interface Options {}

        property forceColor

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

        property highlightCode

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

        property linesAbove

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

        property linesBelow

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

        property message

        message?: string;
        • 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

        property startLine

        startLine?: number;

          Package Files (1)

          Dependencies (2)

          Dev Dependencies (1)

          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/@babel/code-frame.

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