Skip to content

apply prettier to entire project#2989

Merged
itsMapleLeaf merged 16 commits intomasterfrom
darius/hig-2656-apply-prettier-to-entire-project
Sep 1, 2022
Merged

apply prettier to entire project#2989
itsMapleLeaf merged 16 commits intomasterfrom
darius/hig-2656-apply-prettier-to-entire-project

Conversation

@itsMapleLeaf
Copy link

@linear
Copy link

linear bot commented Aug 31, 2022

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

@aws-amplify-us-east-2
Copy link

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-2989.d2ak4k17n5qky0.amplifyapp.com

@aws-amplify-us-east-2
Copy link

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-2989.d25bj3loqvp3nx.amplifyapp.com

Copy link
Member

@Vadman97 Vadman97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whoa, TIL!
not sure if it's working as expected though since it still shows on git blame 🤔
Screen Shot 2022-08-31 at 2 32 30 PM

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm 🤔 I added another hook to configure this on checkout, but maybe that's not the right one... I'll check again

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Contributor

@ccschmitz ccschmitz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I didn't realize that! Thanks for pointing that out 👍

@itsMapleLeaf itsMapleLeaf merged commit 50f6fc1 into master Sep 1, 2022
@itsMapleLeaf itsMapleLeaf deleted the darius/hig-2656-apply-prettier-to-entire-project branch September 1, 2022 17:23
@linear linear bot mentioned this pull request Sep 13, 2022
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

Successfully merging this pull request may close these issues.

3 participants