Add Prettier on existing Codebase
The existing codebase I recently joined working on, has no Prettier installed - no formatter has been used, only VS Code default one - so the new requirement is to add the Prettier and start formatting the codebase.
My main issue is that we are gonna have a lot of files changed and it will be a problem to track them appropriately later, the team is not ready to even think of reviewing all those changes.
Can you please give me any suggestions based on your experience?
Thanks 💯
4 Replies
prettier shouldn't cause any functional changes, so I'd strongly recommend making sure that the commits where you update the formatting contains only formatting changes
depending on how actively you're developing, and how large your project is, you might be able to do a freeze for a day or two and just go through and update the layout in a branch, and then merge that down to main so you have a single commit where all files are updated
alternatively, what I've done in the past for some projects where I want to change layout or switch from tabs to spaces or whatever, is every time you touch a file, the first thing you do is change your layout and confirm things still work the way they're supposed to, commit that, and then do the functional changes you wanted to do. Over time, you'll get (most of) the project
but basically, you want to be 100% sure the layout changes are isolated to a single commit, and be prepared that the person doing that will probably touch every single LOC so if that's a metric that's measured, or if you use
git blame
a lot, you'll have to keep that in mindthanks a lot for the response, one more thing, please. @jochemm
after adding Prettier, when do you prefer running it? on save? on commit, or on push?
definitely save for me
It's very nice to be able to lazily write way too compact, badly formatted code, hitting ctrl+s, and *poof* everything is nice and neat
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View