Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/alessandrojcm/commitlint-pre-commit-hook
A pre-commit hook for commitlint
https://github.com/alessandrojcm/commitlint-pre-commit-hook
hooks
Last synced: about 1 month ago
JSON representation
A pre-commit hook for commitlint
- Host: GitHub
- URL: https://github.com/alessandrojcm/commitlint-pre-commit-hook
- Owner: alessandrojcm
- License: mit
- Created: 2018-07-29T23:21:08.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-04-23T15:55:48.000Z (7 months ago)
- Last Synced: 2024-05-21T04:16:31.217Z (6 months ago)
- Topics: hooks
- Homepage:
- Size: 500 KB
- Stars: 143
- Watchers: 2
- Forks: 16
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Commitlint hook for pre-commit
## Configuration
* Create your `commitlint` config file in the repo's root, as explained in Commitlint [docs](https://commitlint.js.org/reference/configuration.html#configuration).
* Add the following to your `.pre-commit-config.yaml`:
```
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
rev:
hooks:
- id: commitlint
stages: [commit-msg]
```
* Add your [shared configurations](https://commitlint.js.org/reference/configuration.html#shareable-configuration) as a
dependency using the `additional_dependencies` parameter of the hooks, here we use the `@commitlint/config-angular`
as an example:
```
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
rev:
hooks:
- id: commitlint
stages: [commit-msg]
additional_dependencies: ['@commitlint/config-angular']
```
- Install the [`commit-msg`](https://pre-commit.com/#commit-msg) hook in your project repo:
```shell
pre-commit install --hook-type commit-msg
```
Note that you **need** to specify a shared configuration in order for `commitlint` to work, if `commitlint` is new to you
just use their default configuration (`@commitlint/config-conventional`). For more information, refer to their [docs](https://commitlint.js.org/guides/getting-started.html).### Usage in Travis CI
- Add the following to your `.pre-commit-config.yaml`:
```
- repo: https://github.com/alessandrojcm/commitlint-pre-commit-hook
rev:
hooks:
- id: commitlint-travis
stages: [manual]
```
- Add the following to your `.travis.yml`:
```
script:
- pip install pre-commit
- pre-commit run --hook-stage manual commitlint-travis
```