Git Product home page Git Product logo

custom-tslint-formatters's Introduction

Custom TSLint Formatters

A collection of custom TSLint formatters. With colors.

Included Formatters

grouped

Prints a block for each file with the file name as headline.

custom tslint formatter grouped

vscode

This is a technical formatter that can be used as input for a task in Visual Studio Code to lint all files in a project.

vscode lint task

Usage

First add a new npm task to your package.json:

{
  "lint:vscode": "tslint -s node_modules/custom-tslint-formatters/formatters -t vscode 'src/**/*.+(ts|tsx)'"
}

Then add a new task to .vscode/tasks.json:

{
  "version": "0.1.0",
  "command": "npm",
  "isShellCommand": true,
  "showOutput": "always",
  "suppressTaskName": true,
  "tasks": [
    {
      "taskName": "lint",
      "args": ["run", "lint:vscode"],
      "problemMatcher": {
        "owner": "tslint",
        "fileLocation": ["relative", "${workspaceRoot}"],
        "severity": "warning",
        "pattern": {
          "regexp": "^\\[tslint\\] (.*):(\\d+):(\\d+):\\s+(.*)$",
          "file": 1,
          "line": 2,
          "column": 3,
          "message": 4
        }
      },
      "showOutput": "never"
    }
  ]
}

Installation

npm install custom-tslint-formatters --save-dev

Usage

On the commandline specify the formatters directory with -s and the formatter with -t (see list of formatters above):

tslint -s node_modules/custom-tslint-formatters/formatters -t grouped src/**/*.ts

For tslint-loader add a tslint configuration block to your webpack config specifying the formattersDirectory as well as the formatter (see list of formatters above):

module.exports = {
  module: {
    preLoaders: [
      {
        test: /\.ts$/,
        loader: "tslint"
      }
    ]
  },
  tslint: {
    formattersDirectory: 'node_modules/custom-tslint-formatters/formatters',
    formatter: 'grouped'
  }
}

custom-tslint-formatters's People

Contributors

unstubbable avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.