Skip to content
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

Setup Husky and lint-stage for commit fixing #23308

Merged
merged 1 commit into from Mar 27, 2023

Conversation

nschonni
Copy link
Contributor

For those developing locally, it will trying and autoformat code during the commit process to ease failures before they hit CI.
This could probably work with the Ruby files as it is just a generic git hook, but I'm less confident in what the accepted tooling/paramters would be for that

@github-actions
Copy link
Contributor

github-actions bot commented Feb 1, 2023

This pull request has merge conflicts that must be resolved before it can be merged.

@renchap
Copy link
Sponsor Member

renchap commented Feb 10, 2023

lint-staged works fine for Ruby as well in my experience.

I have a local setup where I use it for Rubocop and prettier-ruby without any issues. Once Rubocop runs fine on all the repo, what would be blocking to enable it there as well?

@nschonni
Copy link
Contributor Author

Added the additional glob so Prettier gets called on the CSS/SCSS files to match the changes in #23558

@github-actions
Copy link
Contributor

This pull request has merge conflicts that must be resolved before it can be merged.

@github-actions
Copy link
Contributor

This pull request has merge conflicts that must be resolved before it can be merged.

@github-actions
Copy link
Contributor

This pull request has merge conflicts that must be resolved before it can be merged.

@nschonni
Copy link
Contributor Author

Updated now that ESLint is checking JSX files, and moved the prettier run for all files, since things that shouldn't get touched are covered by the .prettierignore now.
I could add a call to bundle exec rubocop -a for the *.{rb,rake} or leave that for a later thing

@renchap
Copy link
Sponsor Member

renchap commented Feb 20, 2023

I think adding Rubocop as well is a good idea overall, so +1 on this from me!

@github-actions
Copy link
Contributor

github-actions bot commented Mar 8, 2023

This pull request has merge conflicts that must be resolved before it can be merged.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 8, 2023

This pull request has resolved merge conflicts and is ready for review.

@github-actions
Copy link
Contributor

This pull request has merge conflicts that must be resolved before it can be merged.

@github-actions
Copy link
Contributor

This pull request has resolved merge conflicts and is ready for review.

@github-actions
Copy link
Contributor

This pull request has merge conflicts that must be resolved before it can be merged.

@github-actions
Copy link
Contributor

This pull request has resolved merge conflicts and is ready for review.

@github-actions
Copy link
Contributor

This pull request has merge conflicts that must be resolved before it can be merged.

@github-actions
Copy link
Contributor

This pull request has resolved merge conflicts and is ready for review.

@nschonni
Copy link
Contributor Author

@Gargron are you interested in this one, or should I close it?

@Gargron Gargron merged commit 34225d7 into mastodon:main Mar 27, 2023
33 checks passed
@nschonni nschonni deleted the husky-stup branch March 27, 2023 03:24
@neatchee
Copy link

neatchee commented Mar 27, 2023

@Gargron @nschonni This needs a bugfix...
When yarn is used for dependencies, npx should not be used for lint-staged
Instead we need to install lint-staged via yarn and change the husky script to use yarn instead of npx

Bug: #24286

@nschonni
Copy link
Contributor Author

Didn't think that would be an issue since NPX ships with Node, but I've submitted #24287 to swap it to Yarn

neatchee pushed a commit to neatchee/mastodon that referenced this pull request Mar 27, 2023
@neatchee
Copy link

Didn't think that would be an issue since NPX ships with Node, but I've submitted #24287 to swap it to Yarn

I wouldn't have guessed it was a problem either, but it threw errors for me and research showed this was a known problem elsewhere 🤷

neatchee pushed a commit to neatchee/mastodon that referenced this pull request Mar 28, 2023
arachnist pushed a commit to arachnist/mastodon that referenced this pull request Apr 4, 2023
skerit pushed a commit to 11ways/mastodon that referenced this pull request Jul 7, 2023
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.

None yet

4 participants