-
Notifications
You must be signed in to change notification settings - Fork 933
docs: add instructions for pre-commit #2715
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
Conversation
Hey @pkoch , thanks for your PR! You can add documentation here: |
@pkoch can I be a pain and ask you to put it under a new main header "Integrations". This will help me out for a couple of features on the roadmap Example of the new header fromhttps://github.com/conventional-changelog/commitlint/blob/master/README.md#contents ...
|
Sorry for the radio silence, folks. I'll document this better soon. I'm having a problem with pre-commit, where it tries to install |
Here's the output:
pre-commit installs things with the line you can see on the output above ( Because this project (
|
For my own reference, here's the
|
I tried to force pre-commit to use node 14.17.5, but that version doesn't have darwin-arm64 builds, so I can't test it. :/ |
just add |
Yep, that solved it! 🎉 But, a new challenger appears.
This is getting weirder and weirder, all over being forced to install the dev dependencies. Maybe we should just continue to use @alessandrojcm's repo, or even ask pre-commit maintainers to add this to the mirrors they build? |
(we should still probably commit the |
Replaced yarn with Got to this:
Which I got around with For reference, here's what pre-commit install procedure looks like: https://github.com/pre-commit/pre-commit/blob/509e4e20e86b5db48bc827753dcdfcdbbd706812/pre_commit/languages/node.py#L99 I feels like I'm taking non-trivial steps with this PR. Guidance would be appreciated. |
So, I kept banging with my head on this, and got to a working config that doesn't need anything on this repo: repos:
- repo: local
hooks:
- id: commitlint
name: commitlint
stages: [commit-msg]
language: node
additional_dependencies:
- "commitlint"
- "@commitlint/config-conventional"
entry: commitlint --edit Using a local hook feels a bit inelegant, but it's effective. Perhaps a doc-only change is actually enough? |
Updated the top-post to match the new change. Looking for reviews! :) |
🎉 thanks for not giving up :) |
Sorry, I'm not ready to merge. Just realized that this doesn't update the versions. 🤦 |
Waiting for pre-commit/pre-commit-mirror-maker#101 to get in, in order to provide a more pleasant experience. I think the next step will be to convince you folks to have a separate repo following the style of https://github.com/pre-commit/mirrors-prettier. The secret sauce is that it'll autonomously update itself to follow the main repo. However, it'll be a non-dev dependency, so we'll side-step all the issues I ran into (like needing yarn). Thank you all for your patience and help so far! :) |
@pkoch, thank you for the effort you have put into this. It's greatly appreciated. I see that the pull request you linked has been closed, so I'm curious if there is another upstream PR in progress or in general what work would be needed to support this hook? |
That PR still needs follow-up work, which I haven't been able to find the time for. To unblock delivering value on this, the easiest way would be to use an external repo like https://github.com/alessandrojcm/commitlint-pre-commit-hook for now. Maybe we should adapt the instructions in the README and merge it? |
I'm a big fan of iterative improvements in open-source especially. Doesn't stop anyone from making it better after all. I'm not affiliated with commitlint though, so that's just my personal opinion. |
Something is not ok with the current recommendation. I followed it and I still get some very weird behavior from pre-commit, basically it runs twice, once passes and once fails with an exception:
If you can point me to a repository where this works it would be awesome as I am trying to get rid of husky as having both husky and pre-commit inside the same repo is a bit of a PITA. |
The example lists commitlint as a dependency, and those belong in the repo that defines the hook. Not sure whether that will solve your problem, but it seems worth a try if you haven't already. |
@ssbarnea Pretty sure this is a stages problem. Can you tell me if this note helps?
|
Sorry, folks, but I'm not finding the right time in my life to invest in here. I'd rather be honest about it and close this for now. :/ |
Hey @pkoch , no worries! Take care! |
Add support for pre-commit.
Description
Added a configuration that works for me to the docs.
Motivation and Context
I wanted to use conventional-changelog/commitlint with pre-commit.
Usage examples
Doesn't apply, it's a doc change.
How Has This Been Tested?
Used this file as a
.pre-commit-config.yaml
:And tried it out:
Types of changes
Non of the above. It's a doc only change.
Checklist: