-
Notifications
You must be signed in to change notification settings - Fork 2k
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 Husky for pre-commit formatting hooks #17625
Conversation
Might be worth looking at combining this with https://www.npmjs.com/package/lint-staged so that descrete actions can be hooked depending on the file type. EX: https://github.com/w3c/aria-practices/blob/6aaf4d48fc690a9d5ddbfbec32cfc7f15a16dd40/package.json#L63-L74 |
That's the eventual plan! Edit: actually, we might as well add |
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.
You can also do some cool triggers on individual files if you need to run regeneration when a schema changes
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
node node_modules/.bin/lint-staged |
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.
Think this is a little friendly for cross platform. I think only Windows does the .bin
or maybe I have that reversed
node node_modules/.bin/lint-staged | |
npx lint-staged |
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.
Let's ask in the next owner's meeting about pre-commit hooks. I'm not against it per se, just want to make sure the majority appreciates these ergonomics. Also, might be nice to mention this in the contribution docs if we introduce them.
MDN content just landed this, so let's land this here as well! |
This PR adds
husky
as a dependency for pre-commit hooks to format all of the files before creating a commit.