Align check:format script with format script scope and format unformatted files#1582
Align check:format script with format script scope and format unformatted files#1582SinghaAnirban005 wants to merge 2 commits intoMail-0:stagingfrom
Conversation
WalkthroughThis change applies extensive formatting and stylistic consistency updates across multiple files in the codebase. The primary adjustment is narrowing the Changes
Sequence Diagram(s)Not applicable: No functional or control flow changes were introduced. Assessment against linked issues
Assessment against linked issues: Out-of-scope changesNo out-of-scope changes detected. Possibly related PRs
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (46)
✅ Files skipped from review due to trivial changes (12)
🚧 Files skipped from review as they are similar to previous changes (34)
✨ Finishing Touches
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. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
PR Summary
Updates the check:format script scope to target only apps/**/*.{ts,tsx} files and applies comprehensive formatting across 40+ files to ensure consistent code style.
- Modified
package.jsonto restrict check:format script from checking all files ('.') to only TypeScript/TSX files in apps directory - Standardized import ordering across files, following a pattern of external packages first, followed by internal imports
- Normalized Tailwind CSS class ordering for better maintainability in UI components
- Fixed inconsistent quote styles, converting double quotes to single quotes where appropriate
- Cleaned up whitespace, line endings, and indentation across multiple components
46 files reviewed, 6 comments
Edit PR Review Bot Settings | Greptile
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (8)
package.json (1)
18-21: Deduplicate Prettier glob to prevent future driftBoth
format(line 18) andcheck:format(line 20) hard-code the sameapps/**/*.{ts,tsx}glob. If the scope ever changes, there’s a real risk the two scripts diverge again.
A lightweight way to keep them in sync is to extract the glob into a helper script and reference it:"scripts": { + "prettier:glob": "apps/**/*.{ts,tsx}", "format": "prettier --write $(npm run -s prettier:glob) --log-level silent", - "check:format": "prettier --check apps/**/*.{ts,tsx}", + "check:format": "prettier --check $(npm run -s prettier:glob)",(Or use PNPM’s
--filtershorthand if preferred.)
This small DRY refactor eliminates duplication and guards against the issue #1580 regression re-appearing.apps/mail/hooks/use-hot-key.ts (4)
11-18: Consolidate modifier-key bookkeeping to reduce repetitionThe
Alt*andShift*key families are updated one‐by‐one. You can avoid duplication (and the risk of the two blocks diverging) by iterating over an array of the related key labels.- if (e.altKey) { - keyStates.set('Alt', true); - keyStates.set('AltLeft', true); - keyStates.set('AltRight', true); - } + ['Alt', 'AltLeft', 'AltRight'].forEach(k => keyStates.set(k, e.altKey)); … - if (e.shiftKey) { - keyStates.set('Shift', true); - keyStates.set('ShiftLeft', true); - keyStates.set('ShiftRight', true); - } + ['Shift', 'ShiftLeft', 'ShiftRight'].forEach(k => keyStates.set(k, e.shiftKey));Same idea applies in the
keyuphandler.
This trims nine individualsetcalls down to two loop iterations and keeps the two handlers symmetrical.Also applies to: 20-24
26-27: Remove noisy console logging (or guard it behind DEBUG)
console.log('Key down …')andconsole.log('Key up …')fire on every key event, which can flood the console and degrade performance in production. Consider:- console.log('Key down:', e.key, 'Alt:', e.altKey, 'Shift:', e.shiftKey); + if (process.env.NODE_ENV !== 'production') { + // eslint-disable-next-line no-console + console.debug('Key down:', e.key, 'Alt:', e.altKey, 'Shift:', e.shiftKey); + }Do the same for the
keyuplog.Also applies to: 46-47
31-44: Use a loop inkeyupto mirror thekeydownrefactorIf you adopt the array-based refactor above, apply the same pattern here to prevent copy-pasted lists from drifting.
- if (e.key === 'Alt' || e.key === 'AltLeft' || e.key === 'AltRight') { - keyStates.set('Alt', false); - keyStates.set('AltLeft', false); - keyStates.set('AltRight', false); - } + if (['Alt', 'AltLeft', 'AltRight'].includes(e.key)) { + ['Alt', 'AltLeft', 'AltRight'].forEach(k => keyStates.set(k, false)); + }Repeat for the Shift family.
49-55: Clear the map instead of setting every entry tofalse
keyStates.clear()is O(n) with less code and avoids leaving redundant keys set tofalse.- keyStates.forEach((_, key) => { - keyStates.set(key, false); - }); + keyStates.clear();This also resets the map to its minimal footprint.
apps/server/src/trpc/routes/categories.ts (1)
4-6: Consider returning a copy ofdefaultMailCategoriesto prevent accidental mutation.Because the same array instance is returned for every request, any consumer that (wrongly) mutates the result will mutate the shared singleton. A shallow clone is usually enough and costs virtually nothing.
- defaults: publicProcedure.query(() => defaultMailCategories), + defaults: publicProcedure.query(() => [...defaultMailCategories]),If nested objects might be mutated, use a deep clone instead.
apps/mail/hooks/use-copy-to-clipboard.ts (1)
7-11: Handle async clipboard errors for better UX
navigator.clipboard.writeTextis asynchronous and can fail (e.g., if the user blocks clipboard access). Swallowing the promise may leave users unaware of failures. Consider handling the promise and surfacing an error toast.- navigator.clipboard.writeText(value); - setCopiedValue(id); - toast.success('Link copied to clipboard!'); + navigator.clipboard.writeText(value) + .then(() => { + setCopiedValue(id); + toast.success('Link copied to clipboard!'); + }) + .catch(() => { + toast.error('Failed to copy link, please try again.'); + });apps/mail/hooks/use-categories.ts (1)
49-49: Missing terminal newline.The file no longer ends with a newline character, which may violate some linters / POSIX tools expectations.
-export function useDefaultCategoryId(): string { +export function useDefaultCategoryId(): string { … } +
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (46)
apps/mail/app/(auth)/login/error-message.tsx(1 hunks)apps/mail/app/(full-width)/privacy.tsx(3 hunks)apps/mail/app/(full-width)/terms.tsx(1 hunks)apps/mail/app/(routes)/settings/[...settings]/page.tsx(1 hunks)apps/mail/app/(routes)/settings/categories/page.tsx(15 hunks)apps/mail/app/(routes)/settings/labels/page.tsx(5 hunks)apps/mail/app/(routes)/settings/notifications/page.tsx(1 hunks)apps/mail/app/(routes)/settings/privacy/page.tsx(3 hunks)apps/mail/app/(routes)/settings/security/page.tsx(3 hunks)apps/mail/components/ai-toggle-button.tsx(1 hunks)apps/mail/components/context/loading-context.tsx(1 hunks)apps/mail/components/create/email-composer.tsx(4 hunks)apps/mail/components/home/HomeContent.tsx(2 hunks)apps/mail/components/home/footer.tsx(2 hunks)apps/mail/components/home/pixelated-bg.tsx(1 hunks)apps/mail/components/labels/label-dialog.tsx(3 hunks)apps/mail/components/mail/mail-iframe.tsx(1 hunks)apps/mail/components/mail/select-all-checkbox.tsx(3 hunks)apps/mail/components/mail/thread-display.tsx(1 hunks)apps/mail/components/ui/button.tsx(2 hunks)apps/mail/components/ui/command.tsx(1 hunks)apps/mail/components/ui/navigation-menu.tsx(1 hunks)apps/mail/components/ui/prompts-dialog.tsx(1 hunks)apps/mail/components/ui/responsive-modal.tsx(1 hunks)apps/mail/components/ui/settings-content.tsx(1 hunks)apps/mail/components/ui/sidebar.tsx(1 hunks)apps/mail/hooks/driver/use-delete.ts(1 hunks)apps/mail/hooks/use-categories.ts(2 hunks)apps/mail/hooks/use-copy-to-clipboard.ts(1 hunks)apps/mail/hooks/use-geo-location.ts(1 hunks)apps/mail/hooks/use-hot-key.ts(1 hunks)apps/mail/hooks/use-mail-navigation.ts(1 hunks)apps/mail/lib/countries.ts(1 hunks)apps/mail/lib/hotkeys/mail-list-hotkeys.tsx(1 hunks)apps/mail/lib/image-compression.ts(3 hunks)apps/mail/providers/client-providers.tsx(1 hunks)apps/mail/store/draftStates.ts(2 hunks)apps/mail/types/speech-recognition.d.ts(1 hunks)apps/server/src/lib/brain.fallback.prompts.ts(1 hunks)apps/server/src/lib/brain.ts(1 hunks)apps/server/src/lib/notes-manager.ts(1 hunks)apps/server/src/trpc/index.ts(1 hunks)apps/server/src/trpc/routes/ai/compose.ts(2 hunks)apps/server/src/trpc/routes/brain.ts(1 hunks)apps/server/src/trpc/routes/categories.ts(1 hunks)package.json(1 hunks)
🧰 Additional context used
🧠 Learnings (29)
apps/mail/hooks/use-categories.ts (4)
Learnt from: retrogtx
PR: Mail-0/Zero#1328
File: apps/mail/lib/hotkeys/mail-list-hotkeys.tsx:202-209
Timestamp: 2025-06-18T17:26:50.918Z
Learning: In apps/mail/lib/hotkeys/mail-list-hotkeys.tsx, the switchCategoryByIndex function using hardcoded indices for category hotkeys does not break when users reorder categories, contrary to the theoretical index-shifting issue. The actual implementation has constraints or mechanisms that prevent hotkey targeting issues.
Learnt from: retrogtx
PR: Mail-0/Zero#1468
File: apps/server/src/trpc/routes/mail.ts:331-331
Timestamp: 2025-06-28T03:56:09.351Z
Learning: In apps/server/src/trpc/routes/mail.ts, the user indicated they are not using ISO format for the scheduleAt parameter, despite the frontend code showing toISOString() usage in the ScheduleSendPicker component.
Learnt from: retrogtx
PR: Mail-0/Zero#1468
File: apps/server/src/trpc/routes/mail.ts:386-391
Timestamp: 2025-06-27T04:59:29.709Z
Learning: In apps/server/src/trpc/routes/mail.ts, the attachment processing logic conditionally handles mixed attachment types - it preserves existing File-like objects with arrayBuffer methods while only converting serialized attachments that need processing through toAttachmentFiles.
Learnt from: retrogtx
PR: Mail-0/Zero#1354
File: apps/mail/components/ui/prompts-dialog.tsx:85-88
Timestamp: 2025-06-20T05:03:16.944Z
Learning: In React Hook Form, avoid using useEffect for form state synchronization when the values prop can handle reactive updates automatically. The values prop is specifically designed for this purpose and is more optimal than manual useEffect-based synchronization.
apps/mail/components/ai-toggle-button.tsx (2)
Learnt from: danteissaias
PR: Mail-0/Zero#902
File: apps/mail/components/connection/add.tsx:77-77
Timestamp: 2025-05-07T16:55:46.513Z
Learning: For the "Upgrade" link in AddConnectionDialog, using a proper <button> element instead of a <span> with onClick is recognized as an accessibility improvement but was deferred as out of scope in PR #902 (CSS variables PR).
Learnt from: retrogtx
PR: Mail-0/Zero#1328
File: apps/mail/lib/hotkeys/mail-list-hotkeys.tsx:202-209
Timestamp: 2025-06-18T17:26:50.918Z
Learning: In apps/mail/lib/hotkeys/mail-list-hotkeys.tsx, the switchCategoryByIndex function using hardcoded indices for category hotkeys does not break when users reorder categories, contrary to the theoretical index-shifting issue. The actual implementation has constraints or mechanisms that prevent hotkey targeting issues.
apps/mail/hooks/driver/use-delete.ts (3)
Learnt from: retrogtx
PR: Mail-0/Zero#1468
File: apps/server/src/trpc/routes/mail.ts:386-391
Timestamp: 2025-06-27T04:59:29.709Z
Learning: In apps/server/src/trpc/routes/mail.ts, the attachment processing logic conditionally handles mixed attachment types - it preserves existing File-like objects with arrayBuffer methods while only converting serialized attachments that need processing through toAttachmentFiles.
Learnt from: retrogtx
PR: Mail-0/Zero#1468
File: apps/server/src/trpc/routes/mail.ts:331-331
Timestamp: 2025-06-28T03:56:09.351Z
Learning: In apps/server/src/trpc/routes/mail.ts, the user indicated they are not using ISO format for the scheduleAt parameter, despite the frontend code showing toISOString() usage in the ScheduleSendPicker component.
Learnt from: retrogtx
PR: Mail-0/Zero#1328
File: apps/mail/lib/hotkeys/mail-list-hotkeys.tsx:202-209
Timestamp: 2025-06-18T17:26:50.918Z
Learning: In apps/mail/lib/hotkeys/mail-list-hotkeys.tsx, the switchCategoryByIndex function using hardcoded indices for category hotkeys does not break when users reorder categories, contrary to the theoretical index-shifting issue. The actual implementation has constraints or mechanisms that prevent hotkey targeting issues.
apps/mail/components/ui/responsive-modal.tsx (1)
Learnt from: retrogtx
PR: Mail-0/Zero#1328
File: apps/mail/lib/hotkeys/mail-list-hotkeys.tsx:202-209
Timestamp: 2025-06-18T17:26:50.918Z
Learning: In apps/mail/lib/hotkeys/mail-list-hotkeys.tsx, the switchCategoryByIndex function using hardcoded indices for category hotkeys does not break when users reorder categories, contrary to the theoretical index-shifting issue. The actual implementation has constraints or mechanisms that prevent hotkey targeting issues.
apps/mail/components/mail/mail-iframe.tsx (4)
Learnt from: retrogtx
PR: Mail-0/Zero#1328
File: apps/mail/lib/hotkeys/mail-list-hotkeys.tsx:202-209
Timestamp: 2025-06-18T17:26:50.918Z
Learning: In apps/mail/lib/hotkeys/mail-list-hotkeys.tsx, the switchCategoryByIndex function using hardcoded indices for category hotkeys does not break when users reorder categories, contrary to the theoretical index-shifting issue. The actual implementation has constraints or mechanisms that prevent hotkey targeting issues.
Learnt from: danteissaias
PR: Mail-0/Zero#618
File: apps/mail/components/mail/mail-iframe.tsx:12-12
Timestamp: 2025-04-07T20:46:11.697Z
Learning: In the Mail-0/Zero application, sender emails are guaranteed to be non-empty when passed to components that handle them, making additional empty string validation unnecessary.
Learnt from: retrogtx
PR: Mail-0/Zero#1468
File: apps/server/src/trpc/routes/mail.ts:331-331
Timestamp: 2025-06-28T03:56:09.351Z
Learning: In apps/server/src/trpc/routes/mail.ts, the user indicated they are not using ISO format for the scheduleAt parameter, despite the frontend code showing toISOString() usage in the ScheduleSendPicker component.
Learnt from: retrogtx
PR: Mail-0/Zero#1468
File: apps/server/src/trpc/routes/mail.ts:386-391
Timestamp: 2025-06-27T04:59:29.709Z
Learning: In apps/server/src/trpc/routes/mail.ts, the attachment processing logic conditionally handles mixed attachment types - it preserves existing File-like objects with arrayBuffer methods while only converting serialized attachments that need processing through toAttachmentFiles.
apps/mail/lib/hotkeys/mail-list-hotkeys.tsx (1)
Learnt from: retrogtx
PR: Mail-0/Zero#1328
File: apps/mail/lib/hotkeys/mail-list-hotkeys.tsx:202-209
Timestamp: 2025-06-18T17:26:50.918Z
Learning: In apps/mail/lib/hotkeys/mail-list-hotkeys.tsx, the switchCategoryByIndex function using hardcoded indices for category hotkeys does not break when users reorder categories, contrary to the theoretical index-shifting issue. The actual implementation has constraints or mechanisms that prevent hotkey targeting issues.
apps/mail/components/ui/settings-content.tsx (1)
Learnt from: retrogtx
PR: Mail-0/Zero#1328
File: apps/mail/lib/hotkeys/mail-list-hotkeys.tsx:202-209
Timestamp: 2025-06-18T17:26:50.918Z
Learning: In apps/mail/lib/hotkeys/mail-list-hotkeys.tsx, the switchCategoryByIndex function using hardcoded indices for category hotkeys does not break when users reorder categories, contrary to the theoretical index-shifting issue. The actual implementation has constraints or mechanisms that prevent hotkey targeting issues.
apps/mail/components/mail/select-all-checkbox.tsx (1)
Learnt from: retrogtx
PR: Mail-0/Zero#1328
File: apps/mail/lib/hotkeys/mail-list-hotkeys.tsx:202-209
Timestamp: 2025-06-18T17:26:50.918Z
Learning: In apps/mail/lib/hotkeys/mail-list-hotkeys.tsx, the switchCategoryByIndex function using hardcoded indices for category hotkeys does not break when users reorder categories, contrary to the theoretical index-shifting issue. The actual implementation has constraints or mechanisms that prevent hotkey targeting issues.
apps/mail/hooks/use-hot-key.ts (1)
Learnt from: retrogtx
PR: Mail-0/Zero#1328
File: apps/mail/lib/hotkeys/mail-list-hotkeys.tsx:202-209
Timestamp: 2025-06-18T17:26:50.918Z
Learning: In apps/mail/lib/hotkeys/mail-list-hotkeys.tsx, the switchCategoryByIndex function using hardcoded indices for category hotkeys does not break when users reorder categories, contrary to the theoretical index-shifting issue. The actual implementation has constraints or mechanisms that prevent hotkey targeting issues.
apps/mail/store/draftStates.ts (1)
Learnt from: retrogtx
PR: Mail-0/Zero#1328
File: apps/mail/lib/hotkeys/mail-list-hotkeys.tsx:202-209
Timestamp: 2025-06-18T17:26:50.918Z
Learning: In apps/mail/lib/hotkeys/mail-list-hotkeys.tsx, the switchCategoryByIndex function using hardcoded indices for category hotkeys does not break when users reorder categories, contrary to the theoretical index-shifting issue. The actual implementation has constraints or mechanisms that prevent hotkey targeting issues.
apps/mail/components/ui/sidebar.tsx (1)
Learnt from: retrogtx
PR: Mail-0/Zero#1328
File: apps/mail/lib/hotkeys/mail-list-hotkeys.tsx:202-209
Timestamp: 2025-06-18T17:26:50.918Z
Learning: In apps/mail/lib/hotkeys/mail-list-hotkeys.tsx, the switchCategoryByIndex function using hardcoded indices for category hotkeys does not break when users reorder categories, contrary to the theoretical index-shifting issue. The actual implementation has constraints or mechanisms that prevent hotkey targeting issues.
apps/mail/app/(routes)/settings/notifications/page.tsx (2)
Learnt from: retrogtx
PR: Mail-0/Zero#1328
File: apps/mail/lib/hotkeys/mail-list-hotkeys.tsx:202-209
Timestamp: 2025-06-18T17:26:50.918Z
Learning: In apps/mail/lib/hotkeys/mail-list-hotkeys.tsx, the switchCategoryByIndex function using hardcoded indices for category hotkeys does not break when users reorder categories, contrary to the theoretical index-shifting issue. The actual implementation has constraints or mechanisms that prevent hotkey targeting issues.
Learnt from: retrogtx
PR: Mail-0/Zero#1354
File: apps/mail/components/ui/prompts-dialog.tsx:85-88
Timestamp: 2025-06-20T05:03:16.944Z
Learning: In React Hook Form, avoid using useEffect for form state synchronization when the values prop can handle reactive updates automatically. The values prop is specifically designed for this purpose and is more optimal than manual useEffect-based synchronization.
apps/mail/hooks/use-geo-location.ts (4)
Learnt from: retrogtx
PR: Mail-0/Zero#1468
File: apps/server/src/trpc/routes/mail.ts:331-331
Timestamp: 2025-06-28T03:56:09.351Z
Learning: In apps/server/src/trpc/routes/mail.ts, the user indicated they are not using ISO format for the scheduleAt parameter, despite the frontend code showing toISOString() usage in the ScheduleSendPicker component.
Learnt from: retrogtx
PR: Mail-0/Zero#1354
File: apps/mail/components/ui/prompts-dialog.tsx:85-88
Timestamp: 2025-06-20T05:03:16.944Z
Learning: In React Hook Form, avoid using useEffect for form state synchronization when the values prop can handle reactive updates automatically. The values prop is specifically designed for this purpose and is more optimal than manual useEffect-based synchronization.
Learnt from: dakdevs
PR: Mail-0/Zero#764
File: apps/mail/lib/ai.ts:50-51
Timestamp: 2025-04-25T08:33:16.956Z
Learning: In Next.js 15, the `headers()` function from 'next/headers' is asynchronous and requires using `await` when called, which is a breaking change from previous versions where it was synchronous.
Learnt from: dakdevs
PR: Mail-0/Zero#764
File: apps/mail/lib/ai.ts:50-51
Timestamp: 2025-04-25T08:33:16.956Z
Learning: In Next.js 15, the `headers()` function from 'next/headers' is asynchronous and requires using `await` when called, which is a breaking change from previous versions where it was synchronous.
apps/server/src/trpc/routes/ai/compose.ts (2)
Learnt from: retrogtx
PR: Mail-0/Zero#1468
File: apps/server/src/trpc/routes/mail.ts:331-331
Timestamp: 2025-06-28T03:56:09.351Z
Learning: In apps/server/src/trpc/routes/mail.ts, the user indicated they are not using ISO format for the scheduleAt parameter, despite the frontend code showing toISOString() usage in the ScheduleSendPicker component.
Learnt from: retrogtx
PR: Mail-0/Zero#1468
File: apps/server/src/trpc/routes/mail.ts:386-391
Timestamp: 2025-06-27T04:59:29.709Z
Learning: In apps/server/src/trpc/routes/mail.ts, the attachment processing logic conditionally handles mixed attachment types - it preserves existing File-like objects with arrayBuffer methods while only converting serialized attachments that need processing through toAttachmentFiles.
apps/mail/components/ui/command.tsx (1)
Learnt from: retrogtx
PR: Mail-0/Zero#1328
File: apps/mail/lib/hotkeys/mail-list-hotkeys.tsx:202-209
Timestamp: 2025-06-18T17:26:50.918Z
Learning: In apps/mail/lib/hotkeys/mail-list-hotkeys.tsx, the switchCategoryByIndex function using hardcoded indices for category hotkeys does not break when users reorder categories, contrary to the theoretical index-shifting issue. The actual implementation has constraints or mechanisms that prevent hotkey targeting issues.
apps/mail/app/(routes)/settings/privacy/page.tsx (2)
Learnt from: retrogtx
PR: Mail-0/Zero#1468
File: apps/server/src/trpc/routes/mail.ts:331-331
Timestamp: 2025-06-28T03:56:09.351Z
Learning: In apps/server/src/trpc/routes/mail.ts, the user indicated they are not using ISO format for the scheduleAt parameter, despite the frontend code showing toISOString() usage in the ScheduleSendPicker component.
Learnt from: danteissaias
PR: Mail-0/Zero#618
File: apps/mail/components/mail/mail-iframe.tsx:0-0
Timestamp: 2025-04-07T20:46:04.726Z
Learning: In the Zero mail application, the "Trust Sender" button for external images is only shown when a sender is not already in the trusted senders list (`settings?.trustedSenders`). This is controlled by the condition `!imagesEnabled && !settings?.externalImages`, where `imagesEnabled` is based on `isTrustedSender || settings?.externalImages` and `isTrustedSender` is determined by `settings?.trustedSenders?.includes(senderEmail)`. This design pattern prevents duplicate entries in the trusted senders list.
apps/server/src/trpc/routes/categories.ts (2)
Learnt from: retrogtx
PR: Mail-0/Zero#1468
File: apps/server/src/trpc/routes/mail.ts:386-391
Timestamp: 2025-06-27T04:59:29.709Z
Learning: In apps/server/src/trpc/routes/mail.ts, the attachment processing logic conditionally handles mixed attachment types - it preserves existing File-like objects with arrayBuffer methods while only converting serialized attachments that need processing through toAttachmentFiles.
Learnt from: retrogtx
PR: Mail-0/Zero#1328
File: apps/mail/lib/hotkeys/mail-list-hotkeys.tsx:202-209
Timestamp: 2025-06-18T17:26:50.918Z
Learning: In apps/mail/lib/hotkeys/mail-list-hotkeys.tsx, the switchCategoryByIndex function using hardcoded indices for category hotkeys does not break when users reorder categories, contrary to the theoretical index-shifting issue. The actual implementation has constraints or mechanisms that prevent hotkey targeting issues.
apps/mail/components/labels/label-dialog.tsx (2)
Learnt from: retrogtx
PR: Mail-0/Zero#1328
File: apps/mail/lib/hotkeys/mail-list-hotkeys.tsx:202-209
Timestamp: 2025-06-18T17:26:50.918Z
Learning: In apps/mail/lib/hotkeys/mail-list-hotkeys.tsx, the switchCategoryByIndex function using hardcoded indices for category hotkeys does not break when users reorder categories, contrary to the theoretical index-shifting issue. The actual implementation has constraints or mechanisms that prevent hotkey targeting issues.
Learnt from: danteissaias
PR: Mail-0/Zero#902
File: apps/mail/components/connection/add.tsx:77-77
Timestamp: 2025-05-07T16:55:46.513Z
Learning: For the "Upgrade" link in AddConnectionDialog, using a proper <button> element instead of a <span> with onClick is recognized as an accessibility improvement but was deferred as out of scope in PR #902 (CSS variables PR).
apps/mail/app/(routes)/settings/labels/page.tsx (3)
Learnt from: retrogtx
PR: Mail-0/Zero#1328
File: apps/mail/lib/hotkeys/mail-list-hotkeys.tsx:202-209
Timestamp: 2025-06-18T17:26:50.918Z
Learning: In apps/mail/lib/hotkeys/mail-list-hotkeys.tsx, the switchCategoryByIndex function using hardcoded indices for category hotkeys does not break when users reorder categories, contrary to the theoretical index-shifting issue. The actual implementation has constraints or mechanisms that prevent hotkey targeting issues.
Learnt from: retrogtx
PR: Mail-0/Zero#1468
File: apps/server/src/trpc/routes/mail.ts:331-331
Timestamp: 2025-06-28T03:56:09.351Z
Learning: In apps/server/src/trpc/routes/mail.ts, the user indicated they are not using ISO format for the scheduleAt parameter, despite the frontend code showing toISOString() usage in the ScheduleSendPicker component.
Learnt from: danteissaias
PR: Mail-0/Zero#902
File: apps/mail/components/connection/add.tsx:77-77
Timestamp: 2025-05-07T16:55:46.513Z
Learning: For the "Upgrade" link in AddConnectionDialog, using a proper <button> element instead of a <span> with onClick is recognized as an accessibility improvement but was deferred as out of scope in PR #902 (CSS variables PR).
apps/mail/app/(routes)/settings/security/page.tsx (3)
Learnt from: retrogtx
PR: Mail-0/Zero#1468
File: apps/server/src/trpc/routes/mail.ts:331-331
Timestamp: 2025-06-28T03:56:09.351Z
Learning: In apps/server/src/trpc/routes/mail.ts, the user indicated they are not using ISO format for the scheduleAt parameter, despite the frontend code showing toISOString() usage in the ScheduleSendPicker component.
Learnt from: retrogtx
PR: Mail-0/Zero#1328
File: apps/mail/lib/hotkeys/mail-list-hotkeys.tsx:202-209
Timestamp: 2025-06-18T17:26:50.918Z
Learning: In apps/mail/lib/hotkeys/mail-list-hotkeys.tsx, the switchCategoryByIndex function using hardcoded indices for category hotkeys does not break when users reorder categories, contrary to the theoretical index-shifting issue. The actual implementation has constraints or mechanisms that prevent hotkey targeting issues.
Learnt from: retrogtx
PR: Mail-0/Zero#1354
File: apps/mail/components/ui/prompts-dialog.tsx:85-88
Timestamp: 2025-06-20T05:03:16.944Z
Learning: In React Hook Form, avoid using useEffect for form state synchronization when the values prop can handle reactive updates automatically. The values prop is specifically designed for this purpose and is more optimal than manual useEffect-based synchronization.
apps/mail/app/(full-width)/privacy.tsx (1)
Learnt from: retrogtx
PR: Mail-0/Zero#1328
File: apps/mail/lib/hotkeys/mail-list-hotkeys.tsx:202-209
Timestamp: 2025-06-18T17:26:50.918Z
Learning: In apps/mail/lib/hotkeys/mail-list-hotkeys.tsx, the switchCategoryByIndex function using hardcoded indices for category hotkeys does not break when users reorder categories, contrary to the theoretical index-shifting issue. The actual implementation has constraints or mechanisms that prevent hotkey targeting issues.
apps/mail/components/ui/navigation-menu.tsx (2)
Learnt from: retrogtx
PR: Mail-0/Zero#1328
File: apps/mail/lib/hotkeys/mail-list-hotkeys.tsx:202-209
Timestamp: 2025-06-18T17:26:50.918Z
Learning: In apps/mail/lib/hotkeys/mail-list-hotkeys.tsx, the switchCategoryByIndex function using hardcoded indices for category hotkeys does not break when users reorder categories, contrary to the theoretical index-shifting issue. The actual implementation has constraints or mechanisms that prevent hotkey targeting issues.
Learnt from: snehendu098
PR: Mail-0/Zero#1323
File: apps/mail/lib/themes/theme-utils.ts:318-318
Timestamp: 2025-06-24T06:22:58.753Z
Learning: In the Mail-0/Zero theme system (apps/mail/lib/themes/theme-utils.ts), when color themes are being applied, all color values come in HSL format, so there's no need for additional format validation when converting colors with hslToHex().
apps/mail/components/mail/thread-display.tsx (1)
Learnt from: retrogtx
PR: Mail-0/Zero#1328
File: apps/mail/lib/hotkeys/mail-list-hotkeys.tsx:202-209
Timestamp: 2025-06-18T17:26:50.918Z
Learning: In apps/mail/lib/hotkeys/mail-list-hotkeys.tsx, the switchCategoryByIndex function using hardcoded indices for category hotkeys does not break when users reorder categories, contrary to the theoretical index-shifting issue. The actual implementation has constraints or mechanisms that prevent hotkey targeting issues.
apps/mail/app/(full-width)/terms.tsx (2)
Learnt from: retrogtx
PR: Mail-0/Zero#1328
File: apps/mail/lib/hotkeys/mail-list-hotkeys.tsx:202-209
Timestamp: 2025-06-18T17:26:50.918Z
Learning: In apps/mail/lib/hotkeys/mail-list-hotkeys.tsx, the switchCategoryByIndex function using hardcoded indices for category hotkeys does not break when users reorder categories, contrary to the theoretical index-shifting issue. The actual implementation has constraints or mechanisms that prevent hotkey targeting issues.
Learnt from: danteissaias
PR: Mail-0/Zero#902
File: apps/mail/components/connection/add.tsx:77-77
Timestamp: 2025-05-07T16:55:46.513Z
Learning: For the "Upgrade" link in AddConnectionDialog, using a proper <button> element instead of a <span> with onClick is recognized as an accessibility improvement but was deferred as out of scope in PR #902 (CSS variables PR).
apps/mail/lib/image-compression.ts (1)
Learnt from: retrogtx
PR: Mail-0/Zero#1468
File: apps/server/src/trpc/routes/mail.ts:386-391
Timestamp: 2025-06-27T04:59:29.709Z
Learning: In apps/server/src/trpc/routes/mail.ts, the attachment processing logic conditionally handles mixed attachment types - it preserves existing File-like objects with arrayBuffer methods while only converting serialized attachments that need processing through toAttachmentFiles.
apps/mail/components/create/email-composer.tsx (1)
Learnt from: retrogtx
PR: Mail-0/Zero#1468
File: apps/server/src/trpc/routes/mail.ts:386-391
Timestamp: 2025-06-27T04:59:29.709Z
Learning: In apps/server/src/trpc/routes/mail.ts, the attachment processing logic conditionally handles mixed attachment types - it preserves existing File-like objects with arrayBuffer methods while only converting serialized attachments that need processing through toAttachmentFiles.
apps/mail/components/ui/button.tsx (1)
Learnt from: danteissaias
PR: Mail-0/Zero#902
File: apps/mail/components/connection/add.tsx:77-77
Timestamp: 2025-05-07T16:55:46.513Z
Learning: For the "Upgrade" link in AddConnectionDialog, using a proper <button> element instead of a <span> with onClick is recognized as an accessibility improvement but was deferred as out of scope in PR #902 (CSS variables PR).
apps/mail/hooks/use-mail-navigation.ts (1)
Learnt from: retrogtx
PR: Mail-0/Zero#1328
File: apps/mail/lib/hotkeys/mail-list-hotkeys.tsx:202-209
Timestamp: 2025-06-18T17:26:50.918Z
Learning: In apps/mail/lib/hotkeys/mail-list-hotkeys.tsx, the switchCategoryByIndex function using hardcoded indices for category hotkeys does not break when users reorder categories, contrary to the theoretical index-shifting issue. The actual implementation has constraints or mechanisms that prevent hotkey targeting issues.
apps/mail/app/(routes)/settings/categories/page.tsx (2)
Learnt from: retrogtx
PR: Mail-0/Zero#1328
File: apps/mail/lib/hotkeys/mail-list-hotkeys.tsx:202-209
Timestamp: 2025-06-18T17:26:50.918Z
Learning: In apps/mail/lib/hotkeys/mail-list-hotkeys.tsx, the switchCategoryByIndex function using hardcoded indices for category hotkeys does not break when users reorder categories, contrary to the theoretical index-shifting issue. The actual implementation has constraints or mechanisms that prevent hotkey targeting issues.
Learnt from: danteissaias
PR: Mail-0/Zero#902
File: apps/mail/components/connection/add.tsx:77-77
Timestamp: 2025-05-07T16:55:46.513Z
Learning: For the "Upgrade" link in AddConnectionDialog, using a proper <button> element instead of a <span> with onClick is recognized as an accessibility improvement but was deferred as out of scope in PR #902 (CSS variables PR).
🧬 Code Graph Analysis (4)
apps/server/src/trpc/routes/ai/compose.ts (1)
apps/server/src/lib/prompts.ts (1)
StyledEmailAssistantSystemPrompt(114-231)
apps/mail/components/ui/command.tsx (1)
apps/mail/components/icons/icons.tsx (1)
Search(1648-1663)
apps/server/src/trpc/routes/categories.ts (2)
apps/server/src/trpc/trpc.ts (2)
router(17-17)publicProcedure(18-18)apps/server/src/lib/schemas.ts (1)
defaultMailCategories(50-99)
apps/mail/app/(routes)/settings/categories/page.tsx (2)
apps/mail/components/icons/icons.tsx (1)
Sparkles(561-592)apps/mail/hooks/use-categories.ts (1)
CategorySetting(6-13)
🔇 Additional comments (55)
apps/mail/components/ui/prompts-dialog.tsx (1)
224-224: Good POSIX-style fixThe final newline character is now present. 👍
apps/server/src/lib/notes-manager.ts (1)
19-19: Formatting consistency fix looks goodAdding a space after
tryaligns with the project's formatting rules. No functional impact.apps/mail/types/speech-recognition.d.ts (1)
52-53: No-op formatting tweak LGTMThe added space after
newis stylistic; type semantics remain unchanged. All good.apps/server/src/lib/brain.ts (1)
3-3: Import order change is fineRe-ordering keeps local imports grouped coherently and causes no side-effects. ✅
apps/server/src/trpc/routes/brain.ts (1)
2-2: Import shuffle acknowledgedPurely stylistic; behaviour is unaffected. Looks good.
apps/server/src/trpc/routes/ai/compose.ts (1)
8-11: No issues with the minor refactorImport re-ordering and the extra trailing comma do not impact runtime behaviour. Implementation remains intact. 👍
Also applies to: 38-41
apps/server/src/lib/brain.fallback.prompts.ts (1)
223-227: Template literal reformat improves readabilityMulti-line conditional is clearer; logic unchanged. Nice touch.
apps/server/src/trpc/index.ts (1)
4-4: Consistent route-import groupingMoving
categoriesRoutermaintains a tidy import block. No functional change.apps/server/src/trpc/routes/categories.ts (1)
1-2: Import re-ordering aligns with project conventions – good call.
No functional impact; keeps the barrel import (../trpc) grouped after third-party / shared-lib imports and matches the repo’s lint rules.apps/mail/store/draftStates.ts (1)
1-13: Quote-style alignment looks goodOnly stylistic changes were made; functionality remains intact.
apps/mail/lib/countries.ts (1)
2-30: No duplicate entries detected—ignore the duplicate warningA search for all three-letter codes in apps/mail/lib/countries.ts shows each code appears only once. While
ENGisn’t an ISO 3166-1 alpha-3 code alongsideGBR, it isn’t duplicated in the list. IfENGis deliberately included for bespoke cookie-consent logic, no changes are needed; otherwise, review its purpose.Likely an incorrect or invalid review comment.
apps/mail/hooks/use-geo-location.ts (1)
1-16: Stylistic quote change acknowledgedNo functional impact; the hook remains client-safe by gating DOM access inside
useEffect.apps/mail/components/context/loading-context.tsx (1)
46-46: Whitespace cleanup only – LGTM.No functional impact; keeping the diff noise minimal is appreciated.
apps/mail/hooks/use-categories.ts (1)
2-2: Import re-ordering looks consistent with project style.Nothing else to flag.
apps/mail/hooks/driver/use-delete.ts (1)
3-3: Import shuffle acknowledged.No behavioural change; good to merge.
apps/mail/providers/client-providers.tsx (1)
1-1: Duplicate import removed – nice catch.Keeps the bundle lean and avoids potential circular-dep warnings.
apps/mail/components/ui/responsive-modal.tsx (1)
13-22: Import grouping improved.Grouping Dialog imports together enhances readability; all good.
apps/mail/components/home/pixelated-bg.tsx (1)
30-30: Good formatting improvementThis change standardizes the quote usage and removes unnecessary trailing whitespace, improving code consistency without affecting functionality.
apps/mail/app/(full-width)/terms.tsx (1)
28-28: CSS class reordering looks goodThis reordering of the CSS utility classes improves consistency without affecting the visual appearance or functionality of the back button positioning.
apps/mail/components/ui/navigation-menu.tsx (1)
138-138: Class-order tweak looks goodPurely stylistic Tailwind class re-ordering; behaviour in light/dark mode remains unchanged.
apps/mail/components/home/HomeContent.tsx (1)
34-35: Import re-ordering & whitespace cleanup LGTMNo functional impact; brings this file in line with the new formatting rules.
Also applies to: 124-124
apps/mail/components/mail/select-all-checkbox.tsx (1)
1-9: Imports & minor whitespace – OKRe-ordering the imports (React first, local hooks next, utils last) and trimming a blank line improves readability without affecting behaviour.
Also applies to: 67-67
apps/mail/hooks/use-mail-navigation.ts (1)
199-207: Readable hotkey config 👍Splitting the
useHotkeysoption objects onto multiple lines greatly improves scan-ability; no logic altered.apps/mail/components/home/footer.tsx (1)
124-139: Footer JSX formatting onlyIndentation and line-wrap adjustments—no functional changes detected.
apps/mail/app/(full-width)/privacy.tsx (3)
27-27: LGTM: CSS class reordering improves organization.The reordering of CSS classes groups positioning-related classes together, which enhances readability and maintainability.
347-391: LGTM: JSX formatting improvements and content enhancement.The reformatting of list items improves consistency and readability. The addition of the new list item (lines 382-385) clarifying that the policy applies to all premium subscription plans is a valuable content improvement that enhances user understanding.
399-412: LGTM: Consistent JSX formatting applied.The formatting of these list items maintains consistency with the rest of the component and improves code readability.
apps/mail/components/ui/sidebar.tsx (1)
113-113: LGTM: CSS class reordering improves logical grouping.Moving the transition-related classes (
transition-all duration-300 ease-in-out) to precede the floating variant-specific classes creates better logical grouping of related CSS properties without affecting functionality.apps/mail/components/ui/command.tsx (1)
49-50: LGTM: CSS class reordering enhances consistency.The reordering of CSS classes in both the wrapper div and Search icon improves organization by grouping related properties together (layout, visual styling). This aligns with the consistent formatting approach across the codebase.
apps/mail/app/(auth)/login/error-message.tsx (1)
2-2: LGTM: Import reordering improves consistency.Moving the
mimport above theuseQueryStateimport aligns with the consistent import organization pattern established across the codebase.apps/mail/app/(routes)/settings/notifications/page.tsx (1)
19-19: LGTM: Import reordering maintains logical organization.Moving the
Buttonimport after theSwitchimport improves the logical grouping of UI component imports and maintains consistency with the formatting standards applied across the settings pages.apps/mail/components/mail/thread-display.tsx (1)
46-46: Import re-ordering looks good
mis now grouped with other absolute (@/...) imports, matching the ordering convention used across the repo. No functional impact.apps/mail/lib/hotkeys/mail-list-hotkeys.tsx (1)
11-11: Consistent import groupingMoving
mhigher keeps all external/alias imports together and improves scan-ability.apps/mail/components/ai-toggle-button.tsx (1)
17-17: Nit: class order only – fine as isRe-ordering the
borderclass after sizing/shape classes doesn’t change specificity and aligns with the rest of the codebase.apps/mail/components/mail/mail-iframe.tsx (1)
9-9: Import location aligned
mwas moved up to stay with other alias imports. No behaviour change.apps/mail/app/(routes)/settings/[...settings]/page.tsx (1)
7-7: Minor import shuffle acknowledgedImport order realigned; nothing else changed.
apps/mail/components/ui/settings-content.tsx (1)
3-3: LGTM! Import reordering improves consistency.The import reordering aligns with the formatting consistency objectives of this PR.
apps/mail/app/(routes)/settings/security/page.tsx (2)
14-14: LGTM! Import reordering improves organization.The import reordering enhances code organization without affecting functionality.
69-72: LGTM! JSX indentation improves readability.The improved indentation of localization function calls enhances code readability and maintains consistency.
Also applies to: 88-91
apps/mail/components/labels/label-dialog.tsx (2)
21-25: LGTM! Import organization enhanced.The import reordering improves code organization and aligns with formatting standards.
97-99: LGTM! JSX formatting improves readability.Breaking complex JSX expressions into multiple lines enhances code readability and maintainability.
Also applies to: 158-160
apps/mail/app/(routes)/settings/privacy/page.tsx (2)
19-22: LGTM! Import organization improved.The import reordering enhances code organization and follows consistent formatting patterns.
90-93: LGTM! JSX indentation consistency enhanced.The improved indentation of localization function calls maintains consistency and improves readability.
Also applies to: 110-113
apps/mail/app/(routes)/settings/labels/page.tsx (2)
32-35: LGTM! Import organization enhanced.The import reordering improves code organization and maintains consistency with formatting standards.
66-66: LGTM! Whitespace and JSX formatting improved.The whitespace adjustments and JSX formatting improvements enhance code consistency and readability.
Also applies to: 116-116, 150-150, 165-165
apps/mail/lib/image-compression.ts (1)
9-9: LGTM! Excellent formatting improvements.The addition of trailing commas and strategic blank lines enhances code readability and maintainability. These changes follow TypeScript best practices and will make future diffs cleaner.
Also applies to: 17-17, 22-22, 27-27, 28-28, 32-32, 36-36, 42-42, 65-65, 73-73, 80-80, 83-83, 97-97, 103-103, 107-107, 113-113
apps/mail/components/ui/button.tsx (2)
48-60: LGTM! Improved parameter destructuring format.The multi-line destructuring with trailing commas significantly improves readability for components with many props.
63-63: LGTM! Consistent formatting improvements.The JSX spacing cleanup, CSS class reordering, and conditional rendering formatting enhance code consistency and readability.
Also applies to: 73-73, 76-78
apps/mail/components/create/email-composer.tsx (3)
19-19: LGTM! Well-organized import additions.The new imports for image compression functionality (
ImageCompressionSettings,ImageQuality,compressImages) anduseIsMobilehook are properly organized and support the enhanced email composer features.Also applies to: 23-23, 26-26, 33-33
193-196: LGTM! Improved calculation readability.The multi-line formatting of the compression savings calculation enhances readability while maintaining the same logic.
343-343: LGTM! Consistent formatting improvements.The added blank lines and reformatted dialog description text improve code structure and readability.
Also applies to: 350-350, 544-545
apps/mail/app/(routes)/settings/categories/page.tsx (4)
2-6: LGTM! Excellent import organization.The systematic grouping and reorganization of imports significantly improves code readability. Related imports are now logically grouped together, making dependencies clearer.
Also applies to: 16-21, 22-41
66-68: LGTM! Consistent function formatting.The multi-line destructuring and function parameter formatting enhances readability and follows TypeScript best practices.
Also applies to: 230-234, 249-255
79-80: LGTM! Systematic className reordering.The consistent reordering of CSS classes throughout the component improves code maintainability and follows a logical pattern.
Also applies to: 83-83, 88-88, 91-91, 93-93, 97-97, 106-106, 112-112, 114-114, 121-121, 123-123, 126-126, 144-144, 154-154, 164-164, 186-186, 188-188, 309-309
267-267: LGTM! Strategic whitespace improvements.The added blank lines and callback formatting enhance code structure and readability without affecting functionality.
Also applies to: 269-269, 337-337, 351-351
| import React, { useCallback, useMemo, useRef, useState } from 'react'; | ||
| import { useSearchValue } from '@/hooks/use-search-value'; | ||
| import { trpcClient } from '@/providers/query-provider'; | ||
| import { cn } from '@/lib/utils'; | ||
| import { useMail } from '@/components/mail/use-mail'; | ||
| import { Checkbox } from '@/components/ui/checkbox'; | ||
| import { useThreads } from '@/hooks/use-threads'; | ||
| import { useParams } from 'react-router'; | ||
| import { cn } from '@/lib/utils'; | ||
| import { toast } from 'sonner'; | ||
| import React, { useCallback, useMemo, useRef, useState, useEffect } from 'react'; |
There was a problem hiding this comment.
There's a duplicate import of React in this file. The first import at line 1 includes { useCallback, useMemo, useRef, useState } from React, while line 9 imports React, { useCallback, useMemo, useRef, useState, useEffect }.
To fix this issue:
- Remove one of the duplicate imports
- If keeping the second import, ensure it includes all needed hooks (including
useEffect)
Duplicate imports can cause confusion and potential issues during bundling.
| import React, { useCallback, useMemo, useRef, useState } from 'react'; | |
| import { useSearchValue } from '@/hooks/use-search-value'; | |
| import { trpcClient } from '@/providers/query-provider'; | |
| import { cn } from '@/lib/utils'; | |
| import { useMail } from '@/components/mail/use-mail'; | |
| import { Checkbox } from '@/components/ui/checkbox'; | |
| import { useThreads } from '@/hooks/use-threads'; | |
| import { useParams } from 'react-router'; | |
| import { cn } from '@/lib/utils'; | |
| import { toast } from 'sonner'; | |
| import React, { useCallback, useMemo, useRef, useState, useEffect } from 'react'; | |
| import React, { useCallback, useMemo, useRef, useState, useEffect } from 'react'; | |
| import { useSearchValue } from '@/hooks/use-search-value'; | |
| import { trpcClient } from '@/providers/query-provider'; | |
| import { useMail } from '@/components/mail/use-mail'; | |
| import { Checkbox } from '@/components/ui/checkbox'; | |
| import { useThreads } from '@/hooks/use-threads'; | |
| import { useParams } from 'react-router'; | |
| import { cn } from '@/lib/utils'; | |
| import { toast } from 'sonner'; |
Spotted by Diamond (based on custom rules)
Is this helpful? React 👍 or 👎 to let us know.
d6774c1 to
35aeb4c
Compare
|
Not needed |
Description
This PR updates the check:format script in package.json to align with the scope of the format script and formats remaining unformatted files
fixes #1580
Type of Change
Please delete options that are not relevant.
Areas Affected
Please check all that apply:
Testing Done
Describe the tests you've done:
Security Considerations
For changes involving data or authentication:
Checklist
Additional Notes
Previously, the formatting check ran on all files in the repo, including those outside the intended formatting scope.
By submitting this pull request, I confirm that my contribution is made under the terms of the project's license.
Summary by CodeRabbit
New Features
Style
Chores