chore: add eslint-plugin-regexp#1123
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
📝 WalkthroughWalkthroughThe PR adds the eslint-plugin-regexp package (dependencies and devDependencies), enables it in .oxlintrc.json and knip.ts, and introduces a large set of RegExp linting rules. It also applies multiple small regex refinements across the codebase: converting unnecessary capturing groups to non‑capturing ones, tightening or simplifying character-class patterns, adjusting frontmatter delimiters to allow trailing horizontal whitespace, and a minor change to an HTML style-attribute strip pattern. Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 1✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
server/utils/docs/text.ts (2)
101-113:⚠️ Potential issue | 🟡 MinorAllow trailing spaces after the fenced info string.
According to the CommonMark specification, trailing spaces after the language identifier are valid and should be trimmed by the parser. The current regex pattern requires an immediate newline after the captured language token, so code fences with trailing spaces—which are valid Markdown—won't be detected.
🔧 Suggested fix
- /```[ \t]*(\w*)(?:\r\n|\r|\n)([\s\S]*?)(?:\r\n|\r|\n)?```/g, + /```[ \t]*(\w*)[ \t]*(?:\r\n|\r|\n)([\s\S]*?)(?:\r\n|\r|\n)?```/g,
70-89:⚠️ Potential issue | 🟠 MajorMulti-word link labels fail to match the regex pattern.
The label pattern
[^\s}]*forbids spaces, so{@linkhttps://example.com Example Site}won't match and will remain as escaped text in the output. The test "should handle external URLs with labels" in the test suite expects this case to work.🔧 Suggested fix
- result = result.replace(/\{`@link`\s+([^\s}]+)(?:\s+([^\s}]*))?\}/g, (_, target, label) => { - const displayText = label || target + result = result.replace(/\{`@link`\s+([^\s}]+)(?:\s+([^}]*))?\}/g, (_, target, label) => { + const displayText = (label && label.trim()) || target
https://github.com/ota-meshi/eslint-plugin-regexp