In order to run linter in a pre-commit hook you can check changed files only for performance reasons.
package.json:
{
"scripts": [
"fastlint": "git diff --cached --name-only | grep .ts$ | xargs -L1 \"./node_modules/.bin/tslint\" --fix"
],
"pre-commit": [
"fastlint"
]
}
Remove the "--fix" if you do not want to auto fix files.
Requirements:
pre-commit installed (npm i pre-commit --save-dev
)