-
Notifications
You must be signed in to change notification settings - Fork 144
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
Add pre-commit hooks for formatting and linting #10737
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall I like this feature. There are some merge conflicts that need to be taken care of.
I'm wondering if instead of something like yarn format
, this could be added as a pre-commit hook to remove the friction of using this
Sure, I was planning to add something like that as a follow-up, but I'm happy to add a little PoC here. |
4aa63c6
to
6562297
Compare
6562297
to
94fedb5
Compare
Added a pre-commit hook so that folks can have a frictionless formatting experience. To use, assuming you already have the new js dependencies like prettier itself:
Then write some vue/ts by hand, attempt to commit, see the auto-fix happen as the commit aborts. You can always I can walk interested folks through this on the forum and update the contributor docs if this lands. It is truly optional, if you like waiting for Github Actions to fail and asking you to make more commits ;) |
0fbdc00
to
24b7d77
Compare
0a49af3
to
2b7f294
Compare
Merge checklist:
|
2b7f294
to
479e7cc
Compare
👋 @chrabyrd ready for another look, let me know if you have any questions. Will need to repoint package.json dev dependencies back to 7.6.x before merging. |
combed the code and it looks good. Going to do one final runthrough to watch it work && it should be g2g 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gave it another lookover and runthrough and it looks and works well. There's just a few minor things to address:
- I notice
.pre-commit-config.yaml
gets added to the interpolation logic inupdateproject.py
, but the file is nevershutil
-ed over. - Can
updateproject.py
andarches-admin
/arches-project
get updated to runpre-commit install
? That way the user doesn't need to do that extra step - Can the 7.6.0 doc be updated to include instructions for this feature? Even if all the work is abstracted away in
updateproject
at least the line that says they need to reinstall dev requirements. - Is this involved enough to include documentation around in
arches-docs
?
But yeah overall these are relatively minor and this branch is nearly wrapped up. This work should undo a lot of the friction for styleguide adhesion 👍
Great catch, thanks.
I'm open to it, but it's kind of breaking new ground, since I don't think updateproject or arches-admin/etc. manage python dependencies, e.g. installing the dev dependencies. I'd like to get some more input here, and would suggest to not block this work on it. Another wrinkle is that folks might choose to
agree 👍
Yep, I'll raise a PR to the creating-a-development-environment section, especially if we end up not auto-installing dev dependencies. |
Yeah that's fair and a good point. As long as there's solid documentation around this then I'm good to move forward without that bit of logic 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm! Great feature to have and thanks for implementing it 💯
Of course, thanks for the review! Next stop: forum |
Types of changes
Description of Change
Hand-formatting code is a drain on team productivity:
This PR adds
prettier
to format the frontend. Run it withyarn prettier:fix
.It also adds a GitHub action that fails PRs without formatting. A hint is given:
Of course, that's a last resort, as pull request time is too late to get the real benefit. We can socialize the knowledge to enable either "format on save" in VS Code or install a pre-commit hook (update: included here).
Demonstration
Sample changes that would be made in other pending work:
1e794537629b6d
Issues Solved
Closes #10575
Checklist
Ticket Background