-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcommitlint.config.ts
39 lines (35 loc) · 1.2 KB
/
commitlint.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
const englishOnly = /^[A-Za-z0-9\s!@#$%^&*(),.?":{}|<>_-]+$/;
// https://commitlint.js.org/reference/configuration.html#typescript-configuration
import { RuleConfigSeverity, type UserConfig } from '@commitlint/types';
const Configuration: UserConfig = {
extends: ['@commitlint/config-conventional'],
// parserPreset: '',
// formatter: '',
// https://commitlint.js.org/reference/plugins.html#working-with-plugins
plugins: [
{
rules: {
'subject-english-only': ({ subject }) => {
if (!subject) return [true, ''];
const valid = englishOnly.test(subject);
return [valid, 'Commit subject must contain only English characters'];
},
},
},
],
rules: {
// https://commitlint.js.org/reference/rules.html
'type-empty': [RuleConfigSeverity.Error, 'never'],
'subject-empty': [RuleConfigSeverity.Error, 'never'],
'subject-max-length': [RuleConfigSeverity.Error, 'always', 50],
'scope-max-length': [RuleConfigSeverity.Error, 'always', 20],
// custom rules
'subject-english-only': [RuleConfigSeverity.Error, 'always'],
},
prompt: {
settings: {},
messages: {},
questions: {},
},
};
export default Configuration;