I have a project that uses prettier for formatting. I want my remote code repository to have files that have a consistent format. For this reason, I added a script in package.json file that will format the whole code base in one line of command(npm run format)
This works! But the problem is that I may sometimes forget to format my code before git push to a remote repository. And I am not okay with cluttering my git history with unnecessary commits for the sake of formatting the code.
I resolved to automation and opting for git hooks that will format my code base with the command: npm run format every time I add file(s) to the staging area.
But I seem not to find a git hook for my use case.
Is there a hook that can run before staging files?
