Skip to content

Commit 530db80

Browse files
filipw01escapedcat
authored andcommitted
refctor: update plugin-naming.ts (#4114)
1 parent 4b204ec commit 530db80

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

@commitlint/load/src/utils/plugin-naming.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import path from 'path';
22

33
// largely adapted from eslint's plugin system
4-
const NAMESPACE_REGEX = /^@.*\//iu;
4+
const NAMESPACE_REGEX = /^@.*\//u;
55
// In eslint this is a parameter - we don't need to support the extra options
66
const prefix = 'commitlint-plugin';
77

@@ -40,7 +40,7 @@ export function normalizePackageName(name: string) {
4040
`^(@[^/]+)(?:/(?:${prefix})?)?$`,
4141
'u'
4242
),
43-
scopedPackageNameRegex = new RegExp(`^${prefix}(-|$)`, 'u');
43+
scopedPackageNameRegex = new RegExp(`^${prefix}(?:-|$)`, 'u');
4444

4545
if (scopedPackageShortcutRegex.test(normalizedName)) {
4646
normalizedName = normalizedName.replace(
@@ -94,7 +94,7 @@ export function getShorthandName(fullname: string) {
9494
* @returns {string} The namepace of the term if it has one.
9595
*/
9696
export function getNamespaceFromTerm(term: string) {
97-
const match = term.match(NAMESPACE_REGEX);
97+
const match = NAMESPACE_REGEX.exec(term);
9898

9999
return match ? match[0] : '';
100100
}

0 commit comments

Comments
 (0)