Skip to content

fix: remove TypeScript path mapping and standardize @calcom/ui imports#23359

Merged
hbjORbj merged 3 commits intomainfrom
devin/fix-ui-imports-1756211340
Aug 26, 2025
Merged

fix: remove TypeScript path mapping and standardize @calcom/ui imports#23359
hbjORbj merged 3 commits intomainfrom
devin/fix-ui-imports-1756211340

Conversation

@hbjORbj
Copy link
Contributor

@hbjORbj hbjORbj commented Aug 26, 2025

What does this PR do?

This PR removes a TypeScript path mapping configuration that was enabling ambiguous import syntax and standardizes all @calcom/ui imports to use explicit, canonical paths.

Key Changes:

  • Removes "@calcom/ui/*": ["../../packages/ui/components/*"] path mapping from apps/web/tsconfig.json
  • Updates import statements from @calcom/ui/componentName to @calcom/ui/components/componentName

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. N/A - This is an internal import standardization that doesn't require documentation changes.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

- Remove '@calcom/ui/*': ['../../packages/ui/components/*'] path mapping from apps/web/tsconfig.json
- Fix imports from '@calcom/ui/componentName' to '@calcom/ui/components/componentName' format
- Preserve direct exports like '@calcom/ui/classNames' and '@calcom/ui/styles'
- Update 200+ files across apps/web, packages/features, packages/app-store, and packages/ui
- Fix localStorage usage to use safe webstorage import
- Remove forbidden 'as any' type casting in favor of proper TypeScript types
- All changes verified to pass TypeScript compilation

Co-Authored-By: benny@cal.com <sldisek783@gmail.com>
@devin-ai-integration
Copy link
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 26, 2025

Walkthrough

