-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Problem using prettier as a git hook. #2978
Copy link
Copy link
Closed
Labels
locked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.Please open a new issue and fill out the template instead of commenting.scope:externalThis is not an issue with Prettier, it’s an issue with external software, like an editor integrationThis is not an issue with Prettier, it’s an issue with external software, like an editor integrationtype:questionQuestions and support requests. Please use Stack Overflow for them, not the issue tracker.Questions and support requests. Please use Stack Overflow for them, not the issue tracker.
Metadata
Metadata
Assignees
Labels
locked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.Please open a new issue and fill out the template instead of commenting.scope:externalThis is not an issue with Prettier, it’s an issue with external software, like an editor integrationThis is not an issue with Prettier, it’s an issue with external software, like an editor integrationtype:questionQuestions and support requests. Please use Stack Overflow for them, not the issue tracker.Questions and support requests. Please use Stack Overflow for them, not the issue tracker.
[Explaning my problem]
Hello I am trying to use prettier as pre-commit git hook (along with WebStorm).
I had the problem that even after I commit my changes, my files are marked as changed and git status and git diff output something strange. I spent some time investigating the problem and I reproduce it directly from the command line, excluding WebStorm from the problem. Since the problem occurs only when prettier prettifies my files my conclusion was that the problem must be in prettier not git.
[If you are in a hurry]
Just go to My Simple Example
[The actual problem]
When I commit a file that is considered ugly by prettier, the git hook that i have defined invoke prettier on the file, makes it pretty and then git performs the commit. At that point my expectations are that there will be no changes in my working directory, however git does not think so.
[Why do I think the problem comes from prettier and not git]
[My Simple Example]