forked from core-ds/core-components
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommitlint.config.js
More file actions
35 lines (27 loc) · 939 Bytes
/
commitlint.config.js
File metadata and controls
35 lines (27 loc) · 939 Bytes
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
// @ts-check
/* eslint-disable @typescript-eslint/no-var-requires */
const { RuleConfigSeverity } = require('@commitlint/types');
const assert = require('node:assert/strict');
const { getPackages } = require('./tools/monorepo.cjs');
const CORE_COMPONENTS_REGEXP = /^@alfalab\/core-components-/;
function getScopes() {
const { packages } = getPackages();
return packages.map(({ packageJson: { name } }) => {
if (name === '@alfalab/core-components') {
return 'root';
}
assert(CORE_COMPONENTS_REGEXP.test(name), name);
return name.replace(CORE_COMPONENTS_REGEXP, '');
});
}
/**
* @type {import('@commitlint/types').UserConfig}
*/
const config = {
extends: '@alfalab/lint-preset/commitlint',
rules: {
'scope-empty': [RuleConfigSeverity.Disabled],
'scope-enum': () => [RuleConfigSeverity.Error, 'always', getScopes()],
},
};
module.exports = config;