This PR updates UI import paths across several files to the new @calcom/ui/components/* locations:

  • AdvancedPermissionGroup.tsx: Checkbox, Label.
  • CreateRoleCta.tsx: Button.
  • RoleSheet.tsx: Button, Form, TextField, Checkbox, Label.
  • RolesList.tsx: Badge, Button.
  • BillingCredits.tsx: showToast.
    Additionally, apps/web/tsconfig.json removes the @calcom/ui/* path alias that previously mapped to ../../packages/ui/components/*. No component logic, event handling, or exports are changed.

Possibly related PRs

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch devin/fix-ui-imports-1756211340

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

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

Support

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

CodeRabbit Commands (Invoked using PR/Issue comments)

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

Other keywords and placeholders

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

Status, Documentation and Community

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

@keithwillcode keithwillcode added core area: core, team members only foundation labels Aug 26, 2025
@hbjORbj hbjORbj requested a review from emrysal August 26, 2025 12:42
@hbjORbj hbjORbj marked this pull request as ready for review August 26, 2025 12:42
@hbjORbj hbjORbj requested review from a team and removed request for emrysal August 26, 2025 12:42
@graphite-app graphite-app bot requested a review from a team August 26, 2025 12:42
@hbjORbj hbjORbj enabled auto-merge (squash) August 26, 2025 12:42
@dosubot dosubot bot added the 🧹 Improvements Improvements to existing features. Mostly UX/UI label Aug 26, 2025
@vercel
Copy link

vercel bot commented Aug 26, 2025

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

2 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
cal Ignored Ignored Aug 26, 2025 0:44am
cal-eu Ignored Ignored Aug 26, 2025 0:44am

@graphite-app
Copy link

graphite-app bot commented Aug 26, 2025

Graphite Automations

"Add consumer team as reviewer" took an action on this PR • (08/26/25)

1 reviewer was added to this PR based on Keith Williams's automation.

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
apps/web/app/(use-page-wrapper)/settings/(settings-layout)/organizations/roles/_components/RoleSheet.tsx (2)

153-160: Remove forbidden as any casts by typing permissions.

Casting to any masks type mismatches and contradicts the PR’s code-quality goals. Given the form builds permissions as string identifiers (resource.action), these can likely be typed as string[].

Apply this diff:

-      updateMutation.mutate({
+      updateMutation.mutate({
         teamId,
         roleId: role.id,
         name: values.name,
-        permissions: values.permissions as any,
+        permissions: values.permissions as string[],
         color: values.color,
       });
-      createMutation.mutate({
+      createMutation.mutate({
         teamId,
         name: values.name,
         description: values.description,
         color: values.color,
-        permissions: values.permissions as any,
+        permissions: values.permissions as string[],
       });

If the mutation expects a richer type, introduce a converter (e.g., from "resource.action" to { resource, action }) instead of using any. I can generate that transformation once we confirm the TRPC input type.

Also applies to: 161-168


148-151: Refactor RoleSheet to use the safe @calcom/lib/webstorage wrapper

Replace the direct browser localStorage call with the shared wrapper exported from @calcom/lib/webstorage. This ensures consistent, SSR-safe behavior and handles restricted storage contexts.

• In apps/web/app/(use-page-wrapper)/settings/(settings-layout)/organizations/roles/_components/RoleSheet.tsx, add at the top:

+ import { localStorage as safeStorage } from "@calcom/lib/webstorage";

• Then update the block at lines 148–151 to use safeStorage.setItem instead of localStorage.setItem:

-    // Store the color in localStorage
-    const roleKey = isEditing && role ? role.id : `new_role_${values.name}`;
-    localStorage.setItem(`role_color_${roleKey}`, values.color);
+    // Persist role color via the safe storage abstraction
+    const roleKey = isEditing && role ? role.id : `new_role_${values.name}`;
+    safeStorage.setItem(`role_color_${roleKey}`, values.color);

This aligns with the existing wrapper API in packages/lib/webstorage.ts and avoids uncaught errors when storage is unavailable.

🧹 Nitpick comments (4)
apps/web/tsconfig.json (1)

12-13: Add a lightweight guard to prevent regressions.

Until a proper ESLint rule is agreed upon, add a CI step that fails on reintroduction of disallowed imports (same ripgrep as above). If you prefer a lint solution, we can wire up a custom ESLint rule (or use eslint-plugin-import with project-specific patterns) to disallow @calcom/ui/* except @calcom/ui/components/**, @calcom/ui/classNames, and @calcom/ui/styles.

Happy to open a follow-up PR adding the CI check and/or an ESLint rule with a repo-wide autofixable message.

apps/web/modules/settings/billing/components/BillingCredits.tsx (3)

129-136: Localize link text and add rel="noopener noreferrer" for external link security.

The visible "Learn more" string should use t() per i18n guidelines, and external links opened with target="_blank" should set rel="noopener noreferrer".

Apply this diff:

-            <Link
-              key="Credit System"
-              className="underline underline-offset-2"
-              target="_blank"
-              href="https://cal.com/help/billing-and-usage/messaging-credits">
-              Learn more
-            </Link>,
+            <Link
+              key="Credit System"
+              className="underline underline-offset-2"
+              target="_blank"
+              rel="noopener noreferrer"
+              href="https://cal.com/help/billing-and-usage/messaging-credits">
+              {t("learn_more")}
+            </Link>,

93-93: Slugify the filename across all whitespace, not just the first space.

replace(" ", "-") only replaces the first occurrence. Replace all whitespace to avoid surprises like multiple spaces or tabs.

-        const filename = `credit-expense-log-${selectedMonth.value.toLowerCase().replace(" ", "-")}.csv`;
+        const filename = `credit-expense-log-${selectedMonth.value.toLowerCase().replace(/\s+/g, "-")}.csv`;

53-53: Consider a named export for consistency and tree-shaking.

Project guidelines encourage named exports in TSX where possible. If this component isn’t required to be a default export, convert to a named export and update imports.

-export default function BillingCredits() {
+export function BillingCredits() {

If you want, I can open a follow-up to batch-convert nearby components for consistency.

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • 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 a22ca47 and bca4e98.

📒 Files selected for processing (6)
  • apps/web/app/(use-page-wrapper)/settings/(settings-layout)/organizations/roles/_components/AdvancedPermissionGroup.tsx (1 hunks)
  • apps/web/app/(use-page-wrapper)/settings/(settings-layout)/organizations/roles/_components/CreateRoleCta.tsx (1 hunks)
  • apps/web/app/(use-page-wrapper)/settings/(settings-layout)/organizations/roles/_components/RoleSheet.tsx (1 hunks)
  • apps/web/app/(use-page-wrapper)/settings/(settings-layout)/organizations/roles/_components/RolesList.tsx (1 hunks)
  • apps/web/modules/settings/billing/components/BillingCredits.tsx (1 hunks)
  • apps/web/tsconfig.json (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.tsx

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

Always use t() for text localization in frontend code; direct text embedding should trigger a warning

Files:

  • apps/web/app/(use-page-wrapper)/settings/(settings-layout)/organizations/roles/_components/RoleSheet.tsx
  • apps/web/app/(use-page-wrapper)/settings/(settings-layout)/organizations/roles/_components/CreateRoleCta.tsx
  • apps/web/modules/settings/billing/components/BillingCredits.tsx
  • apps/web/app/(use-page-wrapper)/settings/(settings-layout)/organizations/roles/_components/RolesList.tsx
  • apps/web/app/(use-page-wrapper)/settings/(settings-layout)/organizations/roles/_components/AdvancedPermissionGroup.tsx
**/*.{ts,tsx}

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

Flag excessive Day.js use in performance-critical code; prefer native Date or Day.js .utc() in hot paths like loops

Files:

  • apps/web/app/(use-page-wrapper)/settings/(settings-layout)/organizations/roles/_components/RoleSheet.tsx
  • apps/web/app/(use-page-wrapper)/settings/(settings-layout)/organizations/roles/_components/CreateRoleCta.tsx
  • apps/web/modules/settings/billing/components/BillingCredits.tsx
  • apps/web/app/(use-page-wrapper)/settings/(settings-layout)/organizations/roles/_components/RolesList.tsx
  • apps/web/app/(use-page-wrapper)/settings/(settings-layout)/organizations/roles/_components/AdvancedPermissionGroup.tsx
**/*.{ts,tsx,js,jsx}

⚙️ CodeRabbit configuration file

Flag default exports and encourage named exports. Named exports provide better tree-shaking, easier refactoring, and clearer imports. Exempt main components like pages, layouts, and components that serve as the primary export of a module.

Files:

  • apps/web/app/(use-page-wrapper)/settings/(settings-layout)/organizations/roles/_components/RoleSheet.tsx
  • apps/web/app/(use-page-wrapper)/settings/(settings-layout)/organizations/roles/_components/CreateRoleCta.tsx
  • apps/web/modules/settings/billing/components/BillingCredits.tsx
  • apps/web/app/(use-page-wrapper)/settings/(settings-layout)/organizations/roles/_components/RolesList.tsx
  • apps/web/app/(use-page-wrapper)/settings/(settings-layout)/organizations/roles/_components/AdvancedPermissionGroup.tsx
⏰ Context from checks skipped due to timeout of 180000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: Production builds / Build Web App
  • GitHub Check: Production builds / Build Atoms
  • GitHub Check: Production builds / Build API v1
  • GitHub Check: Linters / lint
  • GitHub Check: Production builds / Build API v2
  • GitHub Check: Tests / Unit
  • GitHub Check: Type check / check-types
🔇 Additional comments (7)
apps/web/app/(use-page-wrapper)/settings/(settings-layout)/organizations/roles/_components/AdvancedPermissionGroup.tsx (1)

9-9: LGTM! Import path updated correctly.

The import path for Checkbox and Label has been correctly updated from @calcom/ui/form to @calcom/ui/components/form, following the PR's standardization of UI component imports.

apps/web/tsconfig.json (2)

12-13: No client-side imports of server-only alias detected

I searched apps/web/app, apps/web/pages, and apps/web/components for any occurrences of @calcom/repository/ and found none. This confirms that no client-bundled code imports from the server-only alias, so it’s safe to keep:

 "@calcom/repository/*": ["@calcom/lib/server/repository/*"]

in apps/web/tsconfig.json.


12-13: Approve alias removal and repository alias unchanged

All quick sanity checks returned no findings—there are no lingering @calcom/ui/* imports outside the allowed direct-exports, no other tsconfig still declaring the removed alias, and no webpack alias fallbacks in Next.js, Jest, or Storybook configs. The removal of the @calcom/ui/* alias is clean, and keeping the @calcom/repository/* mapping looks correct. Great work!

apps/web/modules/settings/billing/components/BillingCredits.tsx (1)

19-19: Canonical toast import path: looks good.

Import updated to the canonical "@calcom/ui/components/toast" path. No further changes needed here.

apps/web/app/(use-page-wrapper)/settings/(settings-layout)/organizations/roles/_components/CreateRoleCta.tsx (1)

4-4: UI import path standardized: looks good.

Button now comes from "@calcom/ui/components/button", aligned with the new canonical path scheme.

apps/web/app/(use-page-wrapper)/settings/(settings-layout)/organizations/roles/_components/RolesList.tsx (1)

6-7: Badge/Button imports updated to canonical paths: looks good.

Imports now target "@calcom/ui/components/*" and keep "@calcom/ui/classNames" as a direct export, matching the PR objectives.

apps/web/app/(use-page-wrapper)/settings/(settings-layout)/organizations/roles/_components/RoleSheet.tsx (1)

17-19: UI import paths standardized: looks good.

Button and form controls now come from "@calcom/ui/components/*". No functional changes introduced here.

@github-actions
Copy link
Contributor

github-actions bot commented Aug 26, 2025

E2E results are ready!

Copy link
Contributor

@keithwillcode keithwillcode left a comment

Choose a reason for hiding this comment

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

Nice!

@hbjORbj hbjORbj merged commit 1cc5482 into main Aug 26, 2025
66 of 68 checks passed
@hbjORbj hbjORbj deleted the devin/fix-ui-imports-1756211340 branch August 26, 2025 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core area: core, team members only foundation 🧹 Improvements Improvements to existing features. Mostly UX/UI ready-for-e2e

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants