Within my project folder, I have organized the structure with two subfolders: frontend
and backend
to contain their respective codebases.
Here is how the root folder is set up:
- backend
- package.json
- other backend code files
- frontend
- package.json
- other frontend code files
- package.json
The root's package.json includes the following:
"scripts": {
"frontend:lint": "cd ./frontend && npm run lint &&& cd ..",
"backend:lint": "cd ./backend && npm run lint & cd .."
},
"devDependencies": {
"husky": "4.3.8",
"lint-staged": "10.5.3"
},
"husky": {
"hooks": {
"pre-commit": "lint-staged"
}
},
"lint-staged": {
"frontend/**/*.{ts, tsx, json, html}": [
"npm run frontend:lint"
],
"backend/**/*.{ts,json}": [
"npm run backend:lint"
]
}
However, when I try to do git add
followed by git commit
at the root level, it keeps showing an error message:
No staged files match any configured task.
I have checked both of the sub-package.json files and they seem to be working correctly. I am uncertain about how to properly configure lint-staged to filter the files.