Formatting multiple package.json files in a mono repo fails
Closed this issue · 4 comments
matijs commented
Formatting multiple package.json files in a mono repo seems to fail for me and I'm not sure what the problem is. I'm using the setup below using husky and lint-staged in a precommit hook.
{
"scripts": {
"precommit": "lint-staged"
},
"lint-staged": {
"**/package.json": [
"format-package -w",
"git add"
],
"*.js": [
"eslint --fix",
"git add"
]
}
}
This works fine for multiple Javascript files. Whenever there is an linter error, ESLint kicks in and fixes the problem or halts the commit.
However it doesn't work when there are multiple package.json files staged for commit. It will format one and ignore the rest.
camacho commented
@matijs could you share an example repo setup that i could test on to try and fix this issue?
camacho commented
@matijs as a follow up - i now have a working example and hope to have a fix pushed this week
camacho commented
this issue should be fixed in v4.3