From 1a9405b0bc2deaa7af3369c656d7fb9e243d9ce0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leosvel=20P=C3=A9rez=20Espinosa?= Date: Wed, 18 Jun 2025 19:36:14 +0200 Subject: [PATCH] chore(repo): fix the regex to validate commits (#31630) ## Current Behavior The string regex the script uses to validate commits is not correctly escaped. ## Expected Behavior The string regex the script uses to validate commits should be correctly escaped. --- scripts/commit-lint.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/commit-lint.js b/scripts/commit-lint.js index 8bfd3c5570..c9881f54dc 100755 --- a/scripts/commit-lint.js +++ b/scripts/commit-lint.js @@ -43,7 +43,7 @@ if (!gitMessage) { const allowedTypes = types.map((type) => type.value).join('|'); const allowedScopes = scopes.map((scope) => scope.value).join('|'); -const commitMsgRegex = `(${allowedTypes})\\((${allowedScopes})\\)!?:\\s(([a-z0-9:\-\s])+)`; +const commitMsgRegex = `(${allowedTypes})\\((${allowedScopes})\\)!?:\\s(([a-z0-9:\\-\\s])+)`; const matchCommit = new RegExp(commitMsgRegex, 'g').test(gitMessage); const matchRevert = /Revert/gi.test(gitMessage);