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.
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.