Husky
Make sure you install the package with yarn or lint and add it to your package.json as well as adding the following config to your package.json file.
"husky": {
"hooks": {
"pre-commit": "npm run lint && npm run stylelint",
"pre-push": "ng build --prod"
}
}
pre-commit
"pre-commit": "npm run lint && npm run stylelint",
This runs before the GIT commit happens and won't allow the commit to happen if an error is thrown.
pre-push
"pre-push": "ng build --prod"
This runs before the GIT push happens and won't allow the push to happen if an error is thrown.
Stylelint
I left the stylelint stuff in that stripped down package.json I included as we have really enjoyed it for linting our SCSS, I think it has plugins for LESS as well if you guys are using that. Mostly we use the default rules for that.
TSLint
I am not really sure where we got the original set of rules that we use in our TSLint but we have modified them to a small degree to behave how we want. Off the top of my head the important ones it enforces are; tabstop of 2, single quotes, optional semicolons are required, throws a warning on implicit any types, curly braces required.