UNPKG

2.27 kBMarkdownView Raw
1![GitHub CI - Publish to NPM](https://github.com/leanupjs/leanup/workflows/GitHub%20CI%20-%20Publish%20to%20NPM/badge.svg)
2[![dependencies][dependencies]][dependencies-url]
3[![vulnerabilities][vulnerabilities]][vulnerabilities-url]
4[![npm][npm]][npm-url]
5[![downloads][downloads]][downloads-url]
6[![install-size][install-size]][install-size-url]
7[![lernajs][lernajs]][lernajs-url]
8[![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
9
10[npm]: https://img.shields.io/npm/v/@leanup/git-hooks
11[npm-url]: https://www.npmjs.com/package/@leanup/git-hooks
12[dependencies]: https://status.david-dm.org/gh/leanupjs/leanup.svg?path=packages/cli/plugins/addons&ref=release/1.1
13[dependencies-url]: https://david-dm.org/leanupjs/leanup?path=packages/cli/plugins/addons&ref=release/1.1
14[vulnerabilities]: https://snyk.io/test/npm/@leanup/git-hooks/badge.svg
15[vulnerabilities-url]: https://snyk.io/test/npm/@leanup/git-hooks
16[downloads]: https://img.shields.io/npm/dm/@leanup/git-hooks
17[downloads-url]: https://npmcharts.com/compare/@leanup/git-hooks?minimal=true
18[install-size]: https://packagephobia.now.sh/badge?p=@leanup/git-hooks@next
19[install-size-url]: https://packagephobia.now.sh/result?p=@leanup/git-hooks@next
20[lernajs]: https://img.shields.io/badge/managed%20with-lerna-blueviolet
21[lernajs-url]: https://lerna.js.org
22
23# `@leanup/git-hooks`
24
25This module contains some nice tools to organize git hooks for NodeJs projects.
26
27## Installation
28
29`npm install @leanup/git-hooks --save-dev`
30
31## Configuration
32
33Add the following configuration to you `package.json`:
34
35```json
36{
37 ...
38 "husky": {
39 "hooks": {
40 "pre-commit": "lint-staged",
41 "commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
42 }
43 },
44 "lint-staged": {
45 "{src,tests}/**/*.{html,js,json,jsx,ts,tsx,gql,graphql}": [
46 "eslint"
47 ],
48 "{src,tests}/**": [
49 "prettier --check"
50 ]
51 },
52 ...
53}
54```
55
56After that create a commitlint configuration file `commitlint.config.js` in your project folder and insert the following code:
57
58```js
59module.exports = require('@leanup/git-hooks/commitlint.config');
60```
61
62## References
63
64- https://commitlint.js.org
65- https://github.com/typicode/husky
66- https://github.com/okonet/lint-staged