Skip to content

Commit

Permalink
Update plugin-naming.ts (#4114)
Browse files Browse the repository at this point in the history
  • Loading branch information
filipw01 authored Aug 7, 2024
1 parent 4b204ec commit 2fc6db1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions @commitlint/load/src/utils/plugin-naming.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import path from 'path';

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

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

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

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

0 comments on commit 2fc6db1

Please sign in to comment.