Skip to content

Commit c3c4866

Browse files
committed
chore: add commitlint configuration
1 parent ad6ce88 commit c3c4866

File tree

5 files changed

+727
-0
lines changed

5 files changed

+727
-0
lines changed

etc/commitlint/.commitlintrc.js

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2023 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
'use strict';
20+
21+
/* eslint-disable stdlib/jsdoc-leading-description-sentence */
22+
23+
/**
24+
* commitlint configuration.
25+
*
26+
* @namespace config
27+
*/
28+
var config = {};
29+
30+
/**
31+
* Commit message parser.
32+
*
33+
* @name parserPreset
34+
* @memberof config
35+
* @type {Object}
36+
*/
37+
config[ 'parserPreset' ] = require( './parser-preset' );
38+
39+
/**
40+
* Lint rules.
41+
*
42+
* @name rules
43+
* @memberof config
44+
* @type {Object}
45+
*/
46+
config[ 'rules' ] = require( './rules' );
47+
48+
/**
49+
* Prompt configuration.
50+
*
51+
* @name prompt
52+
* @memberof config
53+
* @type {Object}
54+
*/
55+
config[ 'prompt' ] = require( './prompt' );
56+
57+
58+
// EXPORTS //
59+
60+
module.exports = config;

etc/commitlint/README.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<!--
2+
3+
@license Apache-2.0
4+
5+
Copyright (c) 2023 The Stdlib Authors.
6+
7+
Licensed under the Apache License, Version 2.0 (the "License");
8+
you may not use this file except in compliance with the License.
9+
You may obtain a copy of the License at
10+
11+
http://www.apache.org/licenses/LICENSE-2.0
12+
13+
Unless required by applicable law or agreed to in writing, software
14+
distributed under the License is distributed on an "AS IS" BASIS,
15+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
See the License for the specific language governing permissions and
17+
limitations under the License.
18+
19+
-->
20+
21+
# commitlint
22+
23+
> [commitlint][commitlint] configuration.
24+
25+
<!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
26+
27+
<section class="intro">
28+
29+
This directory contains [commitlint][commitlint] configuration files.
30+
31+
</section>
32+
33+
<!-- /.intro -->
34+
35+
<!-- Section to include notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
36+
37+
<section class="notes">
38+
39+
</section>
40+
41+
<!-- /.notes -->
42+
43+
<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
44+
45+
<section class="links">
46+
47+
[commitlint]: https://github.com/conventional-changelog/commitlint#config
48+
49+
</section>
50+
51+
<!-- /.links -->
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2023 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
'use strict';
20+
21+
// MODULES //
22+
23+
var config = require( 'conventional-changelog-conventionalcommits' );
24+
25+
26+
// MAIN //
27+
28+
/**
29+
* Parser configuration.
30+
*
31+
* @name conf
32+
* @type {Object}
33+
*/
34+
var conf = config({
35+
// Define an array of prefixes used to detect references to issues:
36+
'issuePrefixes': [ '#' ]
37+
});
38+
39+
40+
// EXPORTS //
41+
42+
module.exports = conf;

etc/commitlint/prompt/index.js

Lines changed: 205 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,205 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2023 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
'use strict';
20+
21+
/**
22+
* Custom prompt configuration.
23+
*
24+
* @name config
25+
* @type {Object
26+
*/
27+
var config = {
28+
'questions': {}
29+
};
30+
31+
/**
32+
* Question for selecting the commit type.
33+
*
34+
* @name type
35+
* @memberof config.questions
36+
* @type {Object}
37+
*/
38+
config.questions[ 'type' ] = {
39+
'description': 'Select the type of change that you\'re committing',
40+
'enum': {
41+
'feat': {
42+
'description': 'A new feature',
43+
'title': 'Features',
44+
'emoji': '✨'
45+
},
46+
'fix': {
47+
'description': 'A bug fix, including changes to the behavior of existing features and including changes that remove or mitigate security vulnerabilities',
48+
'title': 'Bug Fixes',
49+
'emoji': '🐛'
50+
},
51+
'remove': {
52+
'description': 'A change that removes a feature',
53+
'title': 'Removed Features',
54+
'emoji': '🗑'
55+
},
56+
'deprecate': {
57+
'description': 'A change that deprecates an existing feature',
58+
'title': 'Deprecations',
59+
'emoji': '⚠️'
60+
},
61+
'perf': {
62+
'description': 'A change that improves performance',
63+
'title': 'Performance Improvements',
64+
'emoji': '🚀'
65+
},
66+
'docs': {
67+
'description': 'Documentation-only change, including READMEs, JSDoc/Doxygen-style comments, source comments, annotations, and examples (including examples files) and excluding TypeScript declarations',
68+
'title': 'Documentation',
69+
'emoji': '📚'
70+
},
71+
'test': {
72+
'description': 'Test-only change (e.g., adding missing tests or correcting existing tests)',
73+
'title': 'Tests',
74+
'emoji': '🚨'
75+
},
76+
'bench': {
77+
'description': 'Benchmark-only change (e.g., adding missing benchmarks or correcting existing benchmarks)',
78+
'title': 'Benchmarks',
79+
'emoji': '⏱'
80+
},
81+
'build': {
82+
'description': 'A change affecting how the project is built and released, including changes to automation and CI configuration files and scripts',
83+
'title': 'Build Changes',
84+
'emoji': '🛠'
85+
},
86+
'refactor': {
87+
'description': 'A change that is neither a fix nor a feature (i.e., a change which does not affect behavior as experienced by downstream consumers',
88+
'title': 'Code Refactoring',
89+
'emoji': '🚧'
90+
},
91+
'style': {
92+
'description': 'A change that improves code style (e.g., whitespace, formatting, semilcolons, etc) and does not affect the meaning of code',
93+
'title': 'Style Updates',
94+
'emoji': '💎'
95+
},
96+
'chore': {
97+
'description': 'A change that is neither a fix, a feature, nor a refactor (i.e., a repetitive mechanical task, such as updating package meta data or updating external dependencies)',
98+
'title': 'Chores',
99+
'emoji': '🧺'
100+
},
101+
'temp': {
102+
'description': 'A temporary, experimental, or exploratory change that is not intended to be permanent (e.g., as may be desired when debugging CI or when ad-hoc debugging on live systems)',
103+
'title': 'Temporary Changes',
104+
'emoji': '💡'
105+
},
106+
'revert': {
107+
'description': 'Reverts a previous commit',
108+
'title': 'Reverted Changes',
109+
'emoji': '♻️'
110+
}
111+
}
112+
};
113+
114+
/**
115+
* Question for providing a short description.
116+
*
117+
* @name subject
118+
* @memberof config.questions
119+
* @type {Object}
120+
*/
121+
config.questions[ 'subject' ] = {
122+
'description': 'Write a short description of the change using the imperative mood'
123+
};
124+
125+
/**
126+
* Question for providing a long description.
127+
*
128+
* @name body
129+
* @memberof config.questions
130+
* @type {Object}
131+
*/
132+
config.questions[ 'body' ] = {
133+
'description': 'Provide a longer description of the change'
134+
};
135+
136+
/**
137+
* Question for indicating whether a change is breaking.
138+
*
139+
* @name isBreaking
140+
* @memberof config.questions
141+
* @type {Object}
142+
*/
143+
config.questions[ 'isBreaking' ] = {
144+
'description': 'Are there any breaking changes?'
145+
};
146+
147+
/**
148+
* Question for providing a short summary of a breaking change.
149+
*
150+
* @name breaking
151+
* @memberof config.questions
152+
* @type {Object}
153+
*/
154+
config.questions[ 'breaking' ] = {
155+
'description': 'Write a short description of the breaking change'
156+
};
157+
158+
/**
159+
* Question for providing a longer description of a breaking change.
160+
*
161+
* @name breakingCode
162+
* @memberof config.questions
163+
* @type {Object}
164+
*/
165+
config.questions[ 'breakingCode' ] = {
166+
'description': 'A BREAKING CHANGE commit should typically include a detailed description and migration instructions. If applicable, please enter a longer description'
167+
};
168+
169+
/**
170+
* Question for providing a short summary of a breaking change.
171+
*
172+
* @name breaking
173+
* @memberof config.questions
174+
* @type {Object}
175+
*/
176+
config.questions[ 'breaking' ] = {
177+
'description': 'Write a short description of the breaking change'
178+
};
179+
180+
/**
181+
* Question for indicating whether a change affects any issues.
182+
*
183+
* @name isIssueAffected
184+
* @memberof config.questions
185+
* @type {Object}
186+
*/
187+
config.questions[ 'isIssueAffected' ] = {
188+
'description': 'Does this change affect any issues?'
189+
};
190+
191+
/**
192+
* Question for listing issue references.
193+
*
194+
* @name issues
195+
* @memberof config.questions
196+
* @type {Object}
197+
*/
198+
config.questions[ 'issues' ] = {
199+
'description': 'Please list affected issues (e.g., "fix #123", "close #456", etc)'
200+
};
201+
202+
203+
// EXPORTS //
204+
205+
module.exports = config;

0 commit comments

Comments
 (0)