-
Notifications
You must be signed in to change notification settings - Fork 0
/
commitlint.config.js
29 lines (27 loc) · 1015 Bytes
/
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
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'scope-enum': () => {
const { readdirSync, statSync } = require('fs');
const projectPath = 'projects';
const projectDirs = readdirSync(projectPath).filter(directory =>
statSync(`${projectPath}/${directory}`).isDirectory(),
);
const topPath = '.';
const topLevelDirs = readdirSync(topPath).filter(directory =>
statSync(`${directory}`).isDirectory(),
).filter(directory => {
const isNodeModules = directory === 'node_modules';
const startsWithDot = directory[0] === '.';
return !(startsWithDot || isNodeModules);
});
const validScopeNames = [...projectDirs, ...topLevelDirs];
return [2, 'always', validScopeNames];
},
'type-enum': () => {
const [level, applicable, types] =
require('@commitlint/config-conventional').rules['type-enum'];
return [level, applicable, [...types, 'deprecate']];
},
},
};