npm.io
1.0.4 • Published 7 years ago

@becklyn/typescript-error-formatter

Licence
BSD-3-Clause
Version
1.0.4
Deps
0
Size
5 kB
Vulns
0
Weekly
0

TypeScript Error Formatter

Installation

yarn add -D @becklyn/typescript-error-formatter

Usage

Add the formatter in your ts-loader config:

const formatter = require("@becklyn/typescript-error-formatter"); 

const config = {
    module: {
        rules: [
            {
                test: /\.tsx?$/,
                use: [
                    babelLoader,
                    {
                        loader: "ts-loader",
                        options: {
                            // ↓ ↓ ↓
                            errorFormatter: (message, colors) => formatter(message, colors, process.cwd()),
                            // ↑ ↑ ↑
                        },
                    },
                ],
            },
        ],
    },
};

Design

The design is inspired by Flow:

Screenshot of the design