Chore/better lint rules v2#121
Conversation
|
Warning Review limit reached
Next review available in: 45 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughEste PR combina cambios funcionales pequeños (guard de reset-password, resolución segura de rutas de uploads locales, validación de email, reversión optimista en el botón de carrito, orden de validación de personalizaciones, cálculo de totales de checkout, validación de cantidad) con numerosos refactors de estilo y supresiones de reglas de lint en componentes, scripts y tests. ChangesAutenticación y seguridad
Estimated code review effort: 3 (Moderate) | ~25 minutes Lógica de carrito y personalización
Estimated code review effort: 3 (Moderate) | ~25 minutes Refactors de estilo y limpieza de lint
Estimated code review effort: 3 (Moderate) | ~30 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (2)
shared/presentation/components/file-upload-dropzone.tsx (1)
156-165: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDuplicación de
formatBytesentre dos componentes.Esta función es idéntica a
formatBytesenshared/ui/file-upload-dropzone.tsx(mismo cambio aplicado en ambos archivos). Sería más mantenible extraerla a un helper compartido (p. ej.shared/kernel/format-bytes.ts) e importarla en ambos componentes.♻️ Propuesta
+// shared/kernel/format-bytes.ts +export function formatBytes(bytes: number): string { + if (bytes < 1024) return `${bytes} B`; + if (bytes < 1024 * 1024) { + const value = bytes / 1024; + return `${Number.isSafeInteger(value) ? value.toFixed(0) : value.toFixed(1)} KB`; + } + + const value = bytes / (1024 * 1024); + return `${Number.isSafeInteger(value) ? value.toFixed(0) : value.toFixed(1)} MB`; +}🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@shared/presentation/components/file-upload-dropzone.tsx` around lines 156 - 165, The formatBytes helper is duplicated in file-upload-dropzone components, so centralize it in a shared helper and reuse it from both places. Extract the logic from the local formatBytes function into a shared utility (for example, a kernel-level helper) and update both file-upload-dropzone components to import that single implementation instead of keeping two copies.app/[locale]/products/[id]/photo-upload-field.tsx (1)
57-61: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winHaz
asyncel callback destartTransitiony captura el fallo deonUpload
onUpload(file)queda como promesa flotante:isPendingpuede terminar antes de que acabe la subida y un rechazo se queda sin manejar. Convieneawait/returnla promesa dentro destartTransitiony mostrar un error de subida si falla, como enmockup-canvas-control.tsx.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@app/`[locale]/products/[id]/photo-upload-field.tsx around lines 57 - 61, Make the startTransition callback in photo-upload-field.tsx handle the upload promise instead of leaving onUpload(file) floating: update the logic around onUpload and onUploaded so the transition awaits/returns the upload work, keeps isPending aligned with the actual upload, and catches rejections to surface a proper upload error message. Use the existing upload flow in photo-upload-field and mirror the error-handling approach from mockup-canvas-control.tsx so failures are not unhandled.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@app/api/uploads/local/`[...storageKey]/route.ts:
- Line 29: The path validation in the storage key parsing logic is rejecting
valid filenames that merely start with two dots. Update the check in the route
handler’s relative path handling to only block traversal segments by matching
exactly ".." or paths that begin with ".." followed by the path separator, while
still keeping the absolute-path guard in place.
In `@scripts/optimize-sprites.mjs`:
- Around line 12-19: The optimize-sprites.mjs script now imports path as a
default object, but the existing `join(ICONS_DIR, file)` calls in the sprite
generation flow still reference `join` directly. Update the path usage in the
affected logic so it consistently uses the `path` module (or restore the named
import) in the code paths around the icon iteration and output assembly,
especially the functions or blocks that build sprite file paths and write the
CSS/SVG outputs.
---
Nitpick comments:
In `@app/`[locale]/products/[id]/photo-upload-field.tsx:
- Around line 57-61: Make the startTransition callback in photo-upload-field.tsx
handle the upload promise instead of leaving onUpload(file) floating: update the
logic around onUpload and onUploaded so the transition awaits/returns the upload
work, keeps isPending aligned with the actual upload, and catches rejections to
surface a proper upload error message. Use the existing upload flow in
photo-upload-field and mirror the error-handling approach from
mockup-canvas-control.tsx so failures are not unhandled.
In `@shared/presentation/components/file-upload-dropzone.tsx`:
- Around line 156-165: The formatBytes helper is duplicated in
file-upload-dropzone components, so centralize it in a shared helper and reuse
it from both places. Extract the logic from the local formatBytes function into
a shared utility (for example, a kernel-level helper) and update both
file-upload-dropzone components to import that single implementation instead of
keeping two copies.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: debd9fe0-b573-4fec-98d9-f15d9915777d
📒 Files selected for processing (40)
app/[locale]/auth/reset-password/page.tsxapp/[locale]/cart/design-preview.tsxapp/[locale]/cart/page.tsxapp/[locale]/layout.tsxapp/[locale]/products/[id]/customization-form.tsxapp/[locale]/products/[id]/photo-upload-field.tsxapp/[locale]/profile/page.tsxapp/api/uploads/local/[...storageKey]/route.tscomposition-root/container.tseslint.config.mjsmodules/auth/infrastructure/memory-used-reset-token-store.tsmodules/cart/application/add-item-to-cart.tsmodules/cart/application/checkout-cart.tsmodules/cart/domain/value-objects/quantity.tsmodules/cart/presentation/components/add-to-cart-button.tsxmodules/cart/presentation/components/cart-icon.tsxmodules/customizations/application/create-customer-customization.tsmodules/customizations/domain/value-objects/customization-options.tsmodules/events/domain/event-registry.tsmodules/orders/application/list-seller-orders-use-case.tsmodules/presentation/components/design-preview.tsxmodules/products/infrastructure/prisma-product-repository.tsmodules/sellers/application/use-cases/list-seller-products-use-case.tsmodules/uploads/infrastructure/prisma-upload-repository.tsmodules/users/application/use-cases/forgot-password-use-case.tsmodules/users/application/use-cases/register-user-use-case.tsmodules/users/infrastructure/prisma-user-repository.tsproxy.tsscripts/optimize-sprites.mjsshared/infrastructure/used-reset-token-store.tsshared/kernel/config.tsshared/kernel/domain/value-objects/email.tsshared/layout/login-modal.tsxshared/presentation/components/file-upload-dropzone.tsxshared/ui/file-upload-dropzone.tsxtests/doubles/memory-storage-adapter.tstests/e2e/admin/credentials.tstests/unit/app/[locale]/products/[id]/customization-experience.test.tsxtests/unit/app/[locale]/products/[id]/customization-preview.test.tsxtests/unit/app/[locale]/seller/products/product-form.test.tsx
💤 Files with no reviewable changes (1)
- app/[locale]/products/[id]/customization-form.tsx
better lint rules
Summary by CodeRabbit
New Features
Bug Fixes