Skip to content

Conversation

NWylynko
Copy link
Contributor

@NWylynko NWylynko commented Aug 13, 2025

Description

While reviewing clerk/clerk-docs#2488 came across regressions in the jsdocs this pr aims to resolve clerk/clerk-docs#2488 (comment) & clerk/clerk-docs#2488 (comment).

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Summary by CodeRabbit

  • Documentation
    • Improved API docs formatting: component names now shown as inline code.
    • Updated documentation link replacements for localization and subscription-item references; removed an outdated auto-replacement.
  • Refactor
    • Converted LocalizationResource from a type alias to an interface to improve generated docs and linking; no behavioral changes.

Copy link

changeset-bot bot commented Aug 13, 2025

🦋 Changeset detected

Latest commit: e41768f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 22 packages
Name Type
@clerk/types Patch
@clerk/agent-toolkit Patch
@clerk/astro Patch
@clerk/backend Patch
@clerk/clerk-js Patch
@clerk/elements Patch
@clerk/expo-passkeys Patch
@clerk/clerk-expo Patch
@clerk/express Patch
@clerk/fastify Patch
@clerk/localizations Patch
@clerk/nextjs Patch
@clerk/nuxt Patch
@clerk/react-router Patch
@clerk/clerk-react Patch
@clerk/remix Patch
@clerk/shared Patch
@clerk/tanstack-react-start Patch
@clerk/testing Patch
@clerk/themes Patch
@clerk/vue Patch
@clerk/chrome-extension Patch

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

Copy link

vercel bot commented Aug 13, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Project Deployment Preview Comments Updated (UTC)
clerk-js-sandbox Ready Preview Comment Aug 13, 2025 4:02pm

Copy link

pkg-pr-new bot commented Aug 13, 2025

Open in StackBlitz

@clerk/agent-toolkit

npm i https://pkg.pr.new/@clerk/agent-toolkit@6531

@clerk/astro

npm i https://pkg.pr.new/@clerk/astro@6531

@clerk/backend

npm i https://pkg.pr.new/@clerk/backend@6531

@clerk/chrome-extension

npm i https://pkg.pr.new/@clerk/chrome-extension@6531

@clerk/clerk-js

npm i https://pkg.pr.new/@clerk/clerk-js@6531

@clerk/dev-cli

npm i https://pkg.pr.new/@clerk/dev-cli@6531

@clerk/elements

npm i https://pkg.pr.new/@clerk/elements@6531

@clerk/clerk-expo

npm i https://pkg.pr.new/@clerk/clerk-expo@6531

@clerk/expo-passkeys

npm i https://pkg.pr.new/@clerk/expo-passkeys@6531

@clerk/express

npm i https://pkg.pr.new/@clerk/express@6531

@clerk/fastify

npm i https://pkg.pr.new/@clerk/fastify@6531

@clerk/localizations

npm i https://pkg.pr.new/@clerk/localizations@6531

@clerk/nextjs

npm i https://pkg.pr.new/@clerk/nextjs@6531

@clerk/nuxt

npm i https://pkg.pr.new/@clerk/nuxt@6531

@clerk/clerk-react

npm i https://pkg.pr.new/@clerk/clerk-react@6531

@clerk/react-router

npm i https://pkg.pr.new/@clerk/react-router@6531

@clerk/remix

npm i https://pkg.pr.new/@clerk/remix@6531

@clerk/shared

npm i https://pkg.pr.new/@clerk/shared@6531

@clerk/tanstack-react-start

npm i https://pkg.pr.new/@clerk/tanstack-react-start@6531

@clerk/testing

npm i https://pkg.pr.new/@clerk/testing@6531

@clerk/themes

npm i https://pkg.pr.new/@clerk/themes@6531

@clerk/types

npm i https://pkg.pr.new/@clerk/types@6531

@clerk/upgrade

npm i https://pkg.pr.new/@clerk/upgrade@6531

@clerk/vue

npm i https://pkg.pr.new/@clerk/vue@6531

commit: e41768f

