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

Chore: Commitizen and lint-staged/prettier are not working in the correct order. #1410

Closed
tannerlinsley opened this issue Jul 26, 2019 · 6 comments

Comments

@tannerlinsley
Copy link
Collaborator

@larrybotha Would love a second pair of eyes on this.

@larrybotha
Copy link
Contributor

What's happening?

This is what should happen:

  • make changes
  • stage changes
  • npm run commit
  • enter commit details via prompts
  • pre-commit hook runs after details are entered, processing files, and adding changed files to commit

@tannerlinsley
Copy link
Collaborator Author

tannerlinsley commented Jul 26, 2019 via email

@larrybotha
Copy link
Contributor

Working for me:

960

Do you have a different workflow that is resulting in something unexpected?

@tannerlinsley
Copy link
Collaborator Author

Hmm. I see now. Here's what I'm thinking, let me know you're thoughts:

  • I'd like to enforce commitizen, using something like the pre-commit hook
  • I want to make it obvious and easy what's going on for users who use something like the Github app or the Fork app

How would we do that?

I started trying to set that up and that's when the formatting and staging order got switched around?

@larrybotha
Copy link
Contributor

hmmm ye, you can add

	'prepare-commit-msg': 'exec < /dev/tty && git cz --hook'`

to .huskyrc.js, but it creates problems with GUIs because they may not have an interactive terminal (exec < /dev/tty) - I tried fixing a merge conflict using SourceTree now and it rejected the commit.

Looks like it doesn't work on Windows, either: commitizen/cz-cli#627

Probably better to reject a commit message if it doesn't follow a specific convention; something like commitlint is likely the best way to do that:

https://github.com/conventional-changelog/commitlint

@tannerlinsley
Copy link
Collaborator Author

Yeah, that's probably best.

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

No branches or pull requests

2 participants