Hacker News new | ask | show | jobs
by lindskogen 2420 days ago
Why do you care about its style so much?
2 comments

Because I find that its style reduces code readability.
It's a bit annoying when you have a large project then someone introduces prettier. Suddenly every pull request has dozens of random formatting changes everywhere and it obscures the actual changes. It also completely nullifies the functionality of git blame (I know there are other ways to see the file history).
Run prettier on the entire codebase once and add an ignore-revs-file: https://git-scm.com/docs/git-blame#Documentation/git-blame.t...
How does that help? Genuine question.
> running it on the entire codebase

The autoformatter config file is checked in with the PR that’s runs it on the entire codebase. Everybody’s machine autoformats the same way.

Only things that are changed in the PR will be formatted along with the PR.

The separate problem I’ve found is any outstanding PRs at the time of running it on the whole codebase should merge in the commit before the format all, then the format all change, then current master. It’s made resolving the PR merge conflicts easier

idk what the ignore rev file does

> idk what the ignore rev file does

Sorry - my question was ambiguous. That's the part that I don't understand.

The best way to introduce a formatter is with a git hook on commit/push (for JS projects see Husky), to ensure everyone is onboard and avoid exactly the formatting churn you mention.

Thanks LaurensBER for the ‘git blame’ solution!

https://github.com/typicode/husky