Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"git add" and "prettier --write" in pre-commit are dangerous #33

Open
gsouf opened this issue Dec 27, 2021 · 0 comments
Open

"git add" and "prettier --write" in pre-commit are dangerous #33

gsouf opened this issue Dec 27, 2021 · 0 comments

Comments

@gsouf
Copy link
Contributor

gsouf commented Dec 27, 2021

Hi,

I think you should remove this from package.json

    "pre-commit": "prettier --write . && git add -A"

It is a dangerous option, that can silently delete changes made by the developer and will also screw git softwares using changelists, as well as a simple selective commit in git cli.

It can safely be replaced with an integration of prettier in your IDE that would fix cs on save.

With that said I leave it up to you the decision to remove it or not.

@gsouf gsouf changed the title git add in pre-commit is dangerous "git add" and "prettier --write" in pre-commit are dangerous Dec 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant