Skip to content

Instantly share code, notes, and snippets.

@goququ
Last active May 3, 2022 17:39
Show Gist options
  • Save goququ/8a0bbec9a95507c19be944efb80f70f7 to your computer and use it in GitHub Desktop.
Save goququ/8a0bbec9a95507c19be944efb80f70f7 to your computer and use it in GitHub Desktop.
# Format staged js/ts files before commit
npx prettier --write $(git ls-files --modified -u | awk '{ print $4 }' | grep -E -i '.(t|j)sx?')
# variant 2
prettier --write $(git diff --name-only --cached | grep -E -i '.(t|j)sx?')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment