I am trying to use husky with lint-staged for pre commit git hooks in angular5. Prettier formats only the staged files. But when I run ng lint command it runs on all the changed files instead of running on only staged files(I have 4 files modified, but only 2 files added to staging area using git add command. But all 4 files are checked for linting which is not what I expect)
Here is the configuration in .lintstagedrc
"*.{ts,json}": [
"prettier --write",
"ng lint myProjName --files",
"git add"
],
"*.less": [
"prettier --write",
"npm run stylelint",
"git add"
]
}```
I debugged the issue to some extent. --files takes only the files which have been staged into the account. But still when the linters task completes, I get errors for non staged files as well.