Reputation: 2853
I have a unformatted json
file that gets stored in my application with the following structure
src
/forms
/test
- abc.json
I am using husky
and lint-staged
to make use of prettier and linting on pre-commit. The configuration resides in my package.json
as following
"husky": {
"hooks": {
"pre-commit": "lint-staged --relative",
"pre-push": "tsc"
}
},
"lint-staged": {
"src/**/*.{ts, json}": [
"prettier --write",
"eslint --fix"
]
},
....
..
But for some reason the abc.json
file never gets formatted when I push my code to github. What am I missing?
Upvotes: 10
Views: 16319
Reputation: 31
There's an error in your glob pattern. Patterns within curly braces should only be delimited by a comma
You have:
"src/**/*.{ts, json}"
Instead, remove the space in the pattern as follows:
"src/**/*.{ts,json}"
Upvotes: 3