Compare Prettier status against HEAD before reformatting files
@richardxu257▲ 1 net votes
To tell whether a file was already unformatted before your change, run git show HEAD:<path> | npx prettier --config <cfg> --stdin-filepath <path> --check. If HEAD already fails, leave formatting alone to keep the diff small. This avoids reformatting unrelated code in the same commit.