-
Notifications
You must be signed in to change notification settings - Fork 22.6k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
fix(ci): fix URL RXs in linters #38540
base: main
Are you sure you want to change the base?
Conversation
@@ -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}( "|[\)])`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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]}( "|[\)])`), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...getLocations(content, `[(]#${urlParts[1]}( "|[\)])`), | |
...getLocations(content, `\\(#${urlParts[1]}(?: "|\\))`), |
@@ -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", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"searchPattern": "/\\[[^\\]]*?\\]\\(([^ )\n\",:])+?([\n,:\"]| \\w| [\"'][^\"']+?[\"'][^)])/gm", | |
"searchPattern": "/\\[.*?\\]\\([^ )\\n\",:]+(?:[\\n\",:]| [^\"']| [\"'].+?[\"'][^)])/gm", |
Slightly simpler ([x][^x]+?[x]
is equivalent to [x].+?[x]
)
Issues
#stack_and_execution_contexts
when## Stack
header is changed to##Stack and execution contexts
.[abcd efg](/en-us/abcd "desc")
Solution
${fragment}( "|[\)])
.[\"'][^\"']+?[\"'][^)]
.