-
Notifications
You must be signed in to change notification settings - Fork 15
/
commitlint.config.js
33 lines (32 loc) · 1.07 KB
/
commitlint.config.js
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
import config from '@commitlint/config-conventional';
import nxScopes from '@commitlint/config-nx-scopes';
import { RuleConfigSeverity } from '@commitlint/types';
/** @type {import('@commitlint/types').UserConfig} */
export default {
extends: ['@commitlint/config-conventional'],
plugins: ['commitlint-plugin-tense'],
rules: {
'scope-enum': async ctx => {
const projects = nxScopes.utils.getProjects(
ctx,
({ projectType }) =>
projectType === 'library' || projectType === 'application',
);
const scopes = [...projects, 'tools', 'workflows', 'testing'].sort();
return [RuleConfigSeverity.Error, 'always', scopes];
},
'type-enum': () => {
const defaultTypes = config.rules['type-enum'][2];
const types = [
...defaultTypes,
'release', // custom type for release commits
];
return [RuleConfigSeverity.Error, 'always', types];
},
'tense/subject-tense': [
RuleConfigSeverity.Error,
'always',
{ firstOnly: true, allowedTenses: ['present-imperative'] },
],
},
};