From 41b607ef3a33921fcc018a963bb12ac8c987c316 Mon Sep 17 00:00:00 2001 From: OnkarRuikar <87750369+OnkarRuikar@users.noreply.github.com> Date: Sun, 9 Mar 2025 11:00:04 +0530 Subject: [PATCH 1/2] fix(ci): fix URL RXs in linters --- .markdownlint.jsonc | 2 +- scripts/log-url-issues.js | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.markdownlint.jsonc b/.markdownlint.jsonc index 9d25f924cbc63f8..645e14abb643b20 100644 --- a/.markdownlint.jsonc +++ b/.markdownlint.jsonc @@ -208,7 +208,7 @@ { "name": "un-closed-md-link", "message": "Missing closing bracket ')'", - "searchPattern": "/(\\[[^\\]]*?\\]\\(([^\\)\\n]|\\([^\\)\\n]\\)|\\s[\"'])+?)(\\n|\\s|[,:][\\s\\n])/gm", + "searchPattern": "/\\[[^\\]]*?\\]\\(([^ )\n\",:])+?([\n,:\"]| \\w| [\"'][^\"']+?[\"'][^)])/gm", "searchScope": "text", }, { diff --git a/scripts/log-url-issues.js b/scripts/log-url-issues.js index 61d26f7df85c26c..a59731df710156e 100644 --- a/scripts/log-url-issues.js +++ b/scripts/log-url-issues.js @@ -189,11 +189,13 @@ for await (const filePath of walkSync(rootDir)) { // check broken URL fragment for (const fragment of deletedFragmentDetails) { - const locations = getLocations(content, fragment); + const locations = getLocations(content, `${fragment}( "|[\)])`); // check fragments in the same file const urlParts = fragment.split("#"); if (filePath.includes(`${urlParts[0]}/index.md`)) { - locations.push(...getLocations(content, `[(]#${urlParts[1]}`)); + locations.push( + ...getLocations(content, `[(]#${urlParts[1]}( "|[\)])`), + ); } if (locations.length) { isAllOk = false; From bc4128c6e129bba8854bbd47d5d4ca0715062a76 Mon Sep 17 00:00:00 2001 From: Onkar Khadangale <87750369+OnkarRuikar@users.noreply.github.com> Date: Mon, 10 Mar 2025 11:09:22 +0530 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Joshua Chen --- .markdownlint.jsonc | 2 +- scripts/log-url-issues.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.markdownlint.jsonc b/.markdownlint.jsonc index 645e14abb643b20..ad27c6d9d369fec 100644 --- a/.markdownlint.jsonc +++ b/.markdownlint.jsonc @@ -208,7 +208,7 @@ { "name": "un-closed-md-link", "message": "Missing closing bracket ')'", - "searchPattern": "/\\[[^\\]]*?\\]\\(([^ )\n\",:])+?([\n,:\"]| \\w| [\"'][^\"']+?[\"'][^)])/gm", + "searchPattern": "/\\[.*?\\]\\([^ )\\n\",:]+(?:[\\n\",:]| [^\"']| [\"'].+?[\"'][^)])/gm", "searchScope": "text", }, { diff --git a/scripts/log-url-issues.js b/scripts/log-url-issues.js index a59731df710156e..59429c026dc753c 100644 --- a/scripts/log-url-issues.js +++ b/scripts/log-url-issues.js @@ -189,12 +189,12 @@ for await (const filePath of walkSync(rootDir)) { // check broken URL fragment for (const fragment of deletedFragmentDetails) { - const locations = getLocations(content, `${fragment}( "|[\)])`); + const locations = getLocations(content, `${fragment}(?: "|\\))`); // check fragments in the same file const urlParts = fragment.split("#"); if (filePath.includes(`${urlParts[0]}/index.md`)) { locations.push( - ...getLocations(content, `[(]#${urlParts[1]}( "|[\)])`), + ...getLocations(content, `\\(#${urlParts[1]}(?: "|\\))`), ); } if (locations.length) {