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

Pre commit auto prettier #1477

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

eoghanmurray
Copy link
Contributor

@eoghanmurray eoghanmurray commented May 15, 2024

After you run git commit -m "message", the hook kicks in and runs prettier --write against all files going into the commit (so long as there's no conflicts against the unstaged changes).

See Option 4 here: https://prettier.io/docs/en/precommit.html#option-4-git-format-stagedhttpsgithubcomhallettjgit-format-staged

And a blog post with further info https://www.olioapps.com/blog/automatic-code-formatting

Copy link

changeset-bot bot commented May 15, 2024

🦋 Changeset detected

Latest commit: eee9037

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 8 packages
Name Type
rrweb-snapshot Patch
rrweb Patch
rrdom Patch
rrdom-nodejs Patch
rrweb-player Patch
@rrweb/types Patch
@rrweb/web-extension Patch
rrvideo Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@Juice10
Copy link
Contributor

Juice10 commented May 16, 2024

See Option 4 here: https://prettier.io/docs/en/precommit.html#option-4-git-format-stagedhttpsgithubcomhallettjgit-format-staged

Looks like you went with part of Option 1 here, why didn't you go for lint-staged in the end?

.changeset/odd-items-watch.md Outdated Show resolved Hide resolved
packages/rrweb-snapshot/src/utils.ts Outdated Show resolved Hide resolved
@eoghanmurray
Copy link
Contributor Author

Looks like you went with part of Option 1 here, why didn't you go for lint-staged in the end?

I didn't really see it; let's try that out first before merging this.

@billyvg
Copy link
Contributor

billyvg commented May 21, 2024

I usually use lint-staged + husky for my projects and have been pretty happy with it (though I do see the benefits of git-format-staged w/ partially staged files)

@eoghanmurray eoghanmurray marked this pull request as draft May 22, 2024 11:55
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