nrwl / precise-commits

:sparkles: Painlessly apply Prettier by only formatting lines you have modified anyway!
MIT License
471 stars 20 forks source link

I'd love to run this without committing anything to the repo #54

Open devinrhode2 opened 4 years ago

devinrhode2 commented 4 years ago

I'd also love to be able to run it on save

When I found this, I was originally searching google for a script that would do this: Given a folder (like ~/repos), check each subfolder for a package.json and .git folder, if they are both present, then install prettier, optionally add some .prettierignore and .prettierrc files, format all code, commit, add a .git-blame-ignore-revs with the formatting commit hash, commit that, and then also add a husky lint-staged thing to format all code going into the codebase with prettier.

This is a one-time operation, there would be a commit in the commit history, but thanks to .git-blame-ignore-revs, we can avoid having every line show it was last modified by the formatting commit.