Fix more lint issues in dashboard.#45
Fix more lint issues in dashboard.#45sbansal1999 wants to merge 2 commits intodatabuddy-analytics:mainfrom
Conversation
|
@sbansal1999 is attempting to deploy a commit to the Databuddy Team on Vercel. A member of the Team first needs to authorize it. |
|
Warning Rate limit exceeded@sbansal1999 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 4 minutes and 37 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (2)
WalkthroughThe changes across several dashboard application components primarily involve syntactic refactoring for code clarity and consistency. These include adding explicit braces to single-line conditional return statements and updating array creation patterns. Additionally, several unused import statements were removed. No logic, control flow, or exported interfaces were altered. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
✨ Finishing Touches
🧪 Generate unit tests
🪧 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.
Actionable comments posted: 0
🧹 Nitpick comments (4)
apps/dashboard/app/(main)/websites/[id]/revenue/_components/recent-transactions.tsx (1)
45-47: PreferArray.from({ length: 5 })over spread-on-array literal for clarity
[...new Array(5)]works, but it relies on readers remembering that spreading an array with empty slots materialisesundefineds.
UsingArray.from({ length: 5 })(or a small helper) is self-describing and avoids the extra spread.-{[...new Array(5)].map((_, i) => ( +{Array.from({ length: 5 }).map((_, i) => (apps/dashboard/app/(main)/websites/[id]/revenue/page.tsx (2)
92-109: Inconsistent skeleton array pattern within the same fileHere we switched to
[...new Array(4)], whilePageHeaderSkeletonabove still uses[...Array(4)].
For consistency (and to avoid the spread-of-holes pattern altogether) consider standardising on:-{[...new Array(4)].map((_, i) => ( +{Array.from({ length: 4 }).map((_, i) => (or refactor both places to a small utility, e.g.
range(4), to keep the codebase uniform.
334-346: Same note on skeleton list generationReplicate whichever array-creation style you settle on elsewhere (
Array.fromor a helper) to keep the codebase consistent and silence any remaining lint noise.-{[...new Array(5)].map((_, i) => ( +{Array.from({ length: 5 }).map((_, i) => (apps/dashboard/app/(main)/websites/[id]/goals/_components/goal-card.tsx (1)
52-60: LGTM! Consider using the centralized formatter.The brace addition improves consistency. However, there's code duplication - similar number formatting logic exists in multiple files.
Consider using the more comprehensive
formatNumberfunction fromapps/dashboard/lib/formatters.tswhich handles additional edge cases:+import { formatNumber } from '@/lib/formatters'; - const formatNumber = (num: number) => { - if (num >= 1_000_000) { - return `${(num / 1_000_000).toFixed(1)}M`; - } - if (num >= 1000) { - return `${(num / 1000).toFixed(1)}K`; - } - return num.toString(); - };The centralized version also handles null/undefined values and NaN cases more robustly.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (8)
apps/dashboard/app/(main)/websites/[id]/goals/_components/goal-card.tsx(1 hunks)apps/dashboard/app/(main)/websites/[id]/profiles/_components/profile-row.tsx(0 hunks)apps/dashboard/app/(main)/websites/[id]/revenue/_components/page-header.tsx(0 hunks)apps/dashboard/app/(main)/websites/[id]/revenue/_components/recent-transactions.tsx(2 hunks)apps/dashboard/app/(main)/websites/[id]/revenue/_components/revenue-chart.tsx(2 hunks)apps/dashboard/app/(main)/websites/[id]/revenue/page.tsx(2 hunks)apps/dashboard/app/(main)/websites/[id]/sessions/_components/session-utils.tsx(2 hunks)apps/dashboard/app/(main)/websites/[id]/test/components/minimal-table.tsx(1 hunks)
💤 Files with no reviewable changes (2)
- apps/dashboard/app/(main)/websites/[id]/revenue/_components/page-header.tsx
- apps/dashboard/app/(main)/websites/[id]/profiles/_components/profile-row.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (7)
apps/dashboard/app/(main)/websites/[id]/revenue/_components/recent-transactions.tsx (1)
94-95: Good cleanup – removed unusedindexparameterDropping the unused
indexargument makes the intent clearer and satisfies the linter without altering behaviour. Nice touch.apps/dashboard/app/(main)/websites/[id]/test/components/minimal-table.tsx (1)
72-87: LGTM! Consistent brace addition improves code clarity.The expansion of single-line conditional returns into multi-line blocks with explicit braces enhances readability and follows consistent formatting standards. The logic for extracting percentage values from various property names remains unchanged.
apps/dashboard/app/(main)/websites/[id]/sessions/_components/session-utils.tsx (2)
147-150: LGTM! Consistent brace formatting.The expansion of the single-line conditional return improves code consistency while preserving the logic for handling root paths.
161-174: LGTM! Improved readability with consistent braces.All conditional branches now use explicit braces, making the function more readable and consistent with the codebase formatting standards. The type checking logic remains unchanged.
apps/dashboard/app/(main)/websites/[id]/revenue/_components/revenue-chart.tsx (3)
37-39: LGTM! Consistent conditional formatting.The expansion of the single-line conditional return with explicit braces improves readability and aligns with the formatting standards applied across the codebase.
42-47: LGTM! Improved function consistency.The
getMetricIconfunction now uses explicit braces for all conditional returns, maintaining consistency with the broader refactoring pattern while preserving the icon selection logic.
117-123: LGTM! Consistent formatting improvements.The
valueFormatterfunction now uses explicit braces for conditional returns, improving readability. The currency formatting logic with M/k suffixes remains unchanged and functions correctly.
This pattern is more verbose.
|
Closing in favour of #43. |
Summary by CodeRabbit
Refactor
Style