Closed tsongas closed 3 years ago
One thing to note, lint-staged
originally looked like this:
"lint-staged": {
"src/**/*.{js,jsx,ts,tsx,json,css,scss,md}": [
"prettier --write",
"git add"
]
},
however I got an error saying the git add
happens automatically so I should remove it from my script, which I did.
This actually appears to be working as intended, if there are no actual changes to commit after Prettier runs, I get an error. If there are changes, they get committed.
Trying to replace Husky with simple-git-hooks in a create-react-app project as follows in
package.json
:I am able to commit a properly formatted file i.e. no changes made by Prettier when the hook runs, however when I leave out a semi-colon to test Prettier formatting, I get a popup in VSCode saying "Git: [STARTED] Preparing..." with Show Command Output, Cancel, and Open Git Log buttons, then when I click Show Command Output I see the following:
Any idea how to fix this so Prettier runs and the changes get added to the commit?