Skip to content

fix eslint formatting - #40

Open
Rabinagurung wants to merge 1 commit into
mainfrom
fix-eslint
Open

fix eslint formatting#40
Rabinagurung wants to merge 1 commit into
mainfrom
fix-eslint

Conversation

@Rabinagurung

@Rabinagurung Rabinagurung commented Mar 29, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • Chores
    • Updated Clerk authentication library to the latest version
    • Added ESLint with Prettier integration to improve code quality and consistency across the codebase
    • Standardized code formatting with semicolons and consistent punctuation throughout the project

@vercel

vercel Bot commented Mar 29, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
echo-web Ready Ready Preview, Comment Mar 29, 2026 2:16am
echo-widget Ready Ready Preview, Comment Mar 29, 2026 2:16am

@coderabbitai

coderabbitai Bot commented Mar 29, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

This PR introduces ESLint and Prettier integration into a monorepo workspace by updating configurations, bumping the Clerk dependency, and applying consistent semicolon-terminated syntax formatting across ~50 UI component files, hooks, and utilities.

Changes

Cohort / File(s) Summary
ESLint & Linting Configuration
.vscode/settings.json, package.json, packages/eslint-config/base.js, packages/eslint-config/package.json
Added ESLint ^9.32.0 as workspace devDependency; integrated eslint-plugin-prettier into ESLint base configuration with prettier/prettier rule set to "warn"; configured VS Code to disable auto-format on save and enable ESLint auto-fix on save with flat config mode enabled.
App Web Configuration
apps/web/app/layout.tsx, apps/web/package.json
Updated @clerk/nextjs from ^6.30.2 to ^6.39.1; normalized layout.tsx imports, JSX spacing, and self-closing tags with consistent semicolon-terminated syntax.
UI Component File Formatting
packages/ui/eslint.config.js, packages/ui/postcss.config.mjs, packages/ui/src/components/*.tsx (~45 files)
Applied widespread semicolon termination across imports, exports, JSX returns, and statement blocks; added trailing commas in cn(...) className compositions; adjusted file end-of-file newlines. Includes minor functional refactors in conversation-status-icon.tsx (removed nesting) and dicebear-avatar.tsx (refactored avatarSrc memoization).
Hooks & Utilities
packages/ui/src/hooks/use-mobile.ts, packages/ui/src/hooks/useInfiniteScroll.ts, packages/ui/src/lib/utils.ts
Standardized semicolon-terminated syntax in hook declarations, return statements, and dependency arrays; reformatted spacing and indentation for consistency.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • PR #26: Modifies the same hook file (packages/ui/src/hooks/useInfiniteScroll.ts) with logic changes alongside formatting updates.
  • PR #25: Touches overlapping files (packages/ui/src/components/infinite-scroll-trigger.tsx and packages/ui/src/hooks/useInfiniteScroll.ts) with behavioral edits paired with formatting.
  • PR #16: Updates packages/ui/src/components/conversation-status-icon.tsx component signature with prop additions in parallel to this PR's refactoring.

Poem

🐰 With semicolons bright and commas neat,
ESLint dances to a Prettier beat,
A hop through configs, formatting's song,
The monorepo's style now neat and strong! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.61% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix eslint formatting' accurately describes the primary change: enforcing consistent semicolon-based formatting and code style across the codebase through ESLint configuration updates.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix-eslint

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (3)
packages/ui/src/components/infinite-scroll-trigger.tsx (1)

23-23: Remove commented-out debug code.

Similar to the hook file, this component contains commented-out console.log statements that should be removed for a cleaner codebase.

Also applies to: 25-25

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/ui/src/components/infinite-scroll-trigger.tsx` at line 23, Remove
the leftover commented debug statements in the InfiniteScrollTrigger React
component: delete the commented-out console.log lines (the ones at the top of
the file within the InfiniteScrollTrigger component, e.g., the commented
"Infinite Scroll Trigger component called" and the other commented console.log)
so the component and its import/hook usage remain unchanged and there are no
stray commented debug logs left behind.
packages/ui/src/hooks/useInfiniteScroll.ts (1)

16-17: Remove commented-out debug code.

The file contains multiple commented-out console.log statements that appear to be debug artifacts. Consider removing them to keep the codebase clean.

Also applies to: 22-23, 26-26, 31-31, 34-34, 49-49

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/ui/src/hooks/useInfiniteScroll.ts` around lines 16 - 17, Remove the
leftover commented-out debug console.log statements in the useInfiniteScroll
hook: delete the commented lines referencing console.log (e.g., the commented
debug logs that reference status and other temporary prints) so the hook
implementation (useInfiniteScroll) contains no commented debug artifacts; ensure
no other commented console.log remains in the function or associated helper
blocks to keep the code clean.
packages/ui/src/hooks/use-mobile.ts (1)

6-8: Consider computing initial state eagerly to prevent layout shifts.

While the current pattern is safe for SSR (effects don't run on server), initializing with undefined causes the hook to return false on first render, then update to the actual value after the effect runs. This can cause a brief layout shift in SSR scenarios.

♻️ Optional refactor to eliminate hydration flash
-  const [isMobile, setIsMobile] = React.useState<boolean | undefined>(
-    undefined,
-  );
+  const [isMobile, setIsMobile] = React.useState<boolean | undefined>(() =>
+    typeof window !== "undefined"
+      ? window.innerWidth < MOBILE_BREAKPOINT
+      : undefined,
+  );

This initializes with the correct value immediately on the client while remaining safe on the server.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/ui/src/hooks/use-mobile.ts` around lines 6 - 8, The hook initializes
isMobile to undefined causing a flash; change the React.useState initializer in
use-mobile.ts to compute the initial value eagerly by checking for a browser
environment (typeof window !== 'undefined') and using
window.matchMedia('(max-width: XXXpx)') or the same media-query logic the effect
uses to return true/false on first render, otherwise return undefined for SSR;
keep the existing effect and setIsMobile logic unchanged so hydration remains
safe while preventing the initial layout shift.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/ui/src/components/carousel.tsx`:
- Around line 96-105: The useEffect registers both "reInit" and "select"
listeners on api but the cleanup only removes "select", causing handler leaks;
update the cleanup for the effect that uses api and onSelect so it unregisters
both events (call api.off("reInit", onSelect) and api.off("select", onSelect) or
use optional chaining/api?.off for safety) to ensure no duplicate onSelect calls
are retained.

In `@packages/ui/src/components/dicebear-avatar.tsx`:
- Around line 28-31: The current call passes seed.toLowerCase().trim() which
will throw if seed is nullish; update the seed normalization before calling
createAvatar (the seed argument) to defend against null/undefined by coercing to
a safe string (e.g., use a fallback like '' or String(seed ?? '') then
.toLowerCase().trim()) so createAvatar(glass, { seed: /*safe-normalized-seed*/,
size }) never receives a nullish value.

---

Nitpick comments:
In `@packages/ui/src/components/infinite-scroll-trigger.tsx`:
- Line 23: Remove the leftover commented debug statements in the
InfiniteScrollTrigger React component: delete the commented-out console.log
lines (the ones at the top of the file within the InfiniteScrollTrigger
component, e.g., the commented "Infinite Scroll Trigger component called" and
the other commented console.log) so the component and its import/hook usage
remain unchanged and there are no stray commented debug logs left behind.

In `@packages/ui/src/hooks/use-mobile.ts`:
- Around line 6-8: The hook initializes isMobile to undefined causing a flash;
change the React.useState initializer in use-mobile.ts to compute the initial
value eagerly by checking for a browser environment (typeof window !==
'undefined') and using window.matchMedia('(max-width: XXXpx)') or the same
media-query logic the effect uses to return true/false on first render,
otherwise return undefined for SSR; keep the existing effect and setIsMobile
logic unchanged so hydration remains safe while preventing the initial layout
shift.

In `@packages/ui/src/hooks/useInfiniteScroll.ts`:
- Around line 16-17: Remove the leftover commented-out debug console.log
statements in the useInfiniteScroll hook: delete the commented lines referencing
console.log (e.g., the commented debug logs that reference status and other
temporary prints) so the hook implementation (useInfiniteScroll) contains no
commented debug artifacts; ensure no other commented console.log remains in the
function or associated helper blocks to keep the code clean.
🪄 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: defaults