export type LocalizationResource = DeepPartial<DeepLocalizationWithoutObjects<__internal_LocalizationResource>>;
// eslint-disable-next-line @typescript-eslint/no-empty-object-type -- Needs to be an interface for typedoc to link correctly
export interface LocalizationResource
extends DeepPartial<DeepLocalizationWithoutObjects<__internal_LocalizationResource>> {}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes the type from DeepPartial<DeepLocalizationWithoutObjects<__internal_LocalizationResource>>

image

To LocalizationResource

Image

And because of the link replacement in .typedoc/custom-plugin.mjs:56 it then points to /docs/customization/localization

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if this change from type to interface is ok with just doing an empty changeset, or if this should be a patch

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use it internally in @clerk/clerk-js and @clerk/localizations, but technically it's still public because anyone can import it from @clerk/types for some random reason. So at least a patch changeset would be appropriate 🤔

Copy link
Contributor

coderabbitai bot commented Aug 13, 2025

📝 Walkthrough

Walkthrough

  • Updated typedoc custom plugin (.typedoc/custom-plugin.mjs): added two LINK_REPLACEMENTS (localization-resource → /docs/customization/localization, commerce-subscription-item-resource → /docs/references/javascript/types/commerce-subscription-item-resource) and removed a catch-all replacement that mapped _LocalizationResource to the localization docs.
  • Adjusted JSDoc in Clerk-related types (packages/types/src/clerk.ts) to wrap component names in code formatting for multiple URL builder/redirect methods; no API or type-signature changes.
  • Converted LocalizationResource from a type alias to an exported interface in packages/types/src/localization.ts; underlying type remains DeepPartial<DeepLocalizationWithoutObjects<__internal_LocalizationResource>>. Added changeset for @clerk/types.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~15 minutes


🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (10)
.typedoc/custom-plugin.mjs (2)

12-13: Deduplicate entry in FILES_WITHOUT_HEADINGS.

The file pages-or-infinite-options.mdx appears twice. Minor nit, but removing the duplicate avoids redundant work.

Apply this diff:

   'pages-or-infinite-options.mdx',
-  'pages-or-infinite-options.mdx',

28-58: Consider adding unit coverage for LINK_REPLACEMENTS.

Even a lightweight test asserting that getRelativeLinkReplacements() transforms representative relative links (with and without anchors) to the expected absolute paths would prevent regressions for these entries.

I can scaffold a small test harness around the replacement function if you want.

packages/types/src/clerk.ts (7)

656-660: Normalize JSX spacing in JSDoc component references.

Keep the formatting consistent across the file as <SignIn />.

-   * Returns the configured url where `<SignIn/>` is mounted or a custom sign-in page is rendered.
+   * Returns the configured url where `<SignIn />` is mounted or a custom sign-in page is rendered.

663-667: Normalize JSX spacing in JSDoc component references.

Use <SignUp /> consistently.

-   * Returns the configured url where `<SignUp/>` is mounted or a custom sign-up page is rendered.
+   * Returns the configured url where `<SignUp />` is mounted or a custom sign-up page is rendered.

710-713: Normalize JSX spacing in JSDoc component references.

Use <Waitlist /> consistently.

-   * Returns the configured url where `<Waitlist/>` is mounted or a custom waitlist page is rendered.
+   * Returns the configured url where `<Waitlist />` is mounted or a custom waitlist page is rendered.

723-727: Normalize JSX spacing in JSDoc component references.

Use <SignIn /> consistently.

-   * Redirects to the configured URL where `<SignIn/>` is mounted.
+   * Redirects to the configured URL where `<SignIn />` is mounted.

730-734: Normalize JSX spacing in JSDoc component references.

Use <SignUp /> consistently.

-   * Redirects to the configured URL where `<SignUp/>` is mounted.
+   * Redirects to the configured URL where `<SignUp />` is mounted.

737-740: Normalize JSX spacing in JSDoc component references.

Use <UserProfile /> consistently.

-   * Redirects to the configured URL where `<UserProfile/>` is mounted.
+   * Redirects to the configured URL where `<UserProfile />` is mounted.

