conventional-changelog / conventional-changelog/commitlint
Support the Pre-Commit framework with a .pre-commit-hooks.yaml file
- Dominant language
- TypeScript
- Stars
- 18.7k
- Forks
- 970
- Avg merge
- 7h 33m
- Merged PRs (30d)
- 49
Description
## ~~Expected Behavior~~ Question/Feature request
This is more a blatant question and feature request:
Would a basic config for the [pre-commit](https://pre-commit.com) framework be possible, and if so, even desired for the repo to have?
It would be implemented by having a `.pre-commit-hooks.yaml` file in the root of the repo, that pre-commit can be pointed at in other projects to implement commit linting.
## Possible Solution
Adding a `.pre-commit-hooks.yaml` to the project to be able to be used by the pre-commit tool simply. A number of projects, such as Prettier and Python's Black provide such files to allow the tool to be transparently installed and run as git hooks.
- Prettier's [`.pre-commit-hooks.yaml`](https://github.com/prettier/prettier/blob/master/.pre-commit-hooks.yaml)
- Black's [`.pre-commit-hooks.yaml`](https://github.com/psf/black/blob/master/.pre-commit-hooks.yaml)
## Context
[Pre-commit](https://pre-commit.com/) is a tool for declaratively managing git hooks in a repo, not unlike husky.
The major difference is that pre-commit manages pulling down and transparently installing the tools itself, regardless of language, allowing projects to use software that don't necessarily suit being a part of a project's dependencies.
Many projects provide a `.pre-commit-hooks.yaml` themselves, for just this reason.
While Husky is the gold standard in the JS world, it's not ideal for multi-language projects, as you either need to set up a dedicated package.json in the root of the repository, or even less elegantly, configure it just in sub-folder, like`frontend/` for example. I believe commit linting is such a powerful tool, that anything we can do to make it more widespread is a big win, and would lead to wider spread adoption outside of just javascript environments.
Incidentally, I have run across a small [repo that achieves just this](https://github.com/alessandrojcm/commitlint-pre-commit-hook), though a first party equivalent would be a much healthier signal.
Contributor guide
Assessment
This issue has not been assessed yet.