perf: Remove next-i18next dependency from packages/emails and packages/lib#23531
perf: Remove next-i18next dependency from packages/emails and packages/lib#23531
Conversation
WalkthroughThis 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 unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
Status, Documentation and Community
|
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
There was a problem hiding this comment.
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.
📒 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 useinclude, always useselect
Ensure thecredential.keyfield is never returned from tRPC endpoints or APIs
Files:
packages/features/CalendarEventBuilder.test.tspackages/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.tspackages/features/CalendarEventBuilder.tspackages/emails/src/templates/CreditBalanceLimitReachedEmail.tsxpackages/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.tspackages/features/CalendarEventBuilder.tspackages/emails/src/templates/CreditBalanceLimitReachedEmail.tsxpackages/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.tsxpackages/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 appropriatelyCasting
vi.fntoTFunctionremains compatible with i18next’sTFunctionsignature.packages/emails/src/templates/CreditBalanceLowWarningEmail.tsx (1)
1-1: Email template type import migrated cleanlyType-only import from
i18nextis correct and keeps bundle clean.packages/emails/src/templates/CreditBalanceLimitReachedEmail.tsx (1)
1-1: Consistent migration to i18next typesChange 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"; | |||
There was a problem hiding this comment.
💡 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).
E2E results are ready! |
What does this PR do?
packages/libalready has a dep calledi18next, so we can removenext-i18nextand use that package insteadpackages/emailshas a dependency onpackages/lib, so we can also safely removenext-i18nextMandatory Tasks (DO NOT REMOVE)