A question about git Hook and Workflow

I am now developing JS applications. I use husky to make pre-commit hooks. I will run prettier before commit, but now I am embarrassed. prettier git will continue commit after running, which results in a pile of formatted code in git that has not been submitted, so I have to continue add & commit , which is a lot more.
I was thinking that it"s best to make a pre-add before add , but it doesn"t seem to have this hook. So I"d like to ask you, do you have any good ways to avoid leaving a bunch of unstaged changes after pre-commit ?

Git
Mar.07,2021

there are some official suggestions, about formatted files in the hook again add, will not meet your needs?

-sharp!/bin/sh
jsfiles=$(git diff --cached --name-only --diff-filter=ACM "*.js" "*.jsx" | tr '\n' ' ')
[ -z "$jsfiles" ] && exit 0

-sharp Prettify all staged .js files
echo "$jsfiles" | xargs ./node_modules/.bin/prettier --write

-sharp Add back the modified/prettified files to staging
echo "$jsfiles" | xargs git add

exit 0

reference: https://prettier.io/docs/en/p.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3aabf-2ba7c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3aabf-2ba7c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?