@astral/commitlint-config 2.3.0 → 2.5.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +7 -3
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -16,7 +16,7 @@ const DEFAULT_TYPE_ENUM = [
|
|
|
16
16
|
* Создает commitlint config
|
|
17
17
|
* @param {Object} params - Параметры инициализации конфига.
|
|
18
18
|
* @param {string[]} [params.scopes=[]] - Список доступных scopes.
|
|
19
|
-
* @param {string} params.ticketPrefix - Название префикса задач, данный префикс будет доступен в scope.
|
|
19
|
+
* @param {string} params.ticketPrefix - Название префикса или список названий префиксов задач, данный префикс будет доступен в scope.
|
|
20
20
|
* @param {string[]} [params.typeEnum=[]] - Список доступных type.
|
|
21
21
|
* @example
|
|
22
22
|
* // createConfig({ scopes: ['server', 'ui'], ticketPrefix: 'UIKIT' })
|
|
@@ -63,13 +63,17 @@ const createConfig = ({
|
|
|
63
63
|
2,
|
|
64
64
|
'always',
|
|
65
65
|
({ scope }) => {
|
|
66
|
-
const
|
|
66
|
+
const ticketPrefixes = Array.isArray(ticketPrefix) ? ticketPrefix : [ticketPrefix];
|
|
67
|
+
|
|
68
|
+
const isTicketScope = ticketPrefixes.some((prefix) => scope?.startsWith(`${prefix}-`))
|
|
67
69
|
|
|
68
70
|
if (!scope || scopes.includes(scope) || isTicketScope) {
|
|
69
71
|
return [true];
|
|
70
72
|
}
|
|
71
73
|
|
|
72
|
-
const
|
|
74
|
+
const formattedTickets = ticketPrefixes.map((ticket) =>`${ticket}-XXXX`);
|
|
75
|
+
|
|
76
|
+
const scopesEnumsMessage = [...scopes, ...formattedTickets].join(
|
|
73
77
|
', ',
|
|
74
78
|
);
|
|
75
79
|
|