Review profile: CHILL

Plan: Pro

Run ID: 0a3fc4d7-4dd5-490e-a89e-029b685c41fa

📥 Commits

Reviewing files that changed from the base of the PR and between 6ae16e1 and 3167bf3.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (71)
  • .vscode/settings.json
  • apps/web/app/layout.tsx
  • apps/web/package.json
  • package.json
  • packages/eslint-config/base.js
  • packages/eslint-config/package.json
  • packages/ui/eslint.config.js
  • packages/ui/postcss.config.mjs
  • packages/ui/src/components/accordion.tsx
  • packages/ui/src/components/ai/branch.tsx
  • packages/ui/src/components/ai/conversation.tsx
  • packages/ui/src/components/ai/input.tsx
  • packages/ui/src/components/ai/message.tsx
  • packages/ui/src/components/ai/reasoning.tsx
  • packages/ui/src/components/ai/response.tsx
  • packages/ui/src/components/ai/source.tsx
  • packages/ui/src/components/ai/suggestion.tsx
  • packages/ui/src/components/ai/tool.tsx
  • packages/ui/src/components/alert-dialog.tsx
  • packages/ui/src/components/alert.tsx
  • packages/ui/src/components/aspect-ratio.tsx
  • packages/ui/src/components/avatar.tsx
  • packages/ui/src/components/badge.tsx
  • packages/ui/src/components/breadcrumb.tsx
  • packages/ui/src/components/button.tsx
  • packages/ui/src/components/calendar.tsx
  • packages/ui/src/components/card.tsx
  • packages/ui/src/components/carousel.tsx
  • packages/ui/src/components/chart.tsx
  • packages/ui/src/components/checkbox.tsx
  • packages/ui/src/components/collapsible.tsx
  • packages/ui/src/components/command.tsx
  • packages/ui/src/components/context-menu.tsx
  • packages/ui/src/components/conversation-status-icon.tsx
  • packages/ui/src/components/dialog.tsx
  • packages/ui/src/components/dicebear-avatar.tsx
  • packages/ui/src/components/drawer.tsx
  • packages/ui/src/components/dropdown-menu.tsx
  • packages/ui/src/components/dropzone.tsx
  • packages/ui/src/components/form.tsx
  • packages/ui/src/components/hint.tsx
  • packages/ui/src/components/hover-card.tsx
  • packages/ui/src/components/infinite-scroll-trigger.tsx
  • packages/ui/src/components/input-otp.tsx
  • packages/ui/src/components/input.tsx
  • packages/ui/src/components/label.tsx
  • packages/ui/src/components/menubar.tsx
  • packages/ui/src/components/navigation-menu.tsx
  • packages/ui/src/components/pagination.tsx
  • packages/ui/src/components/popover.tsx
  • packages/ui/src/components/progress.tsx
  • packages/ui/src/components/radio-group.tsx
  • packages/ui/src/components/resizable.tsx
  • packages/ui/src/components/scroll-area.tsx
  • packages/ui/src/components/select.tsx
  • packages/ui/src/components/separator.tsx
  • packages/ui/src/components/sheet.tsx
  • packages/ui/src/components/sidebar.tsx
  • packages/ui/src/components/skeleton.tsx
  • packages/ui/src/components/slider.tsx
  • packages/ui/src/components/sonner.tsx
  • packages/ui/src/components/switch.tsx
  • packages/ui/src/components/table.tsx
  • packages/ui/src/components/tabs.tsx
  • packages/ui/src/components/textarea.tsx
  • packages/ui/src/components/toggle-group.tsx
  • packages/ui/src/components/toggle.tsx
  • packages/ui/src/components/tooltip.tsx
  • packages/ui/src/hooks/use-mobile.ts
  • packages/ui/src/hooks/useInfiniteScroll.ts
  • packages/ui/src/lib/utils.ts

