0.0.5 • Published 6 months ago

@hong97/tslint v0.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

Work with lint-staged, run tsc on staged files and output the result of staged-only files.

⚠️ ONLY TESTED ON TYPESCRIPT 5

Setup

  • Install lint-staged, follow the instructions.

  • Install tslint, use:

    npm i -D @hong97/tslint
  • In package.json, add tslint to *.ts, *.tsx files.

    "lint-staged": {
      "*.{ts,tsx}": [
        "tslint"
      ]
    },
  • Use Husky or other methods to set up your git 'pre-commit' hooks.

  • Now, TypeScript will be checked at commit staged.

Configuration

Create a file named tslintconfig.js in your root directory:

module.exports = {
  alwaysInclude: [
    // always included in tsc process no matter these files are staged or not
  ],
  ignore: [
    // use glob pattern, see more: https://www.npmjs.com/package/minimatch
  ],
};

You can also set up a callback hook in config file:

module.exports = {
  onFinish: (result) => {
    // ...
  } 
};

The callback will be invoked after tslint finish running and the results will be passed through.

0.0.5

6 months ago

0.0.4

6 months ago

0.0.3

6 months ago

0.0.2

6 months ago

0.0.1

6 months ago