I have the following root package.json:
{
"name": "project",
"private": true,
"workspaces": [
"packages/*"
],
"scripts": {
"build": "lerna run build",
"dev": "lerna run start --stream --parallel",
"format": "yarn prettier --write",
"prettier": "prettier --ignore-path .gitignore \"**/*.+(ts|tsx|json)\"",
"test": "lerna run test --"
},
"husky": {
"hooks": {
"pre-commit": "yarn format && yarn test"
}
},
"devDependencies": {
"husky": "^4.2.5",
"lerna": "^3.22.1",
"prettier": "^2.0.5"
}
}
The problem is that using this setup, I cannot commit when I am still working on files, to fix this I can make use of the lint-staged module, my question is, how can I set it up so that the commands I currently have still run but only on staged files without installing all the dependencies of the command in every project? The test command might also be a problem since it runs tsc --noEmit
in every project, can I force that to only check staged files too?