Comment on lines 96 to +105
React.useEffect(() => {
if (!api) return
onSelect(api)
api.on("reInit", onSelect)
api.on("select", onSelect)
if (!api) return;
onSelect(api);
api.on("reInit", onSelect);
api.on("select", onSelect);

return () => {
api?.off("select", onSelect)
}
}, [api, onSelect])
api?.off("select", onSelect);
};
}, [api, onSelect]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Missing cleanup for reInit listener.

Line 99 registers "reInit" but cleanup only unregisters "select". This can accumulate handlers and trigger duplicate onSelect calls.

Suggested fix
   React.useEffect(() => {
     if (!api) return;
     onSelect(api);
     api.on("reInit", onSelect);
     api.on("select", onSelect);

     return () => {
-      api?.off("select", onSelect);
+      api.off("reInit", onSelect);
+      api.off("select", onSelect);
     };
   }, [api, onSelect]);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
React.useEffect(() => {
if (!api) return
onSelect(api)
api.on("reInit", onSelect)
api.on("select", onSelect)
if (!api) return;
onSelect(api);
api.on("reInit", onSelect);
api.on("select", onSelect);
return () => {
api?.off("select", onSelect)
}
}, [api, onSelect])
api?.off("select", onSelect);
};
}, [api, onSelect]);
React.useEffect(() => {
if (!api) return;
onSelect(api);
api.on("reInit", onSelect);
api.on("select", onSelect);
return () => {
api.off("reInit", onSelect);
api.off("select", onSelect);
};
}, [api, onSelect]);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/ui/src/components/carousel.tsx` around lines 96 - 105, The useEffect
registers both "reInit" and "select" listeners on api but the cleanup only
removes "select", causing handler leaks; update the cleanup for the effect that
uses api and onSelect so it unregisters both events (call api.off("reInit",
onSelect) and api.off("select", onSelect) or use optional chaining/api?.off for
safety) to ensure no duplicate onSelect calls are retained.

Comment on lines +28 to +31
const avatar = createAvatar(glass, {
seed: seed.toLowerCase().trim(),
size,
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Guard seed normalization to prevent runtime crashes

seed.toLowerCase().trim() will throw if seed is ever nullish at runtime. Given current call sites may pass optional chained values, this path should be defensive.

Suggested fix
-    const avatar = createAvatar(glass, {
-      seed: seed.toLowerCase().trim(),
-      size,
-    });
+    const normalizedSeed = (seed ?? "").toString().toLowerCase().trim() || "default";
+    const avatar = createAvatar(glass, {
+      seed: normalizedSeed,
+      size,
+    });
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const avatar = createAvatar(glass, {
seed: seed.toLowerCase().trim(),
size,
});
const normalizedSeed = (seed ?? "").toString().toLowerCase().trim() || "default";
const avatar = createAvatar(glass, {
seed: normalizedSeed,
size,
});
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/ui/src/components/dicebear-avatar.tsx` around lines 28 - 31, The
current call passes seed.toLowerCase().trim() which will throw if seed is
nullish; update the seed normalization before calling createAvatar (the seed
argument) to defend against null/undefined by coercing to a safe string (e.g.,
use a fallback like '' or String(seed ?? '') then .toLowerCase().trim()) so
createAvatar(glass, { seed: /*safe-normalized-seed*/, size }) never receives a
nullish value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant