docs(repo): stop multi-@example rendering from inserting duplicate commas#9204
Conversation
… comma The "Examples" catch-all replacement joined values by splitting the captured group on every space, which broke apart example values with internal spaces (e.g. array literals like `["/orgs/:slug", "/orgs/:slug/(.*)"]`) and rejoined them with ", ", producing a `,,`. This surfaced in the generated `AuthenticateRequestOptions` / `ClerkMiddlewareOptions` reference tables. Now joins the backtick-delimited examples directly, preserving each value's internal spacing. Adds a regression test. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: d4576d1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 0 packagesWhen changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
@clerk/astro
@clerk/backend
@clerk/chrome-extension
@clerk/clerk-js
@clerk/electron
@clerk/electron-passkeys
@clerk/eslint-plugin
@clerk/expo
@clerk/expo-google-signin
@clerk/expo-passkeys
@clerk/express
@clerk/fastify
@clerk/hono
@clerk/localizations
@clerk/nextjs
@clerk/nuxt
@clerk/react
@clerk/react-router
@clerk/shared
@clerk/tanstack-react-start
@clerk/testing
@clerk/ui
@clerk/upgrade
@clerk/vue
commit: |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🔗 Linked repositories identifiedCodeRabbit considers these linked repositories for cross-repo context during reviews:
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe Typedoc catch-all replacement now extracts complete backtick-delimited Estimated code review effort: 2 (Simple) | ~10 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Comment |
There was a problem hiding this comment.
I think we can do an empty changeset? Since this does not change the backend at all 👍🏼
The fix only touches the generated-docs tooling (.typedoc/custom-plugin.mjs), not @clerk/backend runtime code, so it shouldn't trigger a package version bump.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Pushed a small change directly in f323fc9.
|
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Description
Discovered when reviewing the latest Typedoc generated PR
Problem
The Typedoc custom plugin's "Examples" replacement rule joined multiple
@examplevalues by splitting the captured text on every space and rejoining with,. When an example value contained internal spaces — e.g. an array literal like["/orgs/:slug", "/orgs/:slug/(.*)"]— it got broken apart and stitched back together with extra commas, producing a duplicate,,in the generated docs.Where:
.typedoc/custom-plugin.mjs→getCatchAllReplacements(), the**Examples**rule (~line 395).Fix
Instead of splitting on spaces, it now matches each backtick-delimited example (
/`[^`]+`/g) and joins those directly with,, preserving internal spaces.Generated-output-only change; no runtime behavior is affected. The two implementations are identical for every space-free example value — the only outputs that change are the ones that were already broken.
How to test
Unit (fast):
pnpm exec vitest run .typedoc/__tests__/catch-all-replacements.test.tsThe regression case asserts an array-literal example round-trips without a spurious comma.
End-to-end (regenerates docs):
Then check the two affected output files — search for the
Examples:line on theorganizationPatterns/personalAccountPatternsoptions:.typedoc/docs/backend/authenticate-request-options.mdx.typedoc/docs/nextjs/clerk-middleware-options.mdxBefore:
Examples: `["/orgs/:slug",, "/orgs/:slug/(.*)"]`, …After:
Examples: `["/orgs/:slug", "/orgs/:slug/(.*)"]`, …Changes
.typedoc/custom-plugin.mjs— the one-line logic fix (plus an explanatory comment).typedoc/__tests__/catch-all-replacements.test.ts— new test file with 3 cases: single example, multiple examples, and a regression test for examples with internal spaces.changeset/typedoc-multi-example-double-comma.md— empty changeset (tooling-only change; no published package is affected)Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change