@hong97/tslint
v0.0.5
Published
**Work with [lint-staged](https://github.com/lint-staged/lint-staged), run tsc on staged files and output the result of staged-only files.**
Downloads
2
Readme
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.