apply prettier to entire project#2989
Conversation
itsMapleLeaf
commented
Aug 31, 2022
- updates prettier config, as described in https://www.notion.so/runhighlight/Operation-Modernize-Frontend-cb1a66d207a74440a0fb7c9944722775#780a6628e2d2453d8fbacd358ec9296c
- formats all files
- adds a pre-commit hook to ensure files stay formatted
- adds a .git-blame-ignore-revs file, to not wreck git blame after the format
HIG-2656 Apply prettier to entire project
At the moment, prettier only exists in specific files in specific places. I want to apply prettier to every file in the project that it supports, adding a script at the repo root to format it all in one go, and add a hook to format on commit. I also want to update the config, as described here |
|
This pull request is automatically being deployed by Amplify Hosting (learn more). |
|
This pull request is automatically being deployed by Amplify Hosting (learn more). |
Vadman97
left a comment
There was a problem hiding this comment.
husky is cool! thanks for setting that up, i've definitely introduced lint regressions way too many times at this point
🔍 Finding changed files since git revision f59de07fc.
🎯 Found 1 changed file.
✍️ Fixing up frontend/tsconfig.json.
✅ Everything is awesome!
[darius/hig-2656-apply-prettier-to-entire-project 07cd869d6] test
| @@ -0,0 +1,2 @@ | |||
| # applying prettier across project | |||
| 44bea57277107c4b86780ce5773e2dc5aa0cb840 | |||
There was a problem hiding this comment.
hm 🤔 I added another hook to configure this on checkout, but maybe that's not the right one... I'll check again
There was a problem hiding this comment.
alright, I also added a post-merge hook to set up this config, and it seems to work when I do that. I tested by deleting the local branch and git switching to it again
…nto darius/hig-2656-apply-prettier-to-entire-project
there's a glob to ignore the data directory, since that's created by docker, and prettier crashes on trying to read it prettier/prettier#11568
ccschmitz
left a comment
There was a problem hiding this comment.
One minor suggestion to fix tabs in the GitHub UI, otherwise this looks good to me! I like the addition of pretty-quick for formatting changed files 👌
Still would be in favor of less config rather than more (removing .prettierrc entirely), but I don't have any strong opinions here. Also an easy thing to change in the future if we want.
| "sysoev.vscode-open-in-github", | ||
| "stylelint.vscode-stylelint", | ||
| "sourcegraph.sourcegraph", | ||
| "eamodio.gitlens" |
There was a problem hiding this comment.
One thing that's a bummer about tabs is that you get some bad defaults from certain places you want to read code, like the GitHub UI showing 8 spaces for a tab 😄
I've heard that if you add a .editorconfig file GitHub will respect those preferences when viewing code in their UI. Think we could try that out?
There was a problem hiding this comment.
Sure! I can try that in a followup PR. Worth noting that GitHub supports this as a preference in settings: https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-personal-account-on-github/managing-personal-account-settings/managing-your-tab-size-rendering-preference
There was a problem hiding this comment.
Ah, I didn't realize that! Thanks for pointing that out 👍
