├── .versionrc.json
├── CHANGELOG.md
├── LICENSE
├── README.md
├── appveyor.yml
├── index.js
└── lib
├── config.js
├── cz-config.js
├── scopes.js
└── types.js
/.versionrc.json:
--------------------------------------------------------------------------------
1 | {
2 | "types" : [
3 | {
4 | "type" : "build",
5 | "section": "Build System",
6 | "hidden" : false
7 | },
8 | {
9 | "type" : "ci",
10 | "section": "Continuous Integration",
11 | "hidden" : false
12 | },
13 | {
14 | "type" : "feat",
15 | "section": "Features",
16 | "hidden" : false
17 | },
18 | {
19 | "type" : "fix",
20 | "section": "Bug Fixes",
21 | "hidden" : false
22 | },
23 | {
24 | "type" : "docs",
25 | "section": "Documentation Changes",
26 | "hidden" : false
27 | },
28 | {
29 | "type" : "style",
30 | "section": "Code Style Changes",
31 | "hidden" : false
32 | },
33 | {
34 | "type" : "refactor",
35 | "section": "Code Refactoring",
36 | "hidden" : false
37 | },
38 | {
39 | "type" : "perf",
40 | "section": "Performance Improvements",
41 | "hidden" : false
42 | },
43 | {
44 | "type" : "test",
45 | "section": "Tests",
46 | "hidden" : false
47 | },
48 | {
49 | "type" : "chore",
50 | "hidden": true
51 | },
52 | {
53 | "type" : "revert",
54 | "section": "Reverts",
55 | "hidden" : false
56 | },
57 | {
58 | "type" : "release",
59 | "hidden": true
60 | }
61 | ],
62 | "releaseCommitMessageFormat": "release: {{currentTag}}"
63 | }
64 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4 |
5 | ### [0.13.3](https://github.com/whizark/commitlint-config-cz/compare/v0.13.1...v0.13.3) (2021-12-20)
6 |
7 |
8 | ### Build System
9 |
10 | * [security] bump hosted-git-info from 2.7.1 to 2.8.9 ([c526430](https://github.com/whizark/commitlint-config-cz/commit/c52643079539ed78f01eb1ba2c896a2ccf819ed7))
11 | * [security] bump ini from 1.3.5 to 1.3.8 ([e753839](https://github.com/whizark/commitlint-config-cz/commit/e753839e1d92fb3b0ed637b231144e0f4c11b274))
12 | * [security] bump y18n from 4.0.0 to 4.0.3 ([81d216e](https://github.com/whizark/commitlint-config-cz/commit/81d216e1c00f1ec09d83b639bb236eb7e0206d40))
13 | * fix low severity vulnerabilities ([63320b8](https://github.com/whizark/commitlint-config-cz/commit/63320b85b827fa216cc3adb0513db4ce1b03ee6e))
14 | * fix vulnerable dependencies ([fd61a18](https://github.com/whizark/commitlint-config-cz/commit/fd61a18e68b022f871fca205a9f0c014fd6b9d8a))
15 | * remove peerDependencies ([d697c58](https://github.com/whizark/commitlint-config-cz/commit/d697c58e6b84097c884c20d3f2472aeb943ba6fc)), closes [#70](https://github.com/whizark/commitlint-config-cz/issues/70)
16 | * update dependencies ([164bd1a](https://github.com/whizark/commitlint-config-cz/commit/164bd1a862a521eee9601cbc5beaaeac062d876e))
17 | * update dependency @commitlint/cli to v13 ([05d8320](https://github.com/whizark/commitlint-config-cz/commit/05d832040fc6086aef14a283aa01431d5a65bdac))
18 | * update dependency @commitlint/cli to v9 ([72df7e9](https://github.com/whizark/commitlint-config-cz/commit/72df7e95b6fa52683c6a1f40a9313794abd43f53))
19 | * update dependency coveralls to v3.1.0 ([ea93232](https://github.com/whizark/commitlint-config-cz/commit/ea9323227a982212b1051a69fd05250ea1b79468))
20 | * update dependency mocha to v7.1.2 ([ddea362](https://github.com/whizark/commitlint-config-cz/commit/ddea3629b5549067ee8d0d837a9f48918e12ac61))
21 | * update dependency mocha to v7.2.0 ([4e7c113](https://github.com/whizark/commitlint-config-cz/commit/4e7c11353ab98904b32c7cdffddf191e7977e227))
22 | * update dependency mocha to v8 ([716d5a1](https://github.com/whizark/commitlint-config-cz/commit/716d5a13a35f535b3bbbf0edbab8fb51d7cf3568))
23 | * update dependency mocha to v8.1.1 ([2d84aca](https://github.com/whizark/commitlint-config-cz/commit/2d84aca93e7480d43ae30e867c7b961a39f4a478))
24 | * update dependency mocha to v8.1.2 ([92f46b1](https://github.com/whizark/commitlint-config-cz/commit/92f46b1eb21e3dfb5dabcb2b4939c1ec915c7c66))
25 | * update dependency mocha to v8.1.3 ([07dcc94](https://github.com/whizark/commitlint-config-cz/commit/07dcc946f0b9139d626a5f3af6e937c7ae4a8d28))
26 | * update dependency mocha to v8.2.1 ([8b7f890](https://github.com/whizark/commitlint-config-cz/commit/8b7f890cfcef627a8448394bbc51d5aa3235a00a))
27 | * update dependency mocha to v8.4.0 ([b92c1a3](https://github.com/whizark/commitlint-config-cz/commit/b92c1a3c078f3a3e9eb44f957e79232bf77d61b8))
28 | * update dependency nyc to v15.0.1 ([2770243](https://github.com/whizark/commitlint-config-cz/commit/277024358b63f075830530857b8a88b7265f5036))
29 | * update dependency nyc to v15.1.0 ([7fe075c](https://github.com/whizark/commitlint-config-cz/commit/7fe075c533bd54a7263eb1b8d871a1f85b43b295))
30 | * update dependency standard-version to v8 ([51b1378](https://github.com/whizark/commitlint-config-cz/commit/51b13783075f9aa81a056fe4dc8ef542fc040b5a))
31 | * update dependency standard-version to v8.0.1 [security] ([99ab240](https://github.com/whizark/commitlint-config-cz/commit/99ab2401ee71f68db6f6c364615541b62cd74f40))
32 | * update dependency standard-version to v9 ([10535f4](https://github.com/whizark/commitlint-config-cz/commit/10535f44dafdd3c702fb8c96972e7ea38e4b64fa))
33 | * update dependency standard-version to v9.3.2 ([c67fa48](https://github.com/whizark/commitlint-config-cz/commit/c67fa48f6460e2a9ec7b9bf5ffabc1baf00983d3))
34 |
35 | ### [0.13.2](https://github.com/whizark/commitlint-config-cz/compare/v0.13.1...v0.13.2) (2020-08-20)
36 |
37 |
38 | ### Build System
39 |
40 | * fix low severity vulnerabilities ([63320b8](https://github.com/whizark/commitlint-config-cz/commit/63320b85b827fa216cc3adb0513db4ce1b03ee6e))
41 | * update dependency @commitlint/cli to v9 ([72df7e9](https://github.com/whizark/commitlint-config-cz/commit/72df7e95b6fa52683c6a1f40a9313794abd43f53))
42 | * update dependency coveralls to v3.1.0 ([ea93232](https://github.com/whizark/commitlint-config-cz/commit/ea9323227a982212b1051a69fd05250ea1b79468))
43 | * update dependency mocha to v7.1.2 ([ddea362](https://github.com/whizark/commitlint-config-cz/commit/ddea3629b5549067ee8d0d837a9f48918e12ac61))
44 | * update dependency mocha to v7.2.0 ([4e7c113](https://github.com/whizark/commitlint-config-cz/commit/4e7c11353ab98904b32c7cdffddf191e7977e227))
45 | * update dependency mocha to v8 ([716d5a1](https://github.com/whizark/commitlint-config-cz/commit/716d5a13a35f535b3bbbf0edbab8fb51d7cf3568))
46 | * update dependency mocha to v8.1.1 ([2d84aca](https://github.com/whizark/commitlint-config-cz/commit/2d84aca93e7480d43ae30e867c7b961a39f4a478))
47 | * update dependency nyc to v15.0.1 ([2770243](https://github.com/whizark/commitlint-config-cz/commit/277024358b63f075830530857b8a88b7265f5036))
48 | * update dependency nyc to v15.1.0 ([7fe075c](https://github.com/whizark/commitlint-config-cz/commit/7fe075c533bd54a7263eb1b8d871a1f85b43b295))
49 | * update dependency standard-version to v8 ([51b1378](https://github.com/whizark/commitlint-config-cz/commit/51b13783075f9aa81a056fe4dc8ef542fc040b5a))
50 | * update dependency standard-version to v8.0.1 [security] ([99ab240](https://github.com/whizark/commitlint-config-cz/commit/99ab2401ee71f68db6f6c364615541b62cd74f40))
51 | * update dependency standard-version to v9 ([10535f4](https://github.com/whizark/commitlint-config-cz/commit/10535f44dafdd3c702fb8c96972e7ea38e4b64fa))
52 |
53 | ### [0.13.1](https://github.com/whizark/commitlint-config-cz/compare/v0.13.0...v0.13.1) (2020-03-19)
54 |
55 |
56 | ### Build System
57 |
58 | * [security] bump acorn from 5.7.3 to 5.7.4 ([8e664fa](https://github.com/whizark/commitlint-config-cz/commit/8e664faf1b6c3b3ee0564b28b4cdbe5417ae696f))
59 | * add standard-version config ([741d3b4](https://github.com/whizark/commitlint-config-cz/commit/741d3b4606e81e64595d9ef97b69feac32fb5e71))
60 | * update dependency coveralls to v3.0.11 ([fefe423](https://github.com/whizark/commitlint-config-cz/commit/fefe42311cb56b8047b7c94df69709d88ba1e239))
61 | * update dependency mocha to v7.1.0 ([519f65a](https://github.com/whizark/commitlint-config-cz/commit/519f65aaceb0b8a68e14dec92f71806ca0fb9d05))
62 | * update dependency mocha to v7.1.1 ([8e895d5](https://github.com/whizark/commitlint-config-cz/commit/8e895d5e3fdebe495d261cb13fbbc7dfe431ecb1))
63 | * update minimist to 1.2.5 to fix low severity vulnerabilities ([74a4066](https://github.com/whizark/commitlint-config-cz/commit/74a4066ce10d0d9aeff851e224e0b4dd11be3f3b))
64 |
65 | ## [0.13.0](https://github.com/whizark/commitlint-config-cz/compare/v0.12.1...v0.13.0) (2020-02-03)
66 |
67 |
68 | ### ⚠ BREAKING CHANGES
69 |
70 | * Node.js 8 support has been dropped due to EOL.
71 |
72 | ### Bug Fixes
73 |
74 | * update dependency app-root-path to v3 ([be58d72](https://github.com/whizark/commitlint-config-cz/commit/be58d729909daf7dcd250ee6db20f919da7deae9))
75 |
76 |
77 | ### ci
78 |
79 | * drop Node.js 8 support ([b8c5b82](https://github.com/whizark/commitlint-config-cz/commit/b8c5b829325a072805bc143d3d8ca1c56cf3d321))
80 |
81 | ### [0.12.1](https://github.com/whizark/commitlint-config-cz/compare/v0.12.0...v0.12.1) (2019-08-04)
82 |
83 |
84 | # [0.12.0](https://github.com/whizark/commitlint-config-cz/compare/v0.11.1...v0.12.0) (2019-06-16)
85 |
86 |
87 | ### Bug Fixes
88 |
89 | * **deps:** update dependency app-root-path to ~2.2.0 ([8f06c50](https://github.com/whizark/commitlint-config-cz/commit/8f06c50))
90 |
91 |
92 | ### ci
93 |
94 | * drop Node 6 support, add Node 12 ([04c106d](https://github.com/whizark/commitlint-config-cz/commit/04c106d))
95 |
96 |
97 | ### BREAKING CHANGES
98 |
99 | * Node 6 support has been dropped due to EOL.
100 |
101 |
102 |
103 |
104 | ## [0.11.1](https://github.com/whizark/commitlint-config-cz/compare/v0.11.0...v0.11.1) (2019-01-10)
105 |
106 |
107 | ### Bug Fixes
108 |
109 | * **peer-deps:** update peerDep [@commitlint](https://github.com/commitlint)/cli from 7.0.x to 7.x.x ([2d61d1d](https://github.com/whizark/commitlint-config-cz/commit/2d61d1d)) (sharvit)
110 |
111 |
112 |
113 |
114 | # [0.11.0](https://github.com/whizark/commitlint-config-cz/compare/v0.10.1...v0.11.0) (2018-12-24)
115 |
116 |
117 | ### Features
118 |
119 | * support `config.cz-customizable.config` entry in `package.json` ([753036d](https://github.com/whizark/commitlint-config-cz/commit/753036d)) (zman)
120 |
121 |
122 |
123 |
124 | ## [0.10.1](https://github.com/whizark/commitlint-config-cz/compare/v0.10.0...v0.10.1) (2018-08-23)
125 |
126 |
127 | ### Bug Fixes
128 |
129 | * error is thrown if there's no scope-{enum,type} rule at all ([1dc784e](https://github.com/whizark/commitlint-config-cz/commit/1dc784e)), closes [#3](https://github.com/whizark/commitlint-config-cz/issues/3)
130 |
131 |
132 |
133 |
134 | ## 0.10.0 (2018-06-22)
135 |
136 | * bump version to 0.10.0 ([13c0ea7](https://github.com/whizark/commitlint-config-cz/commit/13c0ea7))
137 | * update @commitlint/cli to 7.0.0 ([673019c](https://github.com/whizark/commitlint-config-cz/commit/673019c))
138 | * update dev dependencies ([f0af131](https://github.com/whizark/commitlint-config-cz/commit/f0af131))
139 |
140 |
141 |
142 |
143 | ## 0.9.0 (2018-05-25)
144 |
145 | * add Node 10 for Travis CI ([017c594](https://github.com/whizark/commitlint-config-cz/commit/017c594))
146 | * bump version to 0.9.0 ([b44d6bf](https://github.com/whizark/commitlint-config-cz/commit/b44d6bf))
147 | * drop Node 4, 7 support ([942a85b](https://github.com/whizark/commitlint-config-cz/commit/942a85b))
148 | * remove Node 4/7, add 9/10 for Appveyor ([c0ba1af](https://github.com/whizark/commitlint-config-cz/commit/c0ba1af))
149 | * support @commitlint/cli 6.2.0 ([5800d7b](https://github.com/whizark/commitlint-config-cz/commit/5800d7b))
150 | * update dev dependencies ([c072db5](https://github.com/whizark/commitlint-config-cz/commit/c072db5))
151 | * use `npm update` with `--no-save` on Travis CI ([c2b1dfd](https://github.com/whizark/commitlint-config-cz/commit/c2b1dfd)), closes [#1](https://github.com/whizark/commitlint-config-cz/issues/1)
152 |
153 |
154 |
155 |
156 | ## 0.8.0 (2018-02-23)
157 |
158 | * add Node 9 for Travis CI ([e69a2b8](https://github.com/whizark/commitlint-config-cz/commit/e69a2b8))
159 | * bump version to 0.8.0 ([a70eb3e](https://github.com/whizark/commitlint-config-cz/commit/a70eb3e))
160 | * update commitlint to 6.1.2 ([2d91607](https://github.com/whizark/commitlint-config-cz/commit/2d91607))
161 | * update dev dependencies ([d970a21](https://github.com/whizark/commitlint-config-cz/commit/d970a21))
162 | * update dev dependency ([a516fe3](https://github.com/whizark/commitlint-config-cz/commit/a516fe3))
163 |
164 |
165 |
166 |
167 | ## 0.7.0 (2017-11-05)
168 |
169 | * add description about config conversion feature ([58c0827](https://github.com/whizark/commitlint-config-cz/commit/58c0827))
170 | * add docs for Modules & API ([c3ef3f4](https://github.com/whizark/commitlint-config-cz/commit/c3ef3f4))
171 | * add JSDoc to API functions ([4ea7d9f](https://github.com/whizark/commitlint-config-cz/commit/4ea7d9f))
172 | * add new module & API for config conversion ([1b387f2](https://github.com/whizark/commitlint-config-cz/commit/1b387f2)), closes [#2](https://github.com/whizark/commitlint-config-cz/issues/2)
173 | * add summary to Module & API section ([94bfeff](https://github.com/whizark/commitlint-config-cz/commit/94bfeff))
174 | * bump version to 0.7.0 ([c37afef](https://github.com/whizark/commitlint-config-cz/commit/c37afef))
175 | * fix config.js description ([6b78802](https://github.com/whizark/commitlint-config-cz/commit/6b78802))
176 | * make language of fenced code block consistent ([2cb6e3c](https://github.com/whizark/commitlint-config-cz/commit/2cb6e3c))
177 | * refactor variable name to clarify config for cz-customizable ([887ab40](https://github.com/whizark/commitlint-config-cz/commit/887ab40))
178 | * refactor variable names in test ([2b0f25a](https://github.com/whizark/commitlint-config-cz/commit/2b0f25a))
179 | * remove default rules except for `type-enum`, `scope-enum` ([749122c](https://github.com/whizark/commitlint-config-cz/commit/749122c))
180 | * remove NLP-related rules ([9feaf18](https://github.com/whizark/commitlint-config-cz/commit/9feaf18))
181 |
182 |
183 | ### BREAKING CHANGE
184 |
185 | * Now commitlint-config-cz provides only `type-enum`,
186 | `scope-enum` rules by the default.
187 | In case that you need other rules, you may override other config with
188 | commitlint-config-cz rules.
189 |
190 | ```js
191 | module.exports = {
192 | extends: [
193 | 'other-config',
194 | 'cz'
195 | ]
196 | };
197 | ```
198 |
199 |
200 |
201 | ## 0.6.0 (2017-11-04)
202 |
203 | * bump version to 0.6.0 ([24ab6fb](https://github.com/whizark/commitlint-config-cz/commit/24ab6fb))
204 | * change case options to kebab-case ([e9cfdeb](https://github.com/whizark/commitlint-config-cz/commit/e9cfdeb))
205 | * update commitlint to 4.2.2 ([e8e7f01](https://github.com/whizark/commitlint-config-cz/commit/e8e7f01))
206 | * update dev dependencies ([770f553](https://github.com/whizark/commitlint-config-cz/commit/770f553))
207 |
208 |
209 |
210 |
211 | ## 0.5.0 (2017-08-10)
212 |
213 | * add new `signed-off-by` rule ([3740ff0](https://github.com/whizark/commitlint-config-cz/commit/3740ff0))
214 | * bump version to 0.5.0 ([29aaf59](https://github.com/whizark/commitlint-config-cz/commit/29aaf59))
215 | * fix incorrect config example in README.md ([cc0a092](https://github.com/whizark/commitlint-config-cz/commit/cc0a092))
216 | * update @commitlint/cli to 3.1.2 ([7f1c5ef](https://github.com/whizark/commitlint-config-cz/commit/7f1c5ef))
217 | * update dev dependencies ([dc2bede](https://github.com/whizark/commitlint-config-cz/commit/dc2bede))
218 |
219 |
220 |
221 |
222 | ## 0.4.0 (2017-07-20)
223 |
224 | * add `commitlint-config` to `keywords` in package.json ([c5bd3bc](https://github.com/whizark/commitlint-config-cz/commit/c5bd3bc))
225 | * add Node.js 8 for Travis CI, AppVeyor ([be33db7](https://github.com/whizark/commitlint-config-cz/commit/be33db7))
226 | * bump version to 0.4.0 ([1a7e708](https://github.com/whizark/commitlint-config-cz/commit/1a7e708))
227 | * fix incorrect config file name in README.md ([8f54a8e](https://github.com/whizark/commitlint-config-cz/commit/8f54a8e))
228 | * remove `npm prune` from CI build ([461199d](https://github.com/whizark/commitlint-config-cz/commit/461199d)), closes [#17797](https://github.com/whizark/commitlint-config-cz/issues/17797)
229 | * remove `wildcards` entry ([4f5fc4b](https://github.com/whizark/commitlint-config-cz/commit/4f5fc4b))
230 | * replace conventional-changelog-lint to commitlint ([a078090](https://github.com/whizark/commitlint-config-cz/commit/a078090))
231 | * update `conventional-changelog-lint` as `peerDependencies` ([8babbee](https://github.com/whizark/commitlint-config-cz/commit/8babbee))
232 | * update dev dependencies ([c5b6834](https://github.com/whizark/commitlint-config-cz/commit/c5b6834))
233 | * update notification setting for Slack ([0d0d6ae](https://github.com/whizark/commitlint-config-cz/commit/0d0d6ae))
234 | * update npm API key ([a6f2d20](https://github.com/whizark/commitlint-config-cz/commit/a6f2d20))
235 | * use `npm install` until `npm update` issue is resolved ([5f309db](https://github.com/whizark/commitlint-config-cz/commit/5f309db))
236 |
237 |
238 |
239 |
240 | ## 0.3.0 (2017-04-04)
241 |
242 | * bump version to 0.3.0 ([201fa10](https://github.com/whizark/commitlint-config-cz/commit/201fa10))
243 | * turn the severities of `{body,footer}-tense` rules into warning ([c56dd22](https://github.com/whizark/commitlint-config-cz/commit/c56dd22))
244 | * update dependencies ([a6e1bc6](https://github.com/whizark/commitlint-config-cz/commit/a6e1bc6))
245 |
246 |
247 |
248 |
249 | ## 0.2.0 (2016-12-10)
250 |
251 | * add AppVeyor badge to README.md ([e21720c](https://github.com/whizark/commitlint-config-cz/commit/e21720c))
252 | * add AppVeyor config ([b204b3d](https://github.com/whizark/commitlint-config-cz/commit/b204b3d))
253 | * bump version to 0.2.0 ([07be0a1](https://github.com/whizark/commitlint-config-cz/commit/07be0a1))
254 | * disable shallow clone for AppVeyor ([b1be017](https://github.com/whizark/commitlint-config-cz/commit/b1be017))
255 | * explicitly update npm to the latest version in `.travis.yml` ([f381be7](https://github.com/whizark/commitlint-config-cz/commit/f381be7))
256 | * make the default value for `type-enum` rule empty ([7f2c386](https://github.com/whizark/commitlint-config-cz/commit/7f2c386))
257 | * use `--save-dev` rather than `--save` for installation ([db18896](https://github.com/whizark/commitlint-config-cz/commit/db18896))
258 |
259 |
260 |
261 |
262 | ## 0.1.1 (2016-12-02)
263 |
264 | * add coveralls badge to README.md ([f5e8f42](https://github.com/whizark/commitlint-config-cz/commit/f5e8f42))
265 | * add tests ([643475d](https://github.com/whizark/commitlint-config-cz/commit/643475d))
266 | * bump version to 0.1.1 ([3d75584](https://github.com/whizark/commitlint-config-cz/commit/3d75584))
267 | * export `cz-config.js` loader function ([978990a](https://github.com/whizark/commitlint-config-cz/commit/978990a))
268 | * export default types, scopes ([bfd5946](https://github.com/whizark/commitlint-config-cz/commit/bfd5946))
269 | * fix issue that `.cz-config.js` isn't load ([aa38aa7](https://github.com/whizark/commitlint-config-cz/commit/aa38aa7))
270 | * fix issue that `scopeOverrides` is never merged ([d0b2aee](https://github.com/whizark/commitlint-config-cz/commit/d0b2aee))
271 | * fix issue that scopes is always empty ([8fbd0dd](https://github.com/whizark/commitlint-config-cz/commit/8fbd0dd))
272 | * fix repo name in `.travis.yml` for deploy ([afba42d](https://github.com/whizark/commitlint-config-cz/commit/afba42d))
273 | * silently run npm scripts ([1010a33](https://github.com/whizark/commitlint-config-cz/commit/1010a33))
274 |
275 |
276 |
277 |
278 | ## 0.1.0 (2016-12-01)
279 |
280 | * add .travis.yml for Travis CI ([1211226](https://github.com/whizark/commitlint-config-cz/commit/1211226))
281 | * add `perf` as a default type ([895787b](https://github.com/whizark/commitlint-config-cz/commit/895787b))
282 | * add config files ([18645c4](https://github.com/whizark/commitlint-config-cz/commit/18645c4))
283 | * add initial package files ([dba6dfe](https://github.com/whizark/commitlint-config-cz/commit/dba6dfe))
284 | * add introduction to README.md ([9a31514](https://github.com/whizark/commitlint-config-cz/commit/9a31514))
285 | * bump version to 0.1.0 ([5d3fd7a](https://github.com/whizark/commitlint-config-cz/commit/5d3fd7a))
286 | * fix broken installation test ([403c261](https://github.com/whizark/commitlint-config-cz/commit/403c261))
287 | * fix incorrect copyright year ([43d7d48](https://github.com/whizark/commitlint-config-cz/commit/43d7d48))
288 | * fix incorrect usage explanation ([dabab61](https://github.com/whizark/commitlint-config-cz/commit/dabab61))
289 | * improve `wildcards` messages for merge and pull request ([edd9eb2](https://github.com/whizark/commitlint-config-cz/commit/edd9eb2))
290 | * prepare repository ([4a8b8ab](https://github.com/whizark/commitlint-config-cz/commit/4a8b8ab))
291 | * remove `release` from `wildcards` ([d5b2204](https://github.com/whizark/commitlint-config-cz/commit/d5b2204))
292 | * rename repo/package name to `conventional-changelog-lint-config-cz` ([50883d3](https://github.com/whizark/commitlint-config-cz/commit/50883d3))
293 | * use latest `conventional-changelog-lint` as devDependencies ([18ea8fb](https://github.com/whizark/commitlint-config-cz/commit/18ea8fb))
294 | * use reference for link to `conventional-changelog-lint` ([cc9341a](https://github.com/whizark/commitlint-config-cz/commit/cc9341a))
295 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2016 Whizark
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # commitlint-config-cz
2 |
3 | [![npm][npm-image]][npm-url]
4 | [![Build Status][travis-image]][travis-url]
5 | [![Build status][appveyor-image]][appveyor-url]
6 | [![Coverage Status][coveralls-image]][coveralls-url]
7 |
8 | [commitlint][] sharable configuration files for [cz-customizable][]
9 | (customizable [Commitizen][commitizen] adapter for [conventional commits][conventional-commits] and [conventional changelog][conventional-changelog]).
10 |
11 | You can now **consistently manage your commit types/scopes** for cz-customizable and commitlint **in one place**.
12 |
13 | commitlint-config-cz **merges** `{types,scopes,scopeOverrides}` (cz-customizable config) with
14 | `rules.{type-enum,scope-enum}` (commitlint config) and **includes some modules and API** for config conversion.
15 |
16 | ## Supported Config
17 |
18 | commitlint-config-cz use only one config in the following order of precedence.
19 |
20 | 1. [`config.cz-customizable.config`][cz-customizable-configure] in `package.json`.
21 | 2. `.cz-config.js` in your package root (supported by cz-customizable).
22 |
23 | ## Installation
24 |
25 | 1. [Install & setup (commitizen &) cz-customizable.][cz-customizable]
26 | 2. [Install commitlint.][commitlint-getting-started]
27 | 3. Install `commitlint-config-cz` as a local dependency.
28 |
29 | ```sh
30 | npm install commitlint-config-cz --save-dev
31 | ```
32 |
33 | ## Usage
34 |
35 | Extend your commitlint config by `cz` in `commitlint.config.js`.
36 |
37 | ```js
38 | module.exports = {
39 | extends: [
40 | 'other-config',
41 | 'cz'
42 | ]
43 | };
44 | ```
45 |
46 | ## Modules & API
47 |
48 | commitlint-config-cz includes some modules and API for config conversion.
49 |
50 | ### `config.js`
51 |
52 | Gets the converted commitlint config from the cz-customizable config which is defined in `package.json` or `.cz-config.js` in your package root.
53 |
54 | ```js
55 | const config = require('commitlint-config-cz/lib/config')();
56 | ````
57 |
58 | #### `get(pathOrCzConfig: string | Object, defaultConfig?: Object): Object`
59 |
60 | Gets the commitlint config from a path to config file.
61 |
62 | ```js
63 | const getConfig = require('commitlint-config-cz/lib/config').get;
64 |
65 | // From a path.
66 | const config = getConfig('path/to/.cz-config.js');
67 | ````
68 |
69 | ```js
70 | const getConfig = require('commitlint-config-cz/lib/config').get;
71 | const czConfig = { /* `cz-customizable` config object. */ };
72 |
73 | // From a `cz-customizable` config object.
74 | const config = getConfig(czConfig);
75 | ````
76 |
77 | ```js
78 | const getConfig = require('commitlint-config-cz/lib/config').get;
79 | const czConfig = { /* `cz-customizable` config object. */ };
80 | const defaultConfig = { // The default `commitlint` config.
81 | rules: {
82 | 'scope-enum': [ // rule
83 | 2, // [1] level
84 | 'always', // [2] applicability
85 | [], // [3] value
86 | ],
87 | 'type-enum' : [ // rule
88 | 2, // [1] level
89 | 'always', // [2] applicability
90 | [], // [3] value
91 | ],
92 | },
93 | };
94 |
95 | // Converts and merges the `cz-customizable` config with the default `commitlint` config.
96 | const config = getConfig(czConfig, defaultConfig);
97 | ````
98 |
99 | 1. If cz-customizable config has `scopes`, `scopeOverrides` or `types` field,
100 | the value(s) [3] of the default commitlint config is/are **REPLACED** by converted value(s).
101 | Level [1] and applicability [2] remain as they are.
102 | 2. `scope-enum` rule or/and `type-enum` rule is/are **REMOVED**, if its value is an empty array.
103 |
104 | ---
105 |
106 | ### `cz-config.js`
107 |
108 | Gets the cz-customizable config as an object from `package.json` or `.cz-config.js` in your package root.
109 |
110 | ```js
111 | const czConfig = require('commitlint-config-cz/lib/cz-config')();
112 | ````
113 |
114 | #### `get(path: string): Object`
115 |
116 | Gets the cz-customizable config as an object from a path.
117 |
118 | ```js
119 | const getCzConfig = require('commitlint-config-cz/lib/cz-config').get;
120 |
121 | const czConfig = getCzConfig('path/to/.cz-config.js');
122 | ````
123 |
124 | ---
125 |
126 | ### `scopes.js`
127 |
128 | Gets the value for [scope-enum][] rule from `package.json` or `.cz-config.js` in your package root.
129 |
130 | ```js
131 | const scopes = require('commitlint-config-cz/lib/scopes')();
132 | ````
133 |
134 | #### `get(czConfig: Object): string[]`
135 |
136 | Gets the value for [scope-enum][] rule from a cz-customizable config object.
137 |
138 | ```js
139 | const getScopes = require('commitlint-config-cz/lib/scopes').get;
140 | const czConfig = { /* cz-customizable config object. */ };
141 |
142 | const scopes = getScopes(czConfig);
143 | ````
144 |
145 | ---
146 |
147 | ### `types.js`
148 |
149 | Gets the value for [type-enum][] rule from `package.json` or `.cz-config.js` in your package root.
150 |
151 | ```js
152 | const types = require('commitlint-config-cz/lib/types')();
153 | ````
154 |
155 | #### `get(czConfig: Object): string[]`
156 |
157 | Gets the value for [type-enum][] rule from `package.json` or `cz-customizable` config object.
158 |
159 | ```js
160 | const getTypes = require('commitlint-config-cz/lib/types').get;
161 | const czConfig = { /* `cz-customizable` config object. */ };
162 |
163 | const types = getTypes(czConfig);
164 | ````
165 |
166 | [commitlint]: https://github.com/conventional-changelog/commitlint
167 | [commitlint-getting-started]: https://github.com/conventional-changelog/commitlint#getting-started
168 | [cz-customizable]: https://github.com/leonardoanalista/cz-customizable
169 | [commitizen]: https://github.com/commitizen/cz-cli
170 | [conventional-commits]: https://www.conventionalcommits.org
171 | [conventional-changelog]: https://github.com/conventional-changelog/conventional-changelog
172 | [cz-customizable-configure]: https://github.com/leonardoanalista/cz-customizable#configure
173 |
174 | [npm-image]: https://img.shields.io/npm/v/commitlint-config-cz.svg
175 | [npm-url]: https://www.npmjs.com/commitlint-config-cz
176 |
177 | [coveralls-image]: https://coveralls.io/repos/whizark/commitlint-config-cz/badge.svg?branch=master&service=github
178 | [coveralls-url]: https://coveralls.io/github/whizark/commitlint-config-cz?branch=master
179 |
180 | [travis-image]: https://travis-ci.org/whizark/commitlint-config-cz.svg?branch=master
181 | [travis-url]: https://travis-ci.org/whizark/commitlint-config-cz
182 |
183 | [appveyor-image]: https://ci.appveyor.com/api/projects/status/github/whizark/commitlint-config-cz?branch=master&svg=true
184 | [appveyor-url]: https://ci.appveyor.com/project/whizark/commitlint-config-cz/branch/master
185 |
186 | [scope-enum]: https://commitlint.js.org/#/reference-rules?id=scope-enum
187 | [type-enum]: https://commitlint.js.org/#/reference-rules?id=type-enum
188 |
--------------------------------------------------------------------------------
/appveyor.yml:
--------------------------------------------------------------------------------
1 | version: '{build}'
2 |
3 | clone_depth: 1
4 |
5 | environment:
6 | matrix:
7 | - nodejs_version: 12
8 | - nodejs_version: 14
9 | - nodejs_version: 16
10 | - nodejs_version: 17
11 |
12 | matrix:
13 | fast_finish: true
14 |
15 | cache:
16 | - '%APPDATA%\npm-cache'
17 |
18 | install:
19 | - ps: Install-Product node $env:nodejs_version
20 | - npm config set spin false
21 | - npm config set progress false
22 | - npm install -g npm@latest
23 | - npm ci
24 |
25 | build: off
26 |
27 | test_script:
28 | - node --version
29 | - npm --version
30 | - npm run ci:test
31 |
32 | notifications:
33 | - provider: Email
34 | on_build_success: false
35 | on_build_failure: false
36 | on_build_status_changed: false
37 |
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const config = require('./lib/config')();
4 |
5 | module.exports = config;
6 |
--------------------------------------------------------------------------------
/lib/config.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const cloneDeep = require('lodash.clonedeep');
4 | const CzConfig = require('./cz-config');
5 | const Scopes = require('./scopes');
6 | const Types = require('./types');
7 |
8 | const defaults = {
9 | rules: {
10 | 'scope-enum': [
11 | 2,
12 | 'always',
13 | [],
14 | ],
15 | 'type-enum' : [
16 | 2,
17 | 'always',
18 | [],
19 | ],
20 | },
21 | };
22 |
23 | /**
24 | * Gets the commitlint config converted from a cz-customizable config.
25 | *
26 | * @param {string|Object} pathOrCzConfig The path to a cz-customizable config file, or a cz-customizable config object.
27 | * @param {Object} defaultConfig The default commitlint config.
28 | *
29 | * @returns {Object} The converted commitlint config.
30 | */
31 | function get(pathOrCzConfig, defaultConfig) {
32 | const config = Object.assign(cloneDeep(defaults), cloneDeep(defaultConfig) || {});
33 |
34 | let czConfig = pathOrCzConfig || {};
35 |
36 | if (typeof pathOrCzConfig === 'string') {
37 | czConfig = CzConfig.get(pathOrCzConfig);
38 | }
39 |
40 | // Converts the `scopes` and `scopeOverrides` into `scope-enum` rule.
41 | const hasScopeEnum = Object.prototype.hasOwnProperty.call(config.rules, 'scope-enum');
42 |
43 | if (
44 | hasScopeEnum &&
45 | (typeof czConfig.scopes !== 'undefined' || typeof czConfig.scopeOverrides !== 'undefined')
46 | ) {
47 | config.rules['scope-enum'][2] = Scopes.get(czConfig);
48 | }
49 |
50 | // Removes empty `scope-enum` rule.
51 | if (hasScopeEnum && !config.rules['scope-enum'][2].length) {
52 | delete config.rules['scope-enum'];
53 | }
54 |
55 | // Converts the `types` into `type-enum` rule.
56 | const hasTypeEnum = Object.prototype.hasOwnProperty.call(config.rules, 'type-enum');
57 |
58 | if (hasTypeEnum && typeof czConfig.types !== 'undefined') {
59 | config.rules['type-enum'][2] = Types.get(czConfig);
60 | }
61 |
62 | // Removes empty `type-enum` rule.
63 | if (hasTypeEnum && !config.rules['type-enum'][2].length) {
64 | delete config.rules['type-enum'];
65 | }
66 |
67 | return config;
68 | }
69 |
70 | module.exports = () => get(CzConfig());
71 | module.exports.defaults = defaults;
72 | module.exports.get = get;
73 |
--------------------------------------------------------------------------------
/lib/cz-config.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const root = require('app-root-path');
4 | const path = require('path');
5 | const fs = require('fs');
6 |
7 | const pkgPath = path.join(root.path, 'package.json');
8 | const {config} = require(pkgPath);
9 |
10 | const CZ_CONFIG_NAME = '.cz-config.js';
11 |
12 | let czConfigPath = path.join(root.path, CZ_CONFIG_NAME);
13 |
14 | if (config && config['cz-customizable']) {
15 | const file = config['cz-customizable'].config;
16 |
17 | czConfigPath = path.join(root.path, file);
18 | }
19 |
20 | /**
21 | * Reads and gets the cz-customizable config from a path.
22 | *
23 | * @param {string} path The path to a cz-customizable config file.
24 | *
25 | * @returns {Object} The cz-customizable config.
26 | */
27 | function get(path) {
28 | let czConfig;
29 |
30 | try {
31 | fs.accessSync(path, fs.R_OK);
32 |
33 | czConfig = require(path);
34 | } catch (err) {
35 | czConfig = {};
36 | }
37 |
38 | return czConfig;
39 | }
40 |
41 | module.exports = () => get(czConfigPath);
42 | module.exports.get = get;
43 |
--------------------------------------------------------------------------------
/lib/scopes.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const czConfig = require('./cz-config')();
4 |
5 | const defaults = [];
6 |
7 | /**
8 | * Gets the `value` for `scope-enum` rule of commitlint config.
9 | *
10 | * @param {Object} czConfig A cz-customizable config.
11 | *
12 | * @returns {Object} The `value`.
13 | */
14 | function get(czConfig) {
15 | const scopes = [];
16 |
17 | if (typeof czConfig.scopes === 'undefined') {
18 | return defaults;
19 | }
20 |
21 | for (const scope of czConfig.scopes) {
22 | scopes.push(scope.name);
23 | }
24 |
25 | if (typeof czConfig.scopeOverrides === 'undefined') {
26 | return scopes;
27 | }
28 |
29 | for (const type of Object.keys(czConfig.scopeOverrides)) {
30 | for (const scope of czConfig.scopeOverrides[type]) {
31 | scopes.push(scope.name);
32 | }
33 | }
34 |
35 | return scopes.filter(function (value, index, scope) {
36 | return scope.indexOf(value) === index;
37 | });
38 | }
39 |
40 | module.exports = () => get(czConfig);
41 | module.exports.defaults = defaults;
42 | module.exports.get = get;
43 |
--------------------------------------------------------------------------------
/lib/types.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | const czConfig = require('./cz-config')();
4 |
5 | const defaults = [
6 | // 'feat',
7 | // 'fix',
8 | // 'docs',
9 | // 'style',
10 | // 'refactor',
11 | // 'perf',
12 | // 'test',
13 | // 'chore',
14 | // 'revert',
15 | ];
16 |
17 | /**
18 | * Gets the `value` for `type-enum` rule of commitlint config.
19 | *
20 | * @param {Object} czConfig A cz-customizable config.
21 | *
22 | * @returns {Object} The `value`.
23 | */
24 | function get(czConfig) {
25 | const types = [];
26 |
27 | if (typeof czConfig.types === 'undefined') {
28 | return defaults;
29 | }
30 |
31 | for (const type of czConfig.types) {
32 | types.push(type.value);
33 | }
34 |
35 | return types;
36 | }
37 |
38 | module.exports = () => get(czConfig);
39 | module.exports.defaults = defaults;
40 | module.exports.get = get;
41 |
--------------------------------------------------------------------------------