- 
                Notifications
    You must be signed in to change notification settings 
- Fork 403
docs(repo): Generate all params and return types (hooks work) #6901
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| The latest updates on your projects. Learn more about Vercel for GitHub. 
 | 
| 🦋 Changeset detectedLatest commit: 3029aa3 The changes in this PR will be included in the next version bump. This PR includes changesets to release 22 packages
 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 | 
| WalkthroughThis pull request refactors internal hook type definitions into properly exported public API types with JSDoc documentation, and introduces a TypeDoc extraction pipeline to automatically generate hook parameter and return type documentation during the build process. Changes
 Sequence DiagramsequenceDiagram
    participant Build as Build Process
    participant TypeDoc as TypeDoc
    participant Extractor as extract-returns-and-params.mjs
    participant MDXFiles as MDX Files
    participant Output as Documentation Output
    Build->>TypeDoc: 1. Generate types documentation
    TypeDoc->>MDXFiles: Creates temp-docs with MDX
    
    Build->>Extractor: 2. Run extraction script
    Extractor->>MDXFiles: Read MDX files
    Extractor->>MDXFiles: Extract "## Returns" section
    MDXFiles->>Output: Write *-return.mdx
    Extractor->>MDXFiles: Extract "## Parameters" section
    MDXFiles->>Output: Write *-params.mdx
    
    rect rgb(220, 240, 255)
        Extractor->>Extractor: Replace generic type patterns<br/>in params tables
    end
    
    Extractor->>MDXFiles: Delete stale -props.mdx
    
    Build->>Build: 3. Cleanup & move docs
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 
 Poem
 Pre-merge checks and finishing touches✅ Passed checks (5 passed)
 ✨ Finishing touches🧪 Generate unit tests (beta)
 📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Disabled knowledge base sources: 
 
 📒 Files selected for processing (1)
 🧰 Additional context used📓 Path-based instructions (1)**/*.{js,jsx,ts,tsx,json,css,scss,md,yaml,yml}📄 CodeRabbit inference engine (.cursor/rules/development.mdc) 
 Files: 
 ⏰ 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)
 Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment  | 
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.
Actionable comments posted: 0
♻️ Duplicate comments (1)
packages/shared/src/react/hooks/useSubscription.tsx (1)
38-56: Letdata/errormodel SWR’sundefinedstate
useSWRyieldsundefinedfor bothdataanderrorbefore the first fetch, yet Line 40 narrows toBillingSubscriptionResource | nulland Line 52 narrows toError | null. That combination misleads consumers and mis-documents the initial state; it also contradicts the resolution from the earlier review thread. Please widen both fields to includeundefinedand update the JSDoc to match.- /** - * The subscription object, or `null` if the data hasn't been loaded yet. - */ - data: BillingSubscriptionResource | null; + /** + * The subscription object. `undefined` before the first fetch, `null` when no subscription exists. + */ + data: BillingSubscriptionResource | null | undefined; @@ - /** - * Any error that occurred during the data fetch, or `null` if no error occurred. - */ - error: Error | null; + /** + * Any error that occurred during the data fetch, or `undefined` if no error occurred yet. + */ + error: Error | undefined;
🧹 Nitpick comments (1)
packages/shared/src/react/hooks/useSubscription.tsx (1)
54-56: Expose the promise shape ofrevalidate
swr.mutate()resolves with the refreshed subscription (BillingSubscriptionResource | null | undefined). Typing Line 56 asPromise<void>hides that data from consumers and robs frictionless chaining. Please surface the actual resolved payload (and note it in the docstring).- /** - * Function to manually trigger a refresh of the subscription data. - */ - revalidate: () => Promise<void>; + /** + * Function to manually trigger a refresh of the subscription data. Resolves with the latest subscription value. + */ + revalidate: () => Promise<BillingSubscriptionResource | null | undefined>;
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
- packages/shared/src/react/hooks/useSubscription.tsx(2 hunks)
🧰 Additional context used
📓 Path-based instructions (8)
**/*.{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/shared/src/react/hooks/useSubscription.tsx
**/*.{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/shared/src/react/hooks/useSubscription.tsx
packages/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
TypeScript is required for all packages
Files:
- packages/shared/src/react/hooks/useSubscription.tsx
packages/**/*.{ts,tsx,d.ts}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Packages should export TypeScript types alongside runtime code
Files:
- packages/shared/src/react/hooks/useSubscription.tsx
**/*.{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
Avoidanytype - preferunknownwhen type is uncertain, then narrow with type guards
Useinterfacefor object shapes that might be extended
Usetypefor unions, primitives, and computed types
Preferreadonlyproperties for immutable data structures
Useprivatefor internal implementation details
Useprotectedfor inheritance hierarchies
Usepublicexplicitly for clarity in public APIs
Preferreadonlyfor 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
Useconst assertionsfor literal types:as const
Usesatisfiesoperator 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 ...
Noanytypes without justification
Proper error handling with typed errors
Consistent use ofreadonlyfor 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/shared/src/react/hooks/useSubscription.tsx
**/*.{jsx,tsx}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
**/*.{jsx,tsx}: Use error boundaries in React components
Minimize re-renders in React components
**/*.{jsx,tsx}: Always use functional components with hooks instead of class components
Follow PascalCase naming for components:UserProfile,NavigationMenu
Keep components focused on a single responsibility - split large components
Limit component size to 150-200 lines; extract logic into custom hooks
Use composition over inheritance - prefer smaller, composable components
Export components as named exports for better tree-shaking
One component per file with matching filename and component name
Use useState for simple state management
Use useReducer for complex state logic
Implement proper state initialization
Use proper state updates with callbacks
Implement proper state cleanup
Use Context API for theme/authentication
Implement proper state selectors
Use proper state normalization
Implement proper state persistence
Use React.memo for expensive components
Implement proper useCallback for handlers
Use proper useMemo for expensive computations
Implement proper virtualization for lists
Use proper code splitting with React.lazy
Implement proper cleanup in useEffect
Use proper refs for DOM access
Implement proper event listener cleanup
Use proper abort controllers for fetch
Implement proper subscription cleanup
Use proper HTML elements
Implement proper ARIA attributes
Use proper heading hierarchy
Implement proper form labels
Use proper button types
Implement proper focus management
Use proper keyboard shortcuts
Implement proper tab order
Use proper skip links
Implement proper focus traps
Implement proper error boundaries
Use proper error logging
Implement proper error recovery
Use proper error messages
Implement proper error fallbacks
Use proper form validation
Implement proper error states
Use proper error messages
Implement proper form submission
Use proper form reset
Use proper component naming
Implement proper file naming
Use proper prop naming
Implement proper...
Files:
- packages/shared/src/react/hooks/useSubscription.tsx
**/*.{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/shared/src/react/hooks/useSubscription.tsx
**/*.tsx
📄 CodeRabbit inference engine (.cursor/rules/react.mdc)
**/*.tsx: Use proper type definitions for props and state
Leverage TypeScript's type inference where possible
Use proper event types for handlers
Implement proper generic types for reusable components
Use proper type guards for conditional rendering
Files:
- packages/shared/src/react/hooks/useSubscription.tsx
🧬 Code graph analysis (1)
packages/shared/src/react/hooks/useSubscription.tsx (1)
packages/types/src/billing.ts (2)
ForPayerType(69-69)
BillingSubscriptionResource(565-615)
⏰ 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: Analyze (javascript-typescript)
- GitHub Check: semgrep-cloud-platform/scan
- GitHub Check: semgrep-cloud-platform/scan
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.
Actionable comments posted: 1
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (4)
- packages/shared/src/errors/clerkApiResponseError.ts(1 hunks)
- packages/shared/src/react/hooks/createBillingPaginatedHook.tsx(1 hunks)
- packages/shared/src/react/hooks/usePlans.tsx(1 hunks)
- packages/types/src/billing.ts(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- packages/shared/src/errors/clerkApiResponseError.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- packages/types/src/billing.ts
🧰 Additional context used
📓 Path-based instructions (8)
**/*.{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/shared/src/react/hooks/usePlans.tsx
- packages/shared/src/react/hooks/createBillingPaginatedHook.tsx
**/*.{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/shared/src/react/hooks/usePlans.tsx
- packages/shared/src/react/hooks/createBillingPaginatedHook.tsx
packages/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
TypeScript is required for all packages
Files:
- packages/shared/src/react/hooks/usePlans.tsx
- packages/shared/src/react/hooks/createBillingPaginatedHook.tsx
packages/**/*.{ts,tsx,d.ts}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Packages should export TypeScript types alongside runtime code
Files:
- packages/shared/src/react/hooks/usePlans.tsx
- packages/shared/src/react/hooks/createBillingPaginatedHook.tsx
**/*.{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
Avoidanytype - preferunknownwhen type is uncertain, then narrow with type guards
Useinterfacefor object shapes that might be extended
Usetypefor unions, primitives, and computed types
Preferreadonlyproperties for immutable data structures
Useprivatefor internal implementation details
Useprotectedfor inheritance hierarchies
Usepublicexplicitly for clarity in public APIs
Preferreadonlyfor 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
Useconst assertionsfor literal types:as const
Usesatisfiesoperator 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 ...
Noanytypes without justification
Proper error handling with typed errors
Consistent use ofreadonlyfor 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/shared/src/react/hooks/usePlans.tsx
- packages/shared/src/react/hooks/createBillingPaginatedHook.tsx
**/*.{jsx,tsx}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
**/*.{jsx,tsx}: Use error boundaries in React components
Minimize re-renders in React components
**/*.{jsx,tsx}: Always use functional components with hooks instead of class components
Follow PascalCase naming for components:UserProfile,NavigationMenu
Keep components focused on a single responsibility - split large components
Limit component size to 150-200 lines; extract logic into custom hooks
Use composition over inheritance - prefer smaller, composable components
Export components as named exports for better tree-shaking
One component per file with matching filename and component name
Use useState for simple state management
Use useReducer for complex state logic
Implement proper state initialization
Use proper state updates with callbacks
Implement proper state cleanup
Use Context API for theme/authentication
Implement proper state selectors
Use proper state normalization
Implement proper state persistence
Use React.memo for expensive components
Implement proper useCallback for handlers
Use proper useMemo for expensive computations
Implement proper virtualization for lists
Use proper code splitting with React.lazy
Implement proper cleanup in useEffect
Use proper refs for DOM access
Implement proper event listener cleanup
Use proper abort controllers for fetch
Implement proper subscription cleanup
Use proper HTML elements
Implement proper ARIA attributes
Use proper heading hierarchy
Implement proper form labels
Use proper button types
Implement proper focus management
Use proper keyboard shortcuts
Implement proper tab order
Use proper skip links
Implement proper focus traps
Implement proper error boundaries
Use proper error logging
Implement proper error recovery
Use proper error messages
Implement proper error fallbacks
Use proper form validation
Implement proper error states
Use proper error messages
Implement proper form submission
Use proper form reset
Use proper component naming
Implement proper file naming
Use proper prop naming
Implement proper...
Files:
- packages/shared/src/react/hooks/usePlans.tsx
- packages/shared/src/react/hooks/createBillingPaginatedHook.tsx
**/*.{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/shared/src/react/hooks/usePlans.tsx
- packages/shared/src/react/hooks/createBillingPaginatedHook.tsx
**/*.tsx
📄 CodeRabbit inference engine (.cursor/rules/react.mdc)
**/*.tsx: Use proper type definitions for props and state
Leverage TypeScript's type inference where possible
Use proper event types for handlers
Implement proper generic types for reusable components
Use proper type guards for conditional rendering
Files:
- packages/shared/src/react/hooks/usePlans.tsx
- packages/shared/src/react/hooks/createBillingPaginatedHook.tsx
🧬 Code graph analysis (2)
packages/shared/src/react/hooks/usePlans.tsx (2)
packages/clerk-js/src/ui/contexts/components/Plans.tsx (1)
usePlans(80-90)packages/shared/src/react/hooks/index.ts (1)
usePlans(14-14)
packages/shared/src/react/hooks/createBillingPaginatedHook.tsx (2)
packages/shared/src/react/types.ts (2)
PaginatedHookConfig(90-103)
PagesOrInfiniteOptions(134-157)packages/types/src/billing.ts (1)
ForPayerType(69-69)
⏰ 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: Analyze (javascript-typescript)
- GitHub Check: semgrep-cloud-platform/scan
- GitHub Check: semgrep-cloud-platform/scan
🔇 Additional comments (2)
packages/shared/src/react/hooks/usePlans.tsx (1)
24-27: I'll verify the review comment by examining the codebase and checking TypeScript/TypeDoc conventions.Now let me examine the actual file and verify the pattern in the codebase:
Excellent! I found critical information. Now let me examine the actual file and check for patterns in the codebase:
Based on my research, I can now provide a definitive verification.
The review comment incorrectly flags the
@interfacetag usage. TypeDoc explicitly supports@interfaceon type aliases and will cause them to be converted as interfaces in documentation. This is a documented TypeDoc feature, not a mistake.For the PR's TypeDoc documentation approach, using
@interfaceon the type alias is the correct pattern. The suggestion to use@typedefis not applicable here, as@typedefis for JavaScript JSDoc in.jsfiles, while this code is in a.tsxfile with TypeScript type aliases documented for TypeDoc generation.The only valid concern is the missing description. Per the coding guidelines, public APIs should be documented. Add a brief description of what this return type represents:
/** - * @interface + * Return type of the usePlans hook. */ export type UsePlansReturn = ReturnType<typeof usePlans>;Likely an incorrect or invalid review comment.
packages/shared/src/react/hooks/createBillingPaginatedHook.tsx (1)
30-37: LGTM! Property documentation is clear and accurate.The
forproperty is well-documented with a clear description and correct default value that matches the implementation at line 66 (_for || 'user'). The type constraint usingForPayerTypeis appropriate and type-safe.
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.
Looks good! Thank you 🚀
| 
 Thank you for reviewing @wobsoriano! Think I may want @NWylynko eyes on this too - want to make sure it's all good. | 
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.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️  Outside diff range comments (1)
packages/shared/src/react/hooks/useReverification.ts (1)
70-72: Remove| undefinedfromFetcherconstraint.The constraint permits
undefinedas a validFetcher, but the implementation requires an actual function. This weakens type safety and could allow invalid usage.-type UseReverificationResult<Fetcher extends (...args: any[]) => Promise<any> | undefined> = ( +type UseReverificationResult<Fetcher extends (...args: any[]) => Promise<any>> = ( ...args: Parameters<Fetcher> ) => Promise<ExcludeClerkError<Awaited<ReturnType<Fetcher>>>>;
♻️ Duplicate comments (2)
package.json (1)
59-59: Unresolved: Cross-platform script compatibility (previously flagged).This issue was flagged in a prior review. The script at line 59 still uses POSIX-only
rmandmvcommands, which fail on Windows. The required cross-platform replacements (rimrafandcpy-cli) are already in devDependencies and available for use.Apply this diff to make the script cross-platform:
-"typedoc:generate:skip-build": "typedoc --tsconfig tsconfig.typedoc.json && node .typedoc/extract-returns-and-params.mjs && rm -rf .typedoc/docs && mv .typedoc/temp-docs .typedoc/docs", +"typedoc:generate:skip-build": "typedoc --tsconfig tsconfig.typedoc.json && node .typedoc/extract-returns-and-params.mjs && rimraf .typedoc/docs && cpy \".typedoc/temp-docs/**\" .typedoc/docs --parents && rimraf .typedoc/temp-docs",packages/shared/src/react/hooks/useReverification.ts (1)
77-86: Remove| undefinedfrom theFetcherconstraint (previously flagged as critical).While the
fetcherparameter is now correctly bound to the generic, the constraint still permitsundefinedas a validFetchertype. This degrades type inference, allows invalid call sites, and produces incorrect TypeDoc output.-type UseReverification = <Fetcher extends (...args: any[]) => Promise<any> | undefined>( +type UseReverification = <Fetcher extends (...args: any[]) => Promise<any>>( /** * A function that returns a promise. */ fetcher: Fetcher, /** * The optional options object. */ options?: UseReverificationOptions, ) => UseReverificationResult<Fetcher>;
🧹 Nitpick comments (1)
packages/shared/src/react/hooks/useReverification.ts (1)
37-50: Considerreadonlymodifiers and optional property syntax for immutable callback parameters.The type is correctly documented for TypeDoc. For stronger immutability guarantees and clearer semantics, consider making the callback functions
readonlyand using optional property syntax forlevel.export type NeedsReverificationParameters = { /** * Marks the reverification process as cancelled and rejects the original request. */ - cancel: () => void; + readonly cancel: () => void; /** * Marks the reverification process as complete and retries the original request. */ - complete: () => void; + readonly complete: () => void; /** * The verification level required for the reverification process. */ - level: SessionVerificationLevel | undefined; + readonly level?: SessionVerificationLevel; };As per coding guidelines
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
- package.json(1 hunks)
- packages/shared/src/react/hooks/useReverification.ts(2 hunks)
🧰 Additional context used
📓 Path-based instructions (6)
**/*.{js,jsx,ts,tsx,json,css,scss,md,yaml,yml}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Use Prettier for consistent code formatting
Files:
- package.json
- packages/shared/src/react/hooks/useReverification.ts
**/*.{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/shared/src/react/hooks/useReverification.ts
packages/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
TypeScript is required for all packages
Files:
- packages/shared/src/react/hooks/useReverification.ts
packages/**/*.{ts,tsx,d.ts}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Packages should export TypeScript types alongside runtime code
Files:
- packages/shared/src/react/hooks/useReverification.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
Avoidanytype - preferunknownwhen type is uncertain, then narrow with type guards
Useinterfacefor object shapes that might be extended
Usetypefor unions, primitives, and computed types
Preferreadonlyproperties for immutable data structures
Useprivatefor internal implementation details
Useprotectedfor inheritance hierarchies
Usepublicexplicitly for clarity in public APIs
Preferreadonlyfor 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
Useconst assertionsfor literal types:as const
Usesatisfiesoperator 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 ...
Noanytypes without justification
Proper error handling with typed errors
Consistent use ofreadonlyfor 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/shared/src/react/hooks/useReverification.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/shared/src/react/hooks/useReverification.ts
🧬 Code graph analysis (1)
packages/shared/src/react/hooks/useReverification.ts (1)
packages/types/src/sessionVerification.ts (1)
SessionVerificationLevel(50-50)
⏰ 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). (27)
- GitHub Check: Integration Tests (machine, chrome)
- GitHub Check: Integration Tests (nextjs, chrome, 14)
- GitHub Check: Integration Tests (custom, chrome)
- GitHub Check: Integration Tests (sessions:staging, chrome)
- GitHub Check: Integration Tests (expo-web, chrome)
- GitHub Check: Integration Tests (nextjs, chrome, 15)
- GitHub Check: Integration Tests (billing, chrome)
- GitHub Check: Integration Tests (sessions, chrome)
- GitHub Check: Integration Tests (tanstack-react-start, chrome)
- GitHub Check: Integration Tests (react-router, chrome)
- GitHub Check: Integration Tests (handshake:staging, chrome)
- GitHub Check: Integration Tests (astro, chrome)
- GitHub Check: Integration Tests (handshake, chrome)
- GitHub Check: Integration Tests (localhost, chrome)
- GitHub Check: Integration Tests (vue, chrome)
- GitHub Check: Integration Tests (elements, chrome)
- GitHub Check: Integration Tests (ap-flows, chrome)
- GitHub Check: Integration Tests (nuxt, chrome)
- GitHub Check: Integration Tests (express, chrome)
- GitHub Check: Integration Tests (quickstart, chrome)
- GitHub Check: Integration Tests (generic, chrome)
- GitHub Check: Unit Tests (22, **)
- GitHub Check: Publish with pkg-pr-new
- GitHub Check: Unit Tests (18, --filter=@clerk/astro --filter=@clerk/backend --filter=@clerk/express --filter=@c...
- GitHub Check: Static analysis
- GitHub Check: semgrep-cloud-platform/scan
- GitHub Check: semgrep-cloud-platform/scan
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.
Actionable comments posted: 1
🧹 Nitpick comments (2)
.typedoc/custom-plugin.mjs (2)
21-36: FILES_WITHOUT_HEADINGS updates look good; past typo fixed.Nice cleanup and coverage expansion. Consider a tiny hardening to prevent future duplicates/typos:
- Use a Set for membership checks.
- Optionally assert all entries end with ".mdx" and log a warning if not.
Example (optional):
const FILES_WITHOUT_HEADINGS_SET = new Set(FILES_WITHOUT_HEADINGS);
…
if (fileName && FILES_WITHOUT_HEADINGS_SET.has(fileName)) { … }
46-49: Avoid potential “double-anchor” links for in-page targets.These newPaths start with "#". If the original MDX link already had an anchor (rare but possible), the current replacement would yield "#foo#bar". Safeguard in getRelativeLinkReplacements by dropping the preserved anchor when newPath starts with "#":
- replace: (/** @type {string} */ _match, anchor = '') => `(${newPath}${anchor})`, + replace: (/** @type {string} */ _match, anchor = '') => + `(${newPath}${newPath.startsWith('#') ? '' : anchor})`,
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
- .typedoc/custom-plugin.mjs(3 hunks)
- packages/shared/src/react/hooks/useSubscription.tsx(3 hunks)
🧰 Additional context used
📓 Path-based instructions (8)
**/*.{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/shared/src/react/hooks/useSubscription.tsx
**/*.{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/shared/src/react/hooks/useSubscription.tsx
packages/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
TypeScript is required for all packages
Files:
- packages/shared/src/react/hooks/useSubscription.tsx
packages/**/*.{ts,tsx,d.ts}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Packages should export TypeScript types alongside runtime code
Files:
- packages/shared/src/react/hooks/useSubscription.tsx
**/*.{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
Avoidanytype - preferunknownwhen type is uncertain, then narrow with type guards
Useinterfacefor object shapes that might be extended
Usetypefor unions, primitives, and computed types
Preferreadonlyproperties for immutable data structures
Useprivatefor internal implementation details
Useprotectedfor inheritance hierarchies
Usepublicexplicitly for clarity in public APIs
Preferreadonlyfor 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
Useconst assertionsfor literal types:as const
Usesatisfiesoperator 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 ...
Noanytypes without justification
Proper error handling with typed errors
Consistent use ofreadonlyfor 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/shared/src/react/hooks/useSubscription.tsx
**/*.{jsx,tsx}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
**/*.{jsx,tsx}: Use error boundaries in React components
Minimize re-renders in React components
**/*.{jsx,tsx}: Always use functional components with hooks instead of class components
Follow PascalCase naming for components:UserProfile,NavigationMenu
Keep components focused on a single responsibility - split large components
Limit component size to 150-200 lines; extract logic into custom hooks
Use composition over inheritance - prefer smaller, composable components
Export components as named exports for better tree-shaking
One component per file with matching filename and component name
Use useState for simple state management
Use useReducer for complex state logic
Implement proper state initialization
Use proper state updates with callbacks
Implement proper state cleanup
Use Context API for theme/authentication
Implement proper state selectors
Use proper state normalization
Implement proper state persistence
Use React.memo for expensive components
Implement proper useCallback for handlers
Use proper useMemo for expensive computations
Implement proper virtualization for lists
Use proper code splitting with React.lazy
Implement proper cleanup in useEffect
Use proper refs for DOM access
Implement proper event listener cleanup
Use proper abort controllers for fetch
Implement proper subscription cleanup
Use proper HTML elements
Implement proper ARIA attributes
Use proper heading hierarchy
Implement proper form labels
Use proper button types
Implement proper focus management
Use proper keyboard shortcuts
Implement proper tab order
Use proper skip links
Implement proper focus traps
Implement proper error boundaries
Use proper error logging
Implement proper error recovery
Use proper error messages
Implement proper error fallbacks
Use proper form validation
Implement proper error states
Use proper error messages
Implement proper form submission
Use proper form reset
Use proper component naming
Implement proper file naming
Use proper prop naming
Implement proper...
Files:
- packages/shared/src/react/hooks/useSubscription.tsx
**/*.{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/shared/src/react/hooks/useSubscription.tsx
**/*.tsx
📄 CodeRabbit inference engine (.cursor/rules/react.mdc)
**/*.tsx: Use proper type definitions for props and state
Leverage TypeScript's type inference where possible
Use proper event types for handlers
Implement proper generic types for reusable components
Use proper type guards for conditional rendering
Files:
- packages/shared/src/react/hooks/useSubscription.tsx
🧬 Code graph analysis (1)
packages/shared/src/react/hooks/useSubscription.tsx (3)
packages/types/src/billing.ts (2)
ForPayerType(69-69)
BillingSubscriptionResource(560-610)packages/clerk-js/src/ui/contexts/components/Plans.tsx (1)
useSubscription(63-78)packages/shared/src/react/hooks/index.ts (1)
useSubscription(15-15)
⏰ 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-cloud-platform/scan
- GitHub Check: semgrep-cloud-platform/scan
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (4)
packages/shared/src/react/hooks/useSubscription.tsx (3)
1-1: LGTM! Import correctly added for new return type.The
BillingSubscriptionResourceimport is necessary for the newUseSubscriptionReturntype definition and is properly sourced from@clerk/types.
15-31: Well-documented parameter type.The
UseSubscriptionParamstype is properly structured with clear JSDoc comments that document default values and include helpful context about layout stability.
65-113: Excellent function declaration for TypeDoc.The change from arrow function to named function declaration with an explicit return type is well-suited for TypeDoc documentation generation. The implementation correctly maps SWR properties to the documented return type.
.typedoc/custom-plugin.mjs (1)
82-94: New absolute replacements LGTM; please verify targets exist.The billing and error type links look correct. Please validate these endpoints resolve in your local docs build or prod to avoid regressions, especially the returns anchor for use-checkout.
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.
Actionable comments posted: 0
🧹 Nitpick comments (2)
packages/shared/src/react/hooks/useSubscription.tsx (2)
15-31: Verify@interfacetag behavior on type aliases.The
@interfacetag is typically reserved for actualinterfacedeclarations in TypeDoc, nottypealiases. While the documentation content is excellent, you may want to verify that TypeDoc processes this tag correctly for type aliases, or consider removing it if it doesn't affect the output.If the
@interfacetag doesn't affect TypeDoc's output for type aliases, you can remove it:-/** - * @interface - */ export type UseSubscriptionParams = {
33-57: Excellent documentation with same@interfacenote.The return type documentation is comprehensive and correctly addresses previous feedback:
- Error type properly uses
Error | undefinedto match SWR semantics- Data property clearly distinguishes between
undefined(not loaded) andnull(no subscription)- All properties have clear, detailed descriptions
Same minor note about the
@interfacetag applies here—verify it works as intended with type aliases in TypeDoc.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
- packages/shared/src/react/hooks/useSubscription.tsx(3 hunks)
🧰 Additional context used
📓 Path-based instructions (8)
**/*.{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/shared/src/react/hooks/useSubscription.tsx
**/*.{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/shared/src/react/hooks/useSubscription.tsx
packages/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
TypeScript is required for all packages
Files:
- packages/shared/src/react/hooks/useSubscription.tsx
packages/**/*.{ts,tsx,d.ts}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Packages should export TypeScript types alongside runtime code
Files:
- packages/shared/src/react/hooks/useSubscription.tsx
**/*.{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
Avoidanytype - preferunknownwhen type is uncertain, then narrow with type guards
Useinterfacefor object shapes that might be extended
Usetypefor unions, primitives, and computed types
Preferreadonlyproperties for immutable data structures
Useprivatefor internal implementation details
Useprotectedfor inheritance hierarchies
Usepublicexplicitly for clarity in public APIs
Preferreadonlyfor 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
Useconst assertionsfor literal types:as const
Usesatisfiesoperator 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 ...
Noanytypes without justification
Proper error handling with typed errors
Consistent use ofreadonlyfor 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/shared/src/react/hooks/useSubscription.tsx
**/*.{jsx,tsx}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
**/*.{jsx,tsx}: Use error boundaries in React components
Minimize re-renders in React components
**/*.{jsx,tsx}: Always use functional components with hooks instead of class components
Follow PascalCase naming for components:UserProfile,NavigationMenu
Keep components focused on a single responsibility - split large components
Limit component size to 150-200 lines; extract logic into custom hooks
Use composition over inheritance - prefer smaller, composable components
Export components as named exports for better tree-shaking
One component per file with matching filename and component name
Use useState for simple state management
Use useReducer for complex state logic
Implement proper state initialization
Use proper state updates with callbacks
Implement proper state cleanup
Use Context API for theme/authentication
Implement proper state selectors
Use proper state normalization
Implement proper state persistence
Use React.memo for expensive components
Implement proper useCallback for handlers
Use proper useMemo for expensive computations
Implement proper virtualization for lists
Use proper code splitting with React.lazy
Implement proper cleanup in useEffect
Use proper refs for DOM access
Implement proper event listener cleanup
Use proper abort controllers for fetch
Implement proper subscription cleanup
Use proper HTML elements
Implement proper ARIA attributes
Use proper heading hierarchy
Implement proper form labels
Use proper button types
Implement proper focus management
Use proper keyboard shortcuts
Implement proper tab order
Use proper skip links
Implement proper focus traps
Implement proper error boundaries
Use proper error logging
Implement proper error recovery
Use proper error messages
Implement proper error fallbacks
Use proper form validation
Implement proper error states
Use proper error messages
Implement proper form submission
Use proper form reset
Use proper component naming
Implement proper file naming
Use proper prop naming
Implement proper...
Files:
- packages/shared/src/react/hooks/useSubscription.tsx
**/*.{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/shared/src/react/hooks/useSubscription.tsx
**/*.tsx
📄 CodeRabbit inference engine (.cursor/rules/react.mdc)
**/*.tsx: Use proper type definitions for props and state
Leverage TypeScript's type inference where possible
Use proper event types for handlers
Implement proper generic types for reusable components
Use proper type guards for conditional rendering
Files:
- packages/shared/src/react/hooks/useSubscription.tsx
🧬 Code graph analysis (1)
packages/shared/src/react/hooks/useSubscription.tsx (3)
packages/types/src/billing.ts (2)
ForPayerType(69-69)
BillingSubscriptionResource(560-610)packages/clerk-js/src/ui/contexts/components/Plans.tsx (1)
useSubscription(63-78)packages/shared/src/react/hooks/index.ts (1)
useSubscription(15-15)
⏰ 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). (4)
- GitHub Check: Build Packages
- GitHub Check: Formatting | Dedupe | Changeset
- GitHub Check: semgrep-cloud-platform/scan
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (1)
packages/shared/src/react/hooks/useSubscription.tsx (1)
59-113: LGTM! Well-structured implementation with proper typing.The function implementation is excellent:
- Explicit return type
UseSubscriptionReturnimproves type safety and IDE support- The
revalidatefunction is properly memoized and exposes manual revalidation capability- All return properties match the documented type
- The
@experimentaltag appropriately flags this beta featureThe conversion from arrow function to named function export with explicit typing aligns well with the PR's goal of improving TypeDoc output.
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.
Actionable comments posted: 0
♻️ Duplicate comments (1)
packages/shared/src/react/hooks/useReverification.ts (1)
77-86: Remove| undefinedfrom theFetcherconstraint.The constraint
Fetcher extends (...args: any[]) => Promise<any> | undefinedallows fetchers that returnundefineddirectly, but the implementation expects a function returning aPromise. This misleads callers and weakens type safety.Apply this diff:
-type UseReverification = <Fetcher extends (...args: any[]) => Promise<any> | undefined>( +type UseReverification = <Fetcher extends (...args: any[]) => Promise<any>>( /** * A function that returns a promise. */ fetcher: Fetcher, /** * The optional options object. */ options?: UseReverificationOptions, ) => UseReverificationResult<Fetcher>;Also update the constraint on line 70 for consistency:
-type UseReverificationResult<Fetcher extends (...args: any[]) => Promise<any> | undefined> = ( +type UseReverificationResult<Fetcher extends (...args: any[]) => Promise<any>> = ( ...args: Parameters<Fetcher> ) => Promise<ExcludeClerkError<Awaited<ReturnType<Fetcher>>>>;
🧹 Nitpick comments (1)
packages/shared/src/react/hooks/useReverification.ts (1)
37-50: Consider usingreadonlyfields and optional property syntax for type safety.While the current implementation is functional, consider these refinements for improved type safety and TypeScript idioms:
- Mark
cancel,complete, andlevelasreadonlyto prevent accidental mutation by consumers- Use optional property syntax
level?: SessionVerificationLevelinstead oflevel: SessionVerificationLevel | undefinedfor more idiomatic TypeScriptApply this diff:
export type NeedsReverificationParameters = { /** * Marks the reverification process as cancelled and rejects the original request. */ - cancel: () => void; + readonly cancel: () => void; /** * Marks the reverification process as complete and retries the original request. */ - complete: () => void; + readonly complete: () => void; /** * The verification level required for the reverification process. */ - level: SessionVerificationLevel | undefined; + readonly level?: SessionVerificationLevel; };
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
- packages/shared/src/react/hooks/useReverification.ts(2 hunks)
🧰 Additional context used
📓 Path-based instructions (6)
**/*.{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/shared/src/react/hooks/useReverification.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/shared/src/react/hooks/useReverification.ts
packages/**/*.{ts,tsx}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
TypeScript is required for all packages
Files:
- packages/shared/src/react/hooks/useReverification.ts
packages/**/*.{ts,tsx,d.ts}
📄 CodeRabbit inference engine (.cursor/rules/development.mdc)
Packages should export TypeScript types alongside runtime code
Files:
- packages/shared/src/react/hooks/useReverification.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
Avoidanytype - preferunknownwhen type is uncertain, then narrow with type guards
Useinterfacefor object shapes that might be extended
Usetypefor unions, primitives, and computed types
Preferreadonlyproperties for immutable data structures
Useprivatefor internal implementation details
Useprotectedfor inheritance hierarchies
Usepublicexplicitly for clarity in public APIs
Preferreadonlyfor 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
Useconst assertionsfor literal types:as const
Usesatisfiesoperator 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 ...
Noanytypes without justification
Proper error handling with typed errors
Consistent use ofreadonlyfor 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/shared/src/react/hooks/useReverification.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/shared/src/react/hooks/useReverification.ts
🧬 Code graph analysis (1)
packages/shared/src/react/hooks/useReverification.ts (1)
packages/types/src/sessionVerification.ts (1)
SessionVerificationLevel(50-50)
⏰ 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: Formatting | Dedupe | Changeset
- GitHub Check: Build Packages
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: semgrep-cloud-platform/scan
- GitHub Check: semgrep-cloud-platform/scan
🔇 Additional comments (2)
packages/shared/src/react/hooks/useReverification.ts (2)
55-65: LGTM — Proper JSDoc with nested parameter documentation.The type export and JSDoc correctly document the
onNeedsReverificationcallback with nested field descriptions, which will generate accurate TypeDoc output.
70-72: Verify whetherUseReverificationResultshould be exported.The PR objectives emphasize exposing typed metadata (return types and parameters) via TypeDoc.
UseReverificationResultrepresents the hook's return type but isn't currently exported.Should this type be exported to provide complete public API documentation, similar to
NeedsReverificationParametersandUseReverificationOptions?
| Found 3 test failures on Blacksmith runners: 
 | 
Description
Fixes https://linear.app/clerk/issue/DOCS-10983/ensure-all-hooks-are-using-typedocs-have-code-examples-for-each.
This PR is part of a broader project aimed at adding more code examples to our hooks documentation. During project discussions, we agreed that the current structure of our hooks docs needed to be revisited. Currently, most of the hook pages are fully rendered through Typedoc, including code examples. However, adding additional examples through Typedoc would have required significant restructuring of the JavaScript repo.
To address this, we decided to:
clerk-docsfor this: https://github.com/clerk/clerk-docs/pull/2649/filesAdditionally, not all hooks currently use Typedoc. This PR also ensures that all hooks are properly configured to use Typedoc for their returns and parameters.
This PR includes:
This PR will be the first in a sequence. Once merged, we’ll proceed with its sibling PR in
clerk-docs,which:Hooks checklist
useAuth,useReverificationand the billing hooks - can be compared to what's on the live docs.How to test
In order to test this properly, you will need to do the following:
javascriptrepo, switch to the branch of this PRpnpm run typedoc:generatess/DOCS-10983npm run typedoc:link ../javascript/.typedoc/docsImportant notes/ discussion pts
Checklist
pnpm testruns as expected.pnpm buildruns as expected.Type of change
Summary by CodeRabbit
New Features
Documentation
useCheckout,usePaymentElement, anduseSubscription.