767-770: Normalize JSX spacing in JSDoc component references.

Use <Waitlist /> consistently.

-   * Redirects to the configured URL where `<Waitlist/>` is mounted.
+   * Redirects to the configured URL where `<Waitlist />` is mounted.
packages/types/src/localization.ts (1)

63-66: Optional: Add a direct @see to the public docs.

Since you added an explicit link replacement for this type, a JSDoc @see will also help editors and IDEs.

-// eslint-disable-next-line @typescript-eslint/no-empty-object-type -- Needs to be an interface for typedoc to link correctly
+// eslint-disable-next-line @typescript-eslint/no-empty-object-type -- Needs to be an interface for typedoc to link correctly
+/**
+ * @see https://clerk.com/docs/customization/localization
+ */
 export interface LocalizationResource
   extends DeepPartial<DeepLocalizationWithoutObjects<__internal_LocalizationResource>> {}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 21c2956 and 271cb89.

📒 Files selected for processing (3)
  • .typedoc/custom-plugin.mjs (1 hunks)
  • packages/types/src/clerk.ts (4 hunks)
  • packages/types/src/localization.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (7)
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)

**/*.{js,jsx,ts,tsx}: All code must pass ESLint checks with the project's configuration
Follow established naming conventions (PascalCase for components, camelCase for variables)
Maintain comprehensive JSDoc comments for public APIs
Use dynamic imports for optional features
All public APIs must be documented with JSDoc
Provide meaningful error messages to developers
Include error recovery suggestions where applicable
Log errors appropriately for debugging
Lazy load components and features when possible
Implement proper caching strategies
Use efficient data structures and algorithms
Profile and optimize critical paths
Validate all inputs and sanitize outputs
Implement proper logging with different levels

Files:

  • packages/types/src/clerk.ts
  • packages/types/src/localization.ts
**/*.{js,jsx,ts,tsx,json,css,scss,md,yaml,yml}

📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)

Use Prettier for consistent code formatting

Files:

  • packages/types/src/clerk.ts
  • packages/types/src/localization.ts
packages/**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)

TypeScript is required for all packages

Files:

  • packages/types/src/clerk.ts
  • packages/types/src/localization.ts
packages/**/*.{ts,tsx,d.ts}

📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)

Packages should export TypeScript types alongside runtime code

Files:

  • packages/types/src/clerk.ts
  • packages/types/src/localization.ts
**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (.cursor/rules/development.mdc)

Use proper TypeScript error types

**/*.{ts,tsx}: Always define explicit return types for functions, especially public APIs
Use proper type annotations for variables and parameters where inference isn't clear
Avoid any type - prefer unknown when type is uncertain, then narrow with type guards
Use interface for object shapes that might be extended
Use type for unions, primitives, and computed types
Prefer readonly properties for immutable data structures
Use private for internal implementation details
Use protected for inheritance hierarchies
Use public explicitly for clarity in public APIs
Prefer readonly for properties that shouldn't change after construction
Prefer composition and interfaces over deep inheritance chains
Use mixins for shared behavior across unrelated classes
Implement dependency injection for loose coupling
Let TypeScript infer when types are obvious
Use const assertions for literal types: as const
Use satisfies operator for type checking without widening
Use mapped types for transforming object types
Use conditional types for type-level logic
Leverage template literal types for string manipulation
Use ES6 imports/exports consistently
Use default exports sparingly, prefer named exports
Use type-only imports: import type { ... } from ...
No any types without justification
Proper error handling with typed errors
Consistent use of readonly for immutable data
Proper generic constraints
No unused type parameters
Proper use of utility types instead of manual type construction
Type-only imports where possible
Proper tree-shaking friendly exports
No circular dependencies
Efficient type computations (avoid deep recursion)

Files:

  • packages/types/src/clerk.ts
  • packages/types/src/localization.ts
**/*.{js,ts,tsx,jsx}

📄 CodeRabbit Inference Engine (.cursor/rules/monorepo.mdc)

Support multiple Clerk environment variables (CLERK_, NEXT_PUBLIC_CLERK_, etc.) for configuration.

Files:

  • packages/types/src/clerk.ts
  • packages/types/src/localization.ts
**/*

⚙️ CodeRabbit Configuration File

If there are no tests added or modified as part of the PR, please suggest that tests be added to cover the changes.

Files:

  • packages/types/src/clerk.ts
  • packages/types/src/localization.ts
🧬 Code Graph Analysis (2)
packages/types/src/clerk.ts (1)
packages/types/src/redirects.ts (1)
  • RedirectOptions (40-44)
packages/types/src/localization.ts (1)
packages/types/src/utils.ts (1)
  • DeepPartial (32-34)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: Build Packages
  • GitHub Check: Formatting | Dedupe | Changeset
  • GitHub Check: semgrep/ci
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (9)
.typedoc/custom-plugin.mjs (2)

56-57: Explicit replacements for Localization and Commerce subscription item look correct.

These additions align with the intended doc targets and preserve anchors via the shared replacement logic. Good call removing the previous catch-all mapping in favor of explicit rules to avoid unintended matches.


56-57: No stale legacy references detected

A repository-wide search for _LocalizationResource or non-hyphenated localizationresource.mdx returned only valid hyphenated entries in snapshot tests:

  • .typedoc/tests/snapshots/file-structure.test.ts.snap:56 — "types/commerce-subscription-item-resource.mdx"
  • .typedoc/tests/snapshots/file-structure.test.ts.snap:85 — "types/localization-resource.mdx"

All references align with the new interface-based naming and hyphenated slugs. No further action required.

packages/types/src/clerk.ts (5)

670-673: JSDoc update looks good.

Backtick-wrapped component name reads well and should generate correct links.


675-678: JSDoc update looks good.

Consistent formatting and wording.


680-683: JSDoc update looks good.

Consistent with other component references.


742-745: JSDoc update looks good.

Consistent with other component references.


747-750: JSDoc update looks good.

Consistent with other component references.

packages/types/src/localization.ts (2)

63-66: Switching to an interface for Typedoc linking — LGTM.

This preserves assignability via extends while enabling stable TypeDoc linking. The ESLint disable is justified given the empty interface body.


63-66: LocalizationResource interface has no duplicates

A ripgrep search across the repository only finds the single declaration in packages/types/src/localization.ts (line 64). There are no other ambient or duplicate definitions, so there’s no risk of accidental declaration merging.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
.changeset/full-times-wear.md (2)

5-5: Consider expanding the summary to reflect both the interface change and doc link fixes

Optional: make the message a bit more descriptive to aid changelog readers, e.g., mention Typedoc link improvements for CommerceSubscriptionItemResource too.

Suggested edit:

-Convert LocalizationResource to interface for typedoc documentation
+Convert LocalizationResource to an interface for Typedoc documentation; improve Typedoc links (incl. CommerceSubscriptionItemResource)

6-6: Potential stray character at end of file

There appears to be a lone “6” line at the end. If present in the actual file, please remove to avoid noise in the generated release notes.

-6
+
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 271cb89 and e41768f.

📒 Files selected for processing (1)
  • .changeset/full-times-wear.md (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
.changeset/**

📄 CodeRabbit Inference Engine (.cursor/rules/monorepo.mdc)

Automated releases must use Changesets.

Files:

  • .changeset/full-times-wear.md
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: Build Packages
  • GitHub Check: Formatting | Dedupe | Changeset
  • GitHub Check: semgrep/ci
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: semgrep-cloud-platform/scan
🔇 Additional comments (1)
.changeset/full-times-wear.md (1)

1-3: Changeset frontmatter looks correct for @clerk/types patch bump

Package name and bump type are valid. This will correctly publish a patch release of @clerk/types.

@NWylynko NWylynko merged commit 15fe106 into main Aug 13, 2025
39 checks passed
@NWylynko NWylynko deleted the nick/typedoc-fix-broken-links branch August 13, 2025 17:56
mwerder pushed a commit to mwerder/clerk-javascript that referenced this pull request Aug 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants