Skip to content

Conversation

nikosdouvlis
Copy link
Member

@nikosdouvlis nikosdouvlis commented Sep 30, 2025

Description

This ensure that all built-in global types are in sync with the actual runtime values

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

  • Chores
    • Updated build/test targets to ES2022 and published a patch; no public API changes.
  • Style / Lint
    • Turned off JSDoc "complete sentence" rule and removed local lint-suppression comments.
  • Tests
    • Hardened test setup and cleanup (timer tracking, environment mocks) and adjusted test typings.
  • Config
    • Disabled test coverage collection.
  • Notes
    • No runtime behavior or public-facing changes; older runtimes may require polyfills.

Copy link

changeset-bot bot commented Sep 30, 2025

🦋 Changeset detected

Latest commit: 79e5c79

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

This PR includes changesets to release 19 packages
Name Type
@clerk/shared Patch
@clerk/agent-toolkit Patch
@clerk/astro Patch
@clerk/backend Patch
@clerk/chrome-extension Patch
@clerk/clerk-js Patch
@clerk/elements Patch
@clerk/expo-passkeys Patch
@clerk/clerk-expo Patch
@clerk/express Patch
@clerk/fastify Patch
@clerk/nextjs Patch
@clerk/nuxt Patch
@clerk/react-router Patch
@clerk/clerk-react Patch
@clerk/remix Patch
@clerk/tanstack-react-start Patch
@clerk/testing Patch
@clerk/vue 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 Sep 30, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
clerk-js-sandbox Ready Ready Preview Comment Oct 1, 2025 11:17am

Copy link
Contributor

coderabbitai bot commented Sep 30, 2025

Walkthrough

Updates build targets to ES2022, adjusts ESLint JSDoc rules and removes two file-level disables, refactors a debounce hook's timer handling, strengthens test setup with timer tracking and jsdom globals, changes some test typings to declare, and disables Vitest coverage.

Changes

Cohort / File(s) Summary of changes
Changeset entry
\.changeset/quiet-lobsters-greet.md
Adds a patch changeset for @clerk/shared stating a target/lib bump to ES2022.
Shared package TS config
packages/shared/tsconfig.json
Updates compilerOptions.target from ES2019ES2022 and compilerOptions.lib from ["ES6","DOM","WebWorker"]["ES2022","DOM","WebWorker"].
Tsup config
packages/shared/tsup.config.ts
Changes ES target from es2020es2022.
ESLint configuration
eslint.config.mjs
Sets jsdoc/require-description-complete-sentence to off in two rule locations (replacing prior warn).
React hooks — lint directives removed
packages/shared/src/react/hooks/useOrganization.tsx, packages/shared/src/react/hooks/useOrganizationList.tsx
Removes top-of-file /* eslint-disable jsdoc/require-description-complete-sentence */ comments; no runtime/API changes.
Debounce hook refactor
packages/clerk-js/src/ui/hooks/useDebounce.ts
Replaces stored timeout state and wrapper with a local timeoutId inside effect, uses a single setTimeout to update debouncedValue, and cleans up via clearTimeout(timeoutId) on effect teardown.
Tests — typing adjustments
packages/shared/src/__tests__/deprecated.test.ts
Changes several class property declarations to declare (e.g., someProp: stringdeclare someProp: string) to avoid emitted properties in tests.
Vitest setup and environment
packages/clerk-js/vitest.setup.mts
Adds timer tracking/cleanup (wraps global.setTimeout/clearTimeout, clears active timers in afterEach and resets in beforeEach), exposes isSecureContext on globalThis (writable), and expands test environment mocks/bootstrapping.
Vitest config
packages/clerk-js/vitest.config.mts
Disables test coverage collection (flips coverage flag from truefalse).

Sequence Diagram(s)

sequenceDiagram
  participant Component
  participant useDebounce
  participant Timer

  rect rgb(240,248,255)
    Component->>useDebounce: mount or value change(value, delay)
    useDebounce->>Timer: setTimeout(() => setDebouncedValue(value), delay)
  end

  rect rgb(255,240,245)
    Component->>useDebounce: unmount or dependency change
    useDebounce->>Timer: clearTimeout(timeoutId)
  end
Loading
sequenceDiagram
  participant Test
  participant GlobalTimers
  participant afterEach

  rect rgb(240,255,240)
    Test->>GlobalTimers: global.setTimeout(...) (wrapped -> register timer)
    Test->>GlobalTimers: global.clearTimeout(...) (wrapped -> unregister timer)
  end

  rect rgb(255,245,230)
    afterEach->>GlobalTimers: iterate active timers -> clear each
    afterEach->>GlobalTimers: reset registry
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

I hopped through targets, small and keen,
Timers wrangled, lint lines seen.
Typings whispered "declare" with care,
Tests now tidy, globals fair. 🐇✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title “chore(shared): Bump target/lib to ES2022” accurately and concisely summarizes the primary change of updating the shared package’s compile target and library configuration to ES2022, making it clear to reviewers what the main intent of the pull request is.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch nikos/update-shared-tsconfig

📜 Recent 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.

📥 Commits

Reviewing files that changed from the base of the PR and between 8853dc8 and 424f7fa.

📒 Files selected for processing (1)
  • .changeset/quiet-lobsters-greet.md (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • .changeset/quiet-lobsters-greet.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). (6)
  • GitHub Check: Build Packages
  • GitHub Check: Formatting | Dedupe | Changeset
  • GitHub Check: semgrep/ci
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: semgrep-cloud-platform/scan

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

pkg-pr-new bot commented Sep 30, 2025

Open in StackBlitz

@clerk/agent-toolkit

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

@clerk/astro

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

@clerk/backend

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

@clerk/chrome-extension

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

@clerk/clerk-js

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

@clerk/dev-cli

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

@clerk/elements

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

@clerk/clerk-expo

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

@clerk/expo-passkeys

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

@clerk/express

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

@clerk/fastify

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

@clerk/localizations

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

@clerk/nextjs

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

@clerk/nuxt

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

@clerk/clerk-react

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

@clerk/react-router

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

@clerk/remix

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

@clerk/shared

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

@clerk/tanstack-react-start

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

@clerk/testing

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

@clerk/themes

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

@clerk/types

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

@clerk/upgrade

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

@clerk/vue

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

commit: 79e5c79

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: 2

🧹 Nitpick comments (1)
packages/shared/tsconfig.json (1)

15-15: Optional: include DOM.Iterable in lib for iterable DOM collections

Helps TS know NodeList/HTMLCollection are iterable in for..of/spread without extra downleveling.

-    "lib": ["ES2022", "DOM", "WebWorker"],
+    "lib": ["ES2022", "DOM", "DOM.Iterable", "WebWorker"],
📜 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.

📥 Commits

Reviewing files that changed from the base of the PR and between dce68e1 and 566f273.

📒 Files selected for processing (2)
  • .changeset/quiet-lobsters-greet.md (1 hunks)
  • packages/shared/tsconfig.json (2 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
.changeset/**

📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)

Automated releases must use Changesets.

Files:

  • .changeset/quiet-lobsters-greet.md
**/*.{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/tsconfig.json
packages/*/tsconfig.json

📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)

Type checking must be performed with TypeScript and publint.

Files:

  • packages/shared/tsconfig.json
⏰ 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). (23)
  • GitHub Check: Integration Tests (nextjs, chrome, 15)
  • GitHub Check: Integration Tests (vue, chrome)
  • GitHub Check: Integration Tests (quickstart, chrome)
  • GitHub Check: Integration Tests (machine, chrome)
  • GitHub Check: Integration Tests (tanstack-react-router, chrome)
  • GitHub Check: Integration Tests (sessions:staging, chrome)
  • GitHub Check: Integration Tests (custom, chrome)
  • GitHub Check: Integration Tests (nextjs, chrome, 14)
  • GitHub Check: Integration Tests (nuxt, chrome)
  • GitHub Check: Integration Tests (localhost, chrome)
  • GitHub Check: Integration Tests (expo-web, chrome)
  • GitHub Check: Integration Tests (astro, chrome)
  • GitHub Check: Integration Tests (react-router, chrome)
  • GitHub Check: Integration Tests (tanstack-react-start, chrome)
  • GitHub Check: Integration Tests (billing, chrome)
  • GitHub Check: Integration Tests (handshake, chrome)
  • GitHub Check: Integration Tests (handshake:staging, chrome)
  • GitHub Check: Integration Tests (ap-flows, chrome)
  • GitHub Check: Integration Tests (elements, chrome)
  • GitHub Check: Integration Tests (sessions, chrome)
  • GitHub Check: Integration Tests (express, chrome)
  • GitHub Check: Integration Tests (generic, chrome)
  • GitHub Check: Static analysis
🔇 Additional comments (1)
packages/shared/tsconfig.json (1)

3-3: Please run the following to locate all bundler config files and check for any target overrides:

#!/bin/bash
find . -type f \( \
  -name "tsup.config.*" \
  -o -name "rollup.config.*" \
  -o -name "vite.config.*" \
  -o -name "esbuild.*.js" \
  -o -name "esbuild.*.ts" \
\) | while read -r f; do
  echo "=== $f ==="
  grep -E 'target|ES20|jsx|module' -C1 "$f" || echo "no target override"
done

Share the output so we can confirm whether your build pipeline is down‐leveling ES2022.

{
"compilerOptions": {
"target": "ES2019",
"target": "ES2022",
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Mismatch with changeset/PR title: ES2022 here vs ES2020 in release note

tsconfig sets target/lib to ES2022, but the changeset and PR title say ES2020. Please align them before merge.

Two ways to resolve:

Option A — Keep ES2022 (update changeset/PR messaging):

- Bump target/lib for `@clerk/shared` to ES2020
+ Bump target/lib for `@clerk/shared` to ES2022

Option B — Actually target ES2020 (update tsconfig):

-    "target": "ES2022",
+    "target": "ES2020",
-    "lib": ["ES2022", "DOM", "WebWorker"],
+    "lib": ["ES2020", "DOM", "WebWorker"],

Also applies to: 15-15

🤖 Prompt for AI Agents
In packages/shared/tsconfig.json around line 3, the compiler target is set to
"ES2022" but the changeset/PR title and release notes state "ES2020"; align them
before merge by either (A) keeping ES2022 — update the changeset and PR
title/release note to reference ES2022 and adjust any docs that mention ES2020,
or (B) truly target ES2020 — change the "target" (and corresponding "lib"
entries if present) to "ES2020" in tsconfig.json and run a quick build/test to
ensure no APIs require ES2022; pick one option and apply the matching edits
consistently across the repo and release metadata.

@nikosdouvlis nikosdouvlis changed the title chore(shared): Bump target/lib to ES2020 chore(shared): Bump target/lib to ES2022 Sep 30, 2025
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 (1)
eslint.config.mjs (1)

445-449: Duplicate JSDoc rule key; keep a single source of truth.

You set jsdoc/require-description-complete-sentence to both "warn" and "off" in the same rules object. The latter wins, but this is confusing. Remove the earlier entry.

       'jsdoc/require-hyphen-before-param-description': 'warn',
-      'jsdoc/require-description': 'warn',
-      'jsdoc/require-description-complete-sentence': 'warn',
+      'jsdoc/require-description': 'warn',
       'jsdoc/require-param': ['warn', { ignoreWhenAllParamsMissing: true }],
       'jsdoc/require-param-description': 'warn',
+      // Intentionally disabled to avoid per-file overrides in packages/shared
+      'jsdoc/require-description-complete-sentence': 'off',
       'jsdoc/require-returns': 'off',
📜 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.

📥 Commits

Reviewing files that changed from the base of the PR and between 566f273 and 4d89d10.

📒 Files selected for processing (3)
  • eslint.config.mjs (1 hunks)
  • packages/shared/src/react/hooks/useOrganization.tsx (0 hunks)
  • packages/shared/src/react/hooks/useOrganizationList.tsx (0 hunks)
💤 Files with no reviewable changes (2)
  • packages/shared/src/react/hooks/useOrganization.tsx
  • packages/shared/src/react/hooks/useOrganizationList.tsx
⏰ 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). (6)
  • GitHub Check: Build Packages
  • GitHub Check: Formatting | Dedupe | Changeset
  • GitHub Check: semgrep/ci
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: semgrep-cloud-platform/scan
🔇 Additional comments (1)
eslint.config.mjs (1)

18-18: Ignore ESLint ecmaVersion bump suggestion: root tsconfig.json still targets ES2019, not ES2022.

Likely an incorrect or invalid review comment.

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: 1

🧹 Nitpick comments (2)
packages/clerk-js/vitest.setup.mts (1)

41-47: Prefer a test-friendly stub for isSecureContext (or make it configurable).

Defining isSecureContext directly on globalThis works but is sticky. Either:

  • Minimal: mark it configurable to allow overrides in specific tests, or
  • Preferred: use vi.stubGlobal for automatic restore.

Minimal change:

 Object.defineProperties(globalThis, {
   TextDecoder: { value: TextDecoder },
   TextEncoder: { value: TextEncoder },
   Response: { value: FakeResponse },
   crypto: { value: crypto.webcrypto },
-  isSecureContext: { value: true, writable: true },
+  isSecureContext: { value: true, writable: true, configurable: true },
 });

Preferred approach:

 Object.defineProperties(globalThis, {
   TextDecoder: { value: TextDecoder },
   TextEncoder: { value: TextEncoder },
   Response: { value: FakeResponse },
   crypto: { value: crypto.webcrypto },
-  isSecureContext: { value: true, writable: true },
 });
+
+// Let Vitest manage lifecycle and restoration
+vi.stubGlobal('isSecureContext', true);
+
+afterAll(() => {
+  vi.unstubAllGlobals();
+});
packages/shared/tsup.config.ts (1)

29-36: Tighten types and keep worker transform target consistent.

  • The cast as any on WebWorkerMinifyPlugin can likely be dropped by aligning types.
  • Set esbuild.transform target to 'es2022' so worker code matches the bundle target.
-    esbuildPlugins: [WebWorkerMinifyPlugin as any],
+    esbuildPlugins: [WebWorkerMinifyPlugin],
-      const js = await esbuild.transform(f, { loader: 'ts', minify: true });
+      const js = await esbuild.transform(f, { loader: 'ts', minify: true, target: 'es2022' });

If TS still complains about plugin typing, import and use the exact type that tsup expects (it re-exports esbuild’s Plugin), or annotate the array as as Plugin[] instead of using any.

Also applies to: 42-51

📜 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.

📥 Commits

Reviewing files that changed from the base of the PR and between e5717c5 and b7cb7e3.

📒 Files selected for processing (2)
  • packages/clerk-js/vitest.setup.mts (1 hunks)
  • packages/shared/tsup.config.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/shared/tsup.config.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/tsup.config.ts
packages/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

TypeScript is required for all packages

Files:

  • packages/shared/tsup.config.ts
packages/**/*.{ts,tsx,d.ts}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

Packages should export TypeScript types alongside runtime code

Files:

  • packages/shared/tsup.config.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/shared/tsup.config.ts
packages/*/tsup.config.{js,ts}

📄 CodeRabbit inference engine (.cursor/rules/monorepo.mdc)

TypeScript compilation and bundling must use tsup.

Files:

  • packages/shared/tsup.config.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/tsup.config.ts
⏰ 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). (6)
  • GitHub Check: Formatting | Dedupe | Changeset
  • GitHub Check: Build Packages
  • GitHub Check: semgrep/ci
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: semgrep-cloud-platform/scan

sourcemap: true,
dts: true,
target: 'es2020',
target: 'es2022',
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Confirm runtime/browser support for ES2022 across consumers.

Bumping target to ES2022 tightens the minimum runtime. Please verify:

  • Node engines in all package.json files (ideally >= 18).
  • Browserslist targets (if published to web) match ES2022.

Run:


🏁 Script executed:

#!/usr/bin/env bash
# Verify engines and browserslist across the repo
jq -r '.name, .engines // empty, .browserslist // empty' **/package.json 2>/dev/null | sed '/^{\|}$/d' | paste - - - | column -t -s $'\t'

Length of output: 88


Below is a revised script to reliably list engines.node and browserslist across all package.json files. Please run it and share the output.


🏁 Script executed:

#!/usr/bin/env bash
find . -name package.json -print0 | while IFS= read -r -d '' file; do
  node_ver=$(jq -r '.engines.node // "<none>"' "$file")
  browsers=$(jq -r '.browserslist // "<none>"' "$file")
  printf "%s: engines.node=%s, browserslist=%s\n" "$file" "$node_ver" "$browsers"
done

Length of output: 7610


Enforce Node ≥18.17.0 and appropriate browserslist for ES2022

  • Numerous packages lack an engines.node field and could be installed on pre-ES2022 runtimes; add "engines": { "node": ">=18.17.0" } to every package.json.
  • Any package published for browsers must declare a browserslist target that only includes browsers supporting ES2022.
🤖 Prompt for AI Agents
In packages/shared/tsup.config.ts around line 27, the build target is ES2022 but
many packages lack an engines field and some browser-published packages lack a
browserslist limiting to ES2022-capable browsers; add "engines": { "node":
">=18.17.0" } to every package.json in the monorepo (root and all packages) and,
for any package that is published for browsers, add or tighten a browserslist
entry that only includes browsers with ES2022 support (or align it with the tsup
target), then ensure package lock/publish tooling and CI validate these fields
so installs on older Node versions or non-ES2022 browsers are prevented.

This ensure that all built-in global types are in sync with the actual runtime values
…declare' syntax

With ES2022, class fields create own instance properties at runtime. Those own properties shadow prototype accessors, so our deprecatedProperty getter never ran. Using declare prevents creating the runtime field, so accesses hit the prototype getter and emit the warning.
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: 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.

📥 Commits

Reviewing files that changed from the base of the PR and between b7cb7e3 and 8853dc8.

📒 Files selected for processing (10)
  • .changeset/quiet-lobsters-greet.md (1 hunks)
  • eslint.config.mjs (1 hunks)
  • packages/clerk-js/src/ui/hooks/useDebounce.ts (1 hunks)
  • packages/clerk-js/vitest.config.mts (1 hunks)
  • packages/clerk-js/vitest.setup.mts (2 hunks)
  • packages/shared/src/__tests__/deprecated.test.ts (4 hunks)
  • packages/shared/src/react/hooks/useOrganization.tsx (0 hunks)
  • packages/shared/src/react/hooks/useOrganizationList.tsx (0 hunks)
  • packages/shared/tsconfig.json (2 hunks)
  • packages/shared/tsup.config.ts (1 hunks)
💤 Files with no reviewable changes (2)
  • packages/shared/src/react/hooks/useOrganizationList.tsx
  • packages/shared/src/react/hooks/useOrganization.tsx
✅ Files skipped from review due to trivial changes (1)
  • .changeset/quiet-lobsters-greet.md
🚧 Files skipped from review as they are similar to previous changes (4)
  • packages/shared/tsconfig.json
  • eslint.config.mjs
  • packages/shared/tsup.config.ts
  • packages/shared/src/tests/deprecated.test.ts
🧰 Additional context used
📓 Path-based instructions (7)
packages/clerk-js/src/ui/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/clerk-js-ui.mdc)

packages/clerk-js/src/ui/**/*.{ts,tsx}: Element descriptors should always be camelCase
Use element descriptors in UI components to enable consistent theming and styling via appearance.elements
Element descriptors should generate unique, stable CSS classes for theming
Element descriptors should handle state classes (e.g., cl-loading, cl-active, cl-error, cl-open) automatically based on component state
Do not render hard-coded values; all user-facing strings must be localized using provided localization methods
Use the useLocalizations hook and localizationKeys utility for all text and error messages
Use the styled system (sx prop, theme tokens, responsive values) for custom component styling
Use useCardState for card-level state, useFormState for form-level state, and useLoadingStatus for loading states
Always use handleError utility for API errors and use translateError for localized error messages
Use useFormControl for form field state, implement proper validation, and handle loading and error states in forms
Use localization keys for all form labels and placeholders
Use element descriptors for consistent styling and follow the theme token system
Use the Card and FormContainer patterns for consistent UI structure

Files:

  • packages/clerk-js/src/ui/hooks/useDebounce.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/clerk-js/src/ui/hooks/useDebounce.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/clerk-js/src/ui/hooks/useDebounce.ts
packages/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

TypeScript is required for all packages

Files:

  • packages/clerk-js/src/ui/hooks/useDebounce.ts
packages/**/*.{ts,tsx,d.ts}

📄 CodeRabbit inference engine (.cursor/rules/development.mdc)

Packages should export TypeScript types alongside runtime code

Files:

  • packages/clerk-js/src/ui/hooks/useDebounce.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/clerk-js/src/ui/hooks/useDebounce.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/clerk-js/src/ui/hooks/useDebounce.ts
⏰ 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 (nextjs, chrome, 14)
  • GitHub Check: Integration Tests (react-router, chrome)
  • GitHub Check: Integration Tests (expo-web, chrome)
  • GitHub Check: Integration Tests (nextjs, chrome, 15)
  • GitHub Check: Integration Tests (custom, chrome)
  • GitHub Check: Integration Tests (machine, chrome)
  • GitHub Check: Integration Tests (handshake:staging, chrome)
  • GitHub Check: Integration Tests (billing, chrome)
  • GitHub Check: Integration Tests (nuxt, chrome)
  • GitHub Check: Integration Tests (sessions:staging, chrome)
  • GitHub Check: Integration Tests (tanstack-react-router, chrome)
  • GitHub Check: Integration Tests (handshake, chrome)
  • GitHub Check: Integration Tests (vue, chrome)
  • GitHub Check: Integration Tests (tanstack-react-start, chrome)
  • GitHub Check: Integration Tests (ap-flows, chrome)
  • GitHub Check: Integration Tests (astro, chrome)
  • GitHub Check: Integration Tests (elements, chrome)
  • GitHub Check: Integration Tests (sessions, chrome)
  • GitHub Check: Integration Tests (generic, chrome)
  • GitHub Check: Integration Tests (localhost, chrome)
  • GitHub Check: Integration Tests (quickstart, chrome)
  • GitHub Check: Integration Tests (express, chrome)
  • GitHub Check: Publish with pkg-pr-new
  • GitHub Check: Unit Tests (22, **)
  • GitHub Check: Static analysis
  • GitHub Check: semgrep-cloud-platform/scan
  • GitHub Check: semgrep-cloud-platform/scan

@nikosdouvlis nikosdouvlis merged commit 8777f35 into main Oct 1, 2025
41 checks passed
@nikosdouvlis nikosdouvlis deleted the nikos/update-shared-tsconfig branch October 1, 2025 11:34
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.

4 participants