Skip to content

Comments

perf: Remove next-i18next dependency from packages/emails and packages/lib#23531

Merged
volnei merged 4 commits intomainfrom
refactor/remove-type-imports-from-next-i18next
Sep 3, 2025
Merged

perf: Remove next-i18next dependency from packages/emails and packages/lib#23531
volnei merged 4 commits intomainfrom
refactor/remove-type-imports-from-next-i18next

Conversation

@hbjORbj
Copy link
Contributor

@hbjORbj hbjORbj commented Sep 3, 2025

What does this PR do?

  • packages/lib already has a dep called i18next, so we can remove next-i18next and use that package instead
  • packages/emails has a dependency on packages/lib, so we can also safely remove next-i18next

Mandatory Tasks (DO NOT REMOVE)

  • I have self-reviewed the code (A decent size PR without self-review might be rejected).
  • N/A - I have updated the developer docs in /docs if this PR makes changes that would require a documentation change. If N/A, write N/A here and check the checkbox.
  • I confirm automated tests are in place that prove my fix is effective or that my feature works.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 3, 2025

Walkthrough

This change removes the next-i18next dependency from packages/emails and packages/lib. It updates TypeScript type imports to source TFunction from i18next instead of next-i18next across multiple files: packages/emails/src/templates/CreditBalanceLimitReachedEmail.tsx, packages/emails/src/templates/CreditBalanceLowWarningEmail.tsx, packages/features/CalendarEventBuilder.ts, and packages/features/CalendarEventBuilder.test.ts. No runtime logic or public API behavior changes are introduced; modifications are limited to dependency declarations and type import paths.

Possibly related PRs

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/remove-type-imports-from-next-i18next

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 or @coderabbit 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.

@graphite-app graphite-app bot requested review from a team September 3, 2025 00:52
@keithwillcode keithwillcode added core area: core, team members only foundation labels Sep 3, 2025
@hbjORbj hbjORbj changed the title refactor: remove type imports from next i18next refactor: Remove type imports from next-i18next package Sep 3, 2025
@dosubot dosubot bot added i18n area: i18n, translations 💻 refactor labels Sep 3, 2025
@pull-request-size pull-request-size bot added size/S and removed size/XS labels Sep 3, 2025
@vercel
Copy link

vercel bot commented Sep 3, 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 Sep 3, 2025 1:24am
cal-eu Ignored Ignored Sep 3, 2025 1:24am

@hbjORbj hbjORbj changed the title refactor: Remove type imports from next-i18next package perf: Remove next-i18next dependency from packages/emails and packages/lib Sep 3, 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: 1

📜 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 e1def88 and 5efa3a7.

📒 Files selected for processing (6)
  • packages/emails/package.json (0 hunks)
  • packages/emails/src/templates/CreditBalanceLimitReachedEmail.tsx (1 hunks)
  • packages/emails/src/templates/CreditBalanceLowWarningEmail.tsx (1 hunks)
  • packages/features/CalendarEventBuilder.test.ts (1 hunks)
  • packages/features/CalendarEventBuilder.ts (1 hunks)
  • packages/lib/package.json (0 hunks)
💤 Files with no reviewable changes (2)
  • packages/emails/package.json
  • packages/lib/package.json
🧰 Additional context used
📓 Path-based instructions (4)
**/*.ts

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

**/*.ts: For Prisma queries, only select data you need; never use include, always use select
Ensure the credential.key field is never returned from tRPC endpoints or APIs

Files:

  • packages/features/CalendarEventBuilder.test.ts
  • packages/features/CalendarEventBuilder.ts
**/*.{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:

  • packages/features/CalendarEventBuilder.test.ts
  • packages/features/CalendarEventBuilder.ts
  • packages/emails/src/templates/CreditBalanceLimitReachedEmail.tsx
  • packages/emails/src/templates/CreditBalanceLowWarningEmail.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:

  • packages/features/CalendarEventBuilder.test.ts
  • packages/features/CalendarEventBuilder.ts
  • packages/emails/src/templates/CreditBalanceLimitReachedEmail.tsx
  • packages/emails/src/templates/CreditBalanceLowWarningEmail.tsx
**/*.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:

  • packages/emails/src/templates/CreditBalanceLimitReachedEmail.tsx
  • packages/emails/src/templates/CreditBalanceLowWarningEmail.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). (3)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: Type check / check-types
  • GitHub Check: Tests / Unit
🔇 Additional comments (3)
packages/features/CalendarEventBuilder.test.ts (1)

1-1: Test type import updated appropriately

Casting vi.fn to TFunction remains compatible with i18next’s TFunction signature.

packages/emails/src/templates/CreditBalanceLowWarningEmail.tsx (1)

1-1: Email template type import migrated cleanly

Type-only import from i18next is correct and keeps bundle clean.

packages/emails/src/templates/CreditBalanceLimitReachedEmail.tsx (1)

1-1: Consistent migration to i18next types

Change aligns with the repo-wide refactor; no runtime impact.

@@ -1,5 +1,5 @@
import type { Prisma } from "@prisma/client";
import type { TFunction } from "next-i18next";
import type { TFunction } from "i18next";
Copy link
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Type import source switch looks correct and side-effect free

Using import type { TFunction } from "i18next" matches the refactor goal and won’t affect runtime.

Run this to ensure there are no lingering next-i18next type imports or deps across the repo:


🏁 Script executed:

#!/bin/bash
# Find any remaining next-i18next imports
rg -nP --type=ts --type=tsx $'from\\s+[\"\']next-i18next[\"\']'

# Specifically catch TFunction from next-i18next
rg -nP --type=ts --type=tsx $'import\\s+type\\s*\\{[^}]*\\bTFunction\\b[^}]*\\}\\s*from\\s*[\"\']next-i18next[\"\']'

# Check package.json files for next-i18next and verify i18next presence
rg -n '\"next-i18next\"' -g '**/package.json'
echo '--- i18next occurrences ---'
rg -n '\"i18next\"' -g '**/package.json'

Length of output: 550


🏁 Script executed:

#!/bin/bash
# Search for any remaining next-i18next imports in .ts and .tsx files
rg -nP 'from\s+["\x27]next-i18next["\x27]' -g '*.ts' -g '*.tsx'

# Specifically catch TFunction imported from next-i18next
rg -nP 'import\s+type\s*\{[^}]*\bTFunction\b[^}]*\}\s*from\s+["\x27]next-i18next["\x27]' -g '*.ts' -g '*.tsx'

# Check package.json files for next-i18next dependency
rg -n '"next-i18next"' -g '**/package.json'

echo '--- i18next occurrences ---'
# Verify presence of i18next in package.json files
rg -n '"i18next"' -g '**/package.json'

Length of output: 525


Remove or update remaining next-i18next usages

  • Runtime import in apps/web/lib/app-providers.tsx:6:
    import { appWithTranslation } from "next-i18next"
  • Dependency in apps/web/package.json:112:
    "next-i18next": "^15.4.2"
🤖 Prompt for AI Agents
packages/features/CalendarEventBuilder.ts around line 2: leftover i18n wiring
references to next-i18next remain; remove or update all next-i18next usages
across the repo by (1) removing the runtime import appWithTranslation from
apps/web/lib/app-providers.tsx and replacing it with the project’s chosen i18n
integration (or the framework’s native i18n wrapper) so no runtime import to
next-i18next is required, (2) removing the next-i18next dependency from
apps/web/package.json (or replacing it with the correct i18n package and
updating import sites), and (3) in this file ensure only correct types/imports
are used (keep type imports from i18next if the project uses i18next, otherwise
remove or replace them to match the chosen i18n library).

@github-actions
Copy link
Contributor

github-actions bot commented Sep 3, 2025

E2E results are ready!

@hbjORbj hbjORbj marked this pull request as ready for review September 3, 2025 06:19
@dosubot dosubot bot added the ⬆️ dependencies Pull requests that update a dependency file label Sep 3, 2025
@volnei volnei merged commit f4b23b3 into main Sep 3, 2025
113 of 116 checks passed
@volnei volnei deleted the refactor/remove-type-imports-from-next-i18next branch September 3, 2025 12:36
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 ⬆️ dependencies Pull requests that update a dependency file foundation i18n area: i18n, translations ready-for-e2e 💻 refactor size/S

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants