Skip to content

chore: run knip#536

Merged
Hugo0 merged 9 commits intomainfrom
chore/knip_clean
Nov 20, 2024
Merged

chore: run knip#536
Hugo0 merged 9 commits intomainfrom
chore/knip_clean

Conversation

@Hugo0
Copy link
Copy Markdown
Contributor

@Hugo0 Hugo0 commented Nov 19, 2024

No description provided.

@vercel
Copy link
Copy Markdown

vercel bot commented Nov 19, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
peanut-ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 20, 2024 1:38pm

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Nov 19, 2024

📝 Walkthrough

Walkthrough

This pull request introduces a new configuration file, knip.json, which includes a JSON schema reference for validation and specifies paths and dependencies to ignore during analysis. Additionally, several components and functions across the codebase have undergone modifications, primarily focusing on changing the export status of various entities from exported to local, thus altering their accessibility. The package.json file has also been updated to include a new script and adjust dependencies, reflecting the integration of the knip tool and related changes.

Changes

File Change Summary
knip.json New configuration file added with schema reference and specified paths and dependencies to ignore.
package.json Added script "knip"; removed several dependencies; added "knip": "^5.37.1" in devDependencies.
src/components/Cashout/Cashout.consts.ts Changed CashoutScreens type visibility from exported to local.
src/components/Claim/Claim.interfaces.ts Changed xchainDetail interface visibility from exported to local.
src/components/Claim/Generic/AlreadyClaimed.view.tsx Introduced AlreadyClaimedLinkView component with updated export to named export.
src/components/Claim/Generic/NotFound.view.tsx Removed default export for NotFoundClaimLink component.
src/components/Claim/Generic/SenderClaim.view.tsx Introduced SenderClaimLinkView component with new props interface.
src/components/Claim/Link/Initial.view.tsx Updated state management and error handling in InitialClaimLinkView.
src/components/Claim/Link/Onchain/Confirm.view.tsx Enhanced error handling in ConfirmClaimLinkView.
src/components/Claim/Link/Onchain/Success.view.tsx Added state variable for transaction details in SuccessClaimLinkView.
src/components/Claim/useClaimLink.tsx Changed useClaimLink function visibility from exported to local.
src/components/Club/landing.tsx Changed Landing function visibility from exported to local.
src/components/Create/Create.utils.ts Changed convertUSDTokenValue and toLowerCaseKeys functions visibility from exported to local.
src/components/CrispChat.tsx Changed openCrispChat function visibility from exported to local.
src/components/Global/ConfirmDetails/Index.tsx Changed export from named to default for ConfirmDetails component.
src/components/Global/FileUploadInput/index.tsx Changed export from named to default for FileUploadInput component.
src/components/Global/Header/index.tsx Changed Header function visibility from exported to local; enhanced prop typing.
src/components/Global/Testimonials/index.tsx Changed TestimonialBody export status from exported to local.
src/components/Global/TokenSelector/TokenSelector.consts.ts Changed CombinedType interface visibility from exported to local.
src/components/Login/index.tsx Changed LoginComponent export status from exported to local.
src/components/Refund/index.tsx Updated refund process with enhanced error handling.
src/components/Register/index.tsx Changed RegisterComponent export status from exported to local.
src/components/Request/Create/Create.consts.ts Changed CreateScreens type visibility from exported to local.
src/components/Request/Pay/Pay.consts.ts Changed PayScreens type visibility from exported to local.
src/components/Request/Pay/Views/GeneralViews/AlreadyPaid.view.tsx Removed default export for AlreadyPaidLinkView.
src/components/Request/Pay/Views/GeneralViews/Canceled.view.tsx Changed export from default to named for CanceledClaimLink.
src/components/Request/Pay/Views/GeneralViews/Error.view.tsx Removed default export for ErrorView.
src/components/Welcome/welcome.tsx Changed Welcome function visibility from exported to local.
src/components/utils/utils.ts Removed FULFILL from ActionType enum; changed visibility of several utility functions.
src/constants/general.consts.ts Changed ipfsProviderArray and supportedWalletconnectChains from exported to local.
src/hooks/useRecentRecipients.ts Changed RecentRecipient interface visibility from exported to local.
src/interfaces/interfaces.ts Removed export from several interfaces, affecting their visibility.
src/utils/cashout.utils.ts Changed visibility of several utility functions and modified error handling in createLiquidationAddress.
src/utils/general.utils.ts Changed visibility of multiple utility functions, limiting their access to the module.
src/utils/sdkErrorHandler.utils.tsx Changed SDKStatus class visibility from exported to local; improved error handling in ErrorHandler.
.github/workflows/prettier.yml New GitHub Actions workflow added for code formatting checks.
.github/workflows/prettier.yml.disabled Deleted old GitHub Actions workflow for code formatting checks.
.prettierignore Updated to ignore additional files during formatting.
README.md Added a new section on code formatting with Prettier.
global.d.ts Minor modification to the Window interface property $crisp.
sentry.client.config.ts Updated Sentry configuration to enable based on environment.
sentry.edge.config.ts Updated Sentry configuration to enable based on environment.
src/app/api/peanut/user/get-user-id/route.ts Minor formatting adjustment in the POST function.
src/app/page.tsx Restructured imports and commented out several components in LandingPage.
src/components/Cashout/Components/index.ts Added a newline at the end of the file.
src/components/Claim/Claim.consts.ts Minor formatting adjustments in enums and interfaces.
src/components/Club/index.ts Modified exports to explicitly include Landing component.
src/components/LandingPage/index.ts Added multiple exports for components related to the landing page.
src/components/Offramp/Offramp.consts.ts Minor updates to enum and interface properties.
src/components/Offramp/index.ts Reinstated export for Confirm.view.
src/components/Request/Pay/Pay.tsx Adjusted context usage and rendering logic for clarity.

Possibly related PRs

Warning

Rate limit exceeded

@Hugo0 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 19 minutes and 14 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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.

📥 Commits

Reviewing files that changed from the base of the PR and between 12cf538 and 91c6562.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 12cf538 and 91c6562.

📒 Files selected for processing (1)
  • src/config/wagmi.config.tsx (1 hunks)
🔇 Additional comments (1)
src/config/wagmi.config.tsx (1)

43-51: 🛠️ Refactor suggestion

Consider removing the commented-out code instead of commenting it

Since this PR is running knip (a tool for finding unused exports/dead code), and this code block is commented out, it would be better to remove it entirely rather than leaving it as commented code. This helps maintain a cleaner codebase and prevents confusion about whether this configuration might be needed in the future.

-        // // @ts-ignore
-        // authConnector({
-        //     chains: consts.chains,
-        //     options: {
-        //         projectId,
-        //     },
-        //     email: false,
-        //     // socials: ['google', 'github', 'apple', 'email', 'discord', 'facebook']
-        // }),

Please confirm that:

  1. The authConnector functionality is no longer needed
  2. There are no remaining dependencies on this authentication method elsewhere in the codebase

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@notion-workspace
Copy link
Copy Markdown

Clean knip

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Outside diff range and nitpick comments (21)
src/components/CrispChat.tsx (1)

Line range hint 3-7: Consider adding TypeScript types for window.$crisp

While the code handles the Crisp chat integration safely, it would benefit from proper TypeScript types for the global window.$crisp object.

Add this type declaration at the top of the file:

declare global {
  interface Window {
    $crisp: {
      push: (args: unknown[]) => void;
    };
    CRISP_WEBSITE_ID: string;
  }
}

Also applies to: 18-32

src/components/Create/Create.utils.ts (1)

Line range hint 38-48: Consider improving type safety

While making the function local is good, the implementation could benefit from better typing to avoid any.

Consider this type-safe alternative:

-function toLowerCaseKeys(obj: any): any {
-    let newObj: any = {}
+function toLowerCaseKeys<T extends Record<string, unknown>>(obj: T): Record<string, unknown> {
+    const newObj: Record<string, unknown> = {}
     if (obj) {
         Object.keys(obj).forEach((key) => {
             // Convert only the top-level keys to lowercase
-            let lowerCaseKey = key.toLowerCase()
+            const lowerCaseKey = key.toLowerCase()
             newObj[lowerCaseKey] = obj[key]
         })
     }
     return newObj
 }
src/components/Claim/useClaimLink.tsx (2)

Line range hint 69-69: Empty function implementations need attention

The getSquidRoute and checkTxStatus functions are empty implementations that could lead to runtime issues if called. These functions should either be implemented or removed if they're no longer needed.

Would you like me to help implement these functions or create GitHub issues to track their implementation?

Also applies to: 89-89


Line range hint 90-109: Improve error handling in getAttachmentInfo

The function swallows errors and returns undefined implicitly. This could lead to silent failures and make debugging difficult.

Consider this improvement:

 const getAttachmentInfo = async (link: string) => {
     try {
         const response = await fetch('/api/peanut/get-attachment-info', {
             method: 'POST',
             headers: {
                 'Content-Type': 'application/json',
             },
             body: JSON.stringify({ link }),
         })
         if (!response.ok) {
             throw new Error(`HTTP error! status: ${response.status}`)
         }
         const data = await response.json()

         return {
             fileUrl: data.fileUrl,
             message: data.message,
         }
     } catch (error) {
         console.error('Failed to get attachment:', error)
+        throw error; // Propagate the error instead of swallowing it
     }
 }
src/utils/sdkErrorHandler.utils.tsx (3)

Line range hint 9-9: Consider extracting error messages to a constants file

The error messages are currently hardcoded strings. Consider extracting them to a separate constants file to:

  • Facilitate internationalization (i18n)
  • Make maintenance easier
  • Enable reuse across the application

Also applies to: 48-48


Line range hint 49-106: Refactor repetitive error string matching

The else block contains numerous repetitive string matching conditions. Consider refactoring to:

  1. Use a lookup map/object for error messages
  2. Use regex patterns instead of string includes
  3. Group related errors together

Example refactor:

const ERROR_MESSAGES: Record<string, string> = {
  'insufficient funds': "You don't have enough funds.",
  'user rejected transaction': 'Please confirm the transaction in your wallet.',
  // ... other mappings
};

const getErrorMessage = (error: Error): string => {
  const errorString = error.toString();
  return Object.entries(ERROR_MESSAGES).find(
    ([pattern]) => errorString.includes(pattern)
  )?.[1] ?? 'Something failed. Please try again.';
};

Line range hint 50-50: Remove or enhance console.log statement

The console.log statement might leak error details in production. Consider:

  1. Using proper error logging service
  2. Adding error severity levels
  3. Removing it if it's just for debugging
- console.log(error.toString())
+ // Use proper logging service
+ logger.error('SDK Error:', error);
src/components/Global/Testimonials/index.tsx (1)

Line range hint 202-221: Consider using the defined Testimonial interface instead of any.

The testimonial prop is typed as any which reduces type safety. Since there's already a Testimonial interface defined at the top of the file, it would be better to use it.

-const TestimonialBody = ({ testimonial }: { testimonial: any }) => {
+const TestimonialBody = ({ testimonial }: { testimonial: Testimonial }) => {
src/components/Global/Header/index.tsx (1)

Line range hint 29-293: Consider documenting internal components.

Since this PR focuses on cleaning up exports, consider adding a comment at the top of the file to document that all components (except Header) are internal to this module. This will help prevent accidental exports in the future.

Add this comment at the top of the file:

'use client'
+/**
+ * Header component with internal sub-components.
+ * All components in this file except Header are internal and should not be exported.
+ */
import React, { useEffect, useState, useCallback } from 'react'
src/components/Welcome/welcome.tsx (1)

Line range hint 316-324: TODO: Replace SBF person image

There's a pending TODO comment about replacing an image. While not directly related to the knip cleanup, this should be tracked for future improvement.

Would you like me to create a GitHub issue to track this image replacement task?

src/utils/cashout.utils.ts (4)

Line range hint 545-560: Consider keeping CashoutStatus type exported

The CashoutStatus type is used in the exported CashoutTransaction interface. Removing its export might cause compilation errors for consumers of the CashoutTransaction interface who need to reference the CashoutStatus type.

-type CashoutStatus =
+export type CashoutStatus =
    | 'PAYMENT_PROCESSED'
    | 'REFUNDED'
    | 'READY'
    | 'AWAITING_TX'
    | 'AWAITING_FIAT'
    | 'FUNDS_IN_BRIDGE'
    | 'FUNDS_MOVED_AWAY'
    | 'FUNDS_IN_BANK'
    | 'AWAITING_FUNDS'
    | 'IN_REVIEW'
    | 'FUNDS_RECEIVED'
    | 'PAYMENT_SUBMITTED'
    | 'CANCELED'
    | 'ERROR'
    | 'RETURNED'

Also applies to: 562-576


Line range hint 101-114: Enhance error handling in fetchApi

The error message could be more descriptive by including the response status code and potentially the response body.

-        throw new Error(`Failed to fetch data from ${url}`)
+        const errorBody = await response.text()
+        throw new Error(`Failed to fetch data from ${url}. Status: ${response.status}. Details: ${errorBody}`)

Line range hint 485-499: Add rate limiting for BIC validation

The BIC validation endpoint might be susceptible to enumeration attacks. Consider implementing rate limiting.

Consider adding request throttling or rate limiting to prevent potential abuse of the BIC validation endpoint.


Line range hint 509-544: Enhance security in submitCashoutLink

The password extraction from URL fragments could be more robust:

  1. Consider adding input validation for the password parameter
  2. Implement proper error handling for missing password
-    const password = new URLSearchParams(fragment).get('p')!
+    const password = new URLSearchParams(fragment).get('p')
+    if (!password) {
+        throw new Error('Invalid link: missing password parameter')
+    }
+    if (!/^[a-zA-Z0-9-_]+$/.test(password)) {
+        throw new Error('Invalid password format')
+    }
src/utils/general.utils.ts (7)

Line range hint 79-87: Fix typo in function name delteFromLocalStorage

The function name contains a typo: "delte" should be "delete".

-const delteFromLocalStorage = (key: string) => {
+const deleteFromLocalStorage = (key: string) => {

Line range hint 51-61: Consolidate localStorage operations into a dedicated service

The localStorage operations are scattered across multiple functions with duplicated error handling and type checking. Consider consolidating these into a dedicated service class.

+class LocalStorageService {
+  private static isAvailable(): boolean {
+    return typeof localStorage !== 'undefined'
+  }
+
+  static save(key: string, data: any): void {
+    try {
+      if (!this.isAvailable()) return
+      localStorage.setItem(key, JSON.stringify(data))
+      console.log(`Saved ${key} to localStorage:`, data)
+    } catch (error) {
+      console.error('Error saving to localStorage:', error)
+    }
+  }
+
+  static get(key: string): any {
+    try {
+      if (!this.isAvailable()) return null
+      const data = localStorage.getItem(key)
+      return data ? JSON.parse(data) : null
+    } catch (error) {
+      console.error('Error getting data from localStorage:', error)
+      return null
+    }
+  }
+
+  static delete(key: string): void {
+    try {
+      if (!this.isAvailable()) return
+      localStorage.removeItem(key)
+      console.log(`Removed ${key} from localStorage`)
+    } catch (error) {
+      console.error('Error removing from localStorage:', error)
+    }
+  }
+}

Also applies to: 63-77, 79-87


Line range hint 33-50: Add timeout cleanup in waitForPromise

The timeout ID is not cleared if the promise is rejected. This could lead to a memory leak.

 function waitForPromise<T>(promise: Promise<T>, timeoutTime: number = 30000): Promise<T> {
     return new Promise((resolve, reject) => {
         let timeoutId = setTimeout(() => {
+            timeoutId = undefined;
             reject('Timeout: 30 seconds have passed without a response from the promise')
         }, timeoutTime)
 
         promise
             .then((result) => {
-                clearTimeout(timeoutId)
+                if (timeoutId) {
+                    clearTimeout(timeoutId)
+                    timeoutId = undefined
+                }
                 resolve(result)
             })
             .catch((error) => {
-                clearTimeout(timeoutId)
+                if (timeoutId) {
+                    clearTimeout(timeoutId)
+                    timeoutId = undefined
+                }
                 reject(error)
             })
     })
 }

Line range hint 283-290: Simplify boolean expression in isMantleInUrl

The function can be simplified by removing the redundant ternary operation.

 const isMantleInUrl = (): boolean => {
     if (typeof window !== 'undefined') {
-        return window.location.origin.includes('mantle') ? true : false
+        return window.location.origin.includes('mantle')
     } else {
         return false
     }
 }
🧰 Tools
🪛 Biome

[error] 285-285: Unnecessary use of boolean literals in conditional expression.

Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with

(lint/complexity/noUselessTernary)


Line range hint 870-882: Use TypeScript enum for icon types

The switch statement uses magic strings. Consider using an enum for better type safety and maintainability.

+enum TransactionType {
+    LINK_SENT = 'Link Sent',
+    DIRECT_SENT = 'Direct Sent',
+    LINK_RECEIVED = 'Link Received',
+    OFFRAMP_CLAIM = 'Offramp Claim'
+}
+
+enum IconName {
+    SEND = 'send',
+    RECEIVE = 'receive'
+}
+
-function getIconName(type: string) {
+function getIconName(type: TransactionType): IconName | undefined {
     switch (type) {
-        case 'Link Sent':
-            return 'send'
-        case 'Direct Sent':
-            return 'send'
-        case 'Link Received':
-            return 'receive'
-        case 'Offramp Claim':
-            return 'send'
+        case TransactionType.LINK_SENT:
+        case TransactionType.DIRECT_SENT:
+        case TransactionType.OFFRAMP_CLAIM:
+            return IconName.SEND
+        case TransactionType.LINK_RECEIVED:
+            return IconName.RECEIVE
         default:
             return undefined
     }
 }

Line range hint 200-224: Add pagination to getAllGigalinksFromLocalstorage

The function iterates through all localStorage items without pagination, which could cause performance issues with a large number of items.

-const getAllGigalinksFromLocalstorage = ({ address }: { address: string }) => {
+const getAllGigalinksFromLocalstorage = ({ 
+    address,
+    page = 1,
+    pageSize = 50
+}: { 
+    address: string,
+    page?: number,
+    pageSize?: number
+}) => {
     try {
         if (typeof localStorage === 'undefined') return
 
         const localStorageData: interfaces.ILocalStorageItem[] = []
+        const startIndex = (page - 1) * pageSize
+        let itemsProcessed = 0
 
         for (let i = 0; i < localStorage.length; i++) {
+            if (itemsProcessed >= pageSize) break
+            
             const key = localStorage.key(i)
 
             if (key !== null && key?.includes('saving giga-link for address: ' + address)) {
                 const value = localStorage.getItem(key)
-                if (value !== null) {
+                if (value !== null && itemsProcessed < pageSize) {
                     const x = {
                         address: key.split('-')[0].trim(),
                         hash: key.split('-')[1]?.trim() ?? '',
                         idx: key.split('-')[2]?.trim() ?? '',
                         link: value.replaceAll('"', ''),
                     }
                     localStorageData.push(x)
+                    itemsProcessed++
                 }
             }
         }
         return localStorageData
     } catch (error) {
         console.error('Error getting data from localStorage:', error)
     }
 }

275-281: Optimize formatMessage function

The current implementation can be simplified and made more efficient.

-function formatMessage(message: string) {
-    return message
-        .split('\n')
-        .map((line) => line.trim())
-        .filter((line) => !!line)
-        .join('\n')
+function formatMessage(message: string) {
+    return message.split('\n').reduce((acc, line) => {
+        const trimmed = line.trim()
+        return trimmed ? acc + (acc ? '\n' : '') + trimmed : acc
+    }, '')
}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 52de8a7 and 863962c.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (35)
  • knip.json (1 hunks)
  • package.json (2 hunks)
  • src/components/Cashout/Cashout.consts.ts (1 hunks)
  • src/components/Claim/Claim.interfaces.ts (1 hunks)
  • src/components/Claim/Generic/AlreadyClaimed.view.tsx (0 hunks)
  • src/components/Claim/Generic/NotFound.view.tsx (0 hunks)
  • src/components/Claim/Generic/SenderClaim.view.tsx (0 hunks)
  • src/components/Claim/Link/Initial.view.tsx (0 hunks)
  • src/components/Claim/Link/Onchain/Confirm.view.tsx (0 hunks)
  • src/components/Claim/Link/Onchain/Success.view.tsx (0 hunks)
  • src/components/Claim/useClaimLink.tsx (1 hunks)
  • src/components/Club/landing.tsx (1 hunks)
  • src/components/Create/Create.utils.ts (2 hunks)
  • src/components/CrispChat.tsx (1 hunks)
  • src/components/Global/ConfirmDetails/Index.tsx (1 hunks)
  • src/components/Global/FileUploadInput/index.tsx (1 hunks)
  • src/components/Global/Header/index.tsx (1 hunks)
  • src/components/Global/Testimonials/index.tsx (1 hunks)
  • src/components/Global/TokenSelector/TokenSelector.consts.ts (1 hunks)
  • src/components/Login/index.tsx (1 hunks)
  • src/components/Refund/index.tsx (0 hunks)
  • src/components/Register/index.tsx (1 hunks)
  • src/components/Request/Create/Create.consts.ts (1 hunks)
  • src/components/Request/Pay/Pay.consts.ts (1 hunks)
  • src/components/Request/Pay/Views/GeneralViews/AlreadyPaid.view.tsx (0 hunks)
  • src/components/Request/Pay/Views/GeneralViews/Canceled.view.tsx (0 hunks)
  • src/components/Request/Pay/Views/GeneralViews/Error.view.tsx (0 hunks)
  • src/components/Welcome/welcome.tsx (1 hunks)
  • src/components/utils/utils.ts (1 hunks)
  • src/constants/general.consts.ts (2 hunks)
  • src/hooks/useRecentRecipients.ts (1 hunks)
  • src/interfaces/interfaces.ts (5 hunks)
  • src/utils/cashout.utils.ts (6 hunks)
  • src/utils/general.utils.ts (8 hunks)
  • src/utils/sdkErrorHandler.utils.tsx (1 hunks)
💤 Files with no reviewable changes (10)
  • src/components/Claim/Generic/AlreadyClaimed.view.tsx
  • src/components/Claim/Generic/NotFound.view.tsx
  • src/components/Claim/Generic/SenderClaim.view.tsx
  • src/components/Claim/Link/Initial.view.tsx
  • src/components/Claim/Link/Onchain/Confirm.view.tsx
  • src/components/Claim/Link/Onchain/Success.view.tsx
  • src/components/Refund/index.tsx
  • src/components/Request/Pay/Views/GeneralViews/AlreadyPaid.view.tsx
  • src/components/Request/Pay/Views/GeneralViews/Canceled.view.tsx
  • src/components/Request/Pay/Views/GeneralViews/Error.view.tsx
✅ Files skipped from review due to trivial changes (2)
  • knip.json
  • src/components/Club/landing.tsx
🔇 Additional comments (35)
src/components/Claim/Claim.interfaces.ts (1)

Line range hint 4-9: LGTM! Appropriate visibility change.

The removal of the export keyword for xchainDetail interface aligns with the PR objective of cleaning up unused exports.

Let's verify this interface is only used locally within the Claim component:

src/components/CrispChat.tsx (1)

Line range hint 3-7: LGTM! Good encapsulation of the chat opening logic.

The removal of the export keyword is appropriate as this function is only used internally by the CrispButton component.

Let's verify that openCrispChat is indeed only used within this file:

✅ Verification successful

The previous command might have failed to show results because:

  1. We need to see the actual usage context
  2. We should also check for any imports of this file
  3. The function might be referenced in different ways

Let me analyze the results of these broader searches to make a conclusive verification.


Removal of export from openCrispChat is correct and safe

The verification confirms that:

  • openCrispChat is only used internally within CrispChat.tsx as a click handler for the CrispButton component
  • While CrispChat module is imported in multiple places, only the exported CrispButton component is being used
  • The function's scope reduction aligns with the knip tool's suggestion and good encapsulation practices
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that openCrispChat is not imported elsewhere
# Expected: No matches outside this file

rg -l "openCrispChat" | grep -v "CrispChat.tsx"

Length of output: 45


Script:

#!/bin/bash
# Let's try a more comprehensive search using ripgrep with context
rg -C 3 "openCrispChat"

# Also search for any imports from this file
rg "from ['\"].*CrispChat['\"]"

Length of output: 1403

src/components/Request/Create/Create.consts.ts (1)

4-4: LGTM! The export removal aligns with knip's unused export detection.

The change to make CreateScreens a local type is safe as it's only used internally by other exports in this module.

Let's verify that CreateScreens isn't imported elsewhere in the codebase:

src/hooks/useRecentRecipients.ts (1)

Line range hint 6-10: LGTM! Appropriate encapsulation of internal interface.

The removal of the export keyword from RecentRecipient interface aligns with the PR's objective of cleaning up unused exports. The interface is only used internally within this module, making this change a good practice for better encapsulation.

Let's verify there are no external usages of this interface:

✅ Verification successful

The removal of export from RecentRecipient interface is safe

The verification confirms that the interface is only referenced internally within useRecentRecipients.ts. The external component GeneralRecipientInput only imports the hook itself, not the interface. All type references to RecentRecipient are contained within the same file.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify that RecentRecipient interface is not imported elsewhere
# Expected: No results, confirming it's safe to remove the export

# Search for imports of RecentRecipient
rg "import.*RecentRecipient.*from.*useRecentRecipients"

# Search for type references using RecentRecipient
rg ":\s*RecentRecipient[\[\]\s{},]"

Length of output: 423

src/components/Request/Pay/Pay.consts.ts (1)

5-5: LGTM! Appropriate removal of unused export.

The removal of the export keyword from PayScreens type aligns with the PR's objective of cleaning up unused exports. The type is still properly used internally within the module.

Let's verify that there are no external usages of this type:

✅ Verification successful

Verified: Safe to remove the export keyword

The search results confirm that PayScreens type is only used internally within src/components/Request/Pay/Pay.consts.ts. All references are contained within the same file:

  • Type definition: type PayScreens = 'INITIAL' | 'SUCCESS'
  • Used in interface: screen: PayScreens
  • Used in array constant: PAY_SCREEN_FLOW: PayScreens[]
  • Used in map type: PAY_SCREEN_MAP: { [key in PayScreens]: ... }
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for any external usage of PayScreens type
# Expected: No results outside this file, as it should only be used internally

# Search for PayScreens type usage
rg "PayScreens" --type ts --type tsx

Length of output: 64


Script:

#!/bin/bash
# Let's try a different approach to search for PayScreens usage
# First, let's find all TypeScript files
rg --type-list | grep -i typescript

# Then search for PayScreens in all files
rg "PayScreens" 

# Also check with ast-grep for type references
ast-grep --pattern 'type $_: PayScreens'

Length of output: 473

src/components/Create/Create.utils.ts (2)

Line range hint 1-48: Changes look good overall

The removal of unnecessary exports aligns well with the knip cleanup objective while maintaining the module's functionality. The remaining exports seem to be used externally, and the internal functions are properly scoped.


7-9: Verify removal of export doesn't break dependencies

The change to make convertUSDTokenValue a local function aligns with the knip cleanup. Let's verify it's only used within this module.

✅ Verification successful

✅ Safe to remove export from convertUSDTokenValue

The function is only defined in Create.utils.ts and not used anywhere else in the codebase, including other files within the Create component. Making it a local function aligns with the PR's objective of removing unused exports.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any usage of convertUSDTokenValue outside this file
# to ensure we're not breaking any dependencies

rg "convertUSDTokenValue" --type ts --type tsx \
  --glob '!src/components/Create/Create.utils.ts'

Length of output: 122


Script:

#!/bin/bash
# Search for any usage of convertUSDTokenValue in all files
# excluding the source file itself
rg "convertUSDTokenValue" \
  --type-add 'tsx:*.tsx' \
  --type-add 'ts:*.ts' \
  -t ts -t tsx \
  --glob '!src/components/Create/Create.utils.ts'

Length of output: 130


Script:

#!/bin/bash
# Let's check where this function is used within the Create component
# First, find all files in the Create directory
fd . src/components/Create -t f -e ts -e tsx | while read -r file; do
  echo "=== $file ==="
  rg "convertUSDTokenValue" "$file" || true
done

Length of output: 2299

src/components/Cashout/Cashout.consts.ts (1)

6-6: LGTM! Good encapsulation of internal type.

The removal of the export keyword from CashoutScreens type is appropriate as it's only used internally within the exported constants.

Let's verify that this type isn't imported elsewhere in the codebase:

✅ Verification successful

Removal of CashoutScreens export is safe and verified

The verification confirms that:

  • CashoutScreens is only used within its own file (src/components/Cashout/Cashout.consts.ts)
  • Other files importing from Cashout.consts.ts use wildcard imports (*) and only access the exported members
  • The type is correctly used internally by the exported CASHOUT_SCREEN_FLOW and CASHOUT_SCREEN_MAP constants
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify CashoutScreens type isn't imported elsewhere
# Expected: No results, confirming it's safe to remove the export

# Search for imports of CashoutScreens
rg "import.*\{.*CashoutScreens.*\}.*from.*Cashout\.consts"

# Search for direct type references
rg "CashoutScreens[\s]*[:\)]" --type ts

Length of output: 102


Script:

#!/bin/bash
# Let's try a more comprehensive search approach

# 1. Find all TypeScript files that might reference CashoutScreens
rg -l "CashoutScreens" --type ts

# 2. Search for any import statement containing Cashout.consts
rg "from ['\"].*Cashout\.consts['\"]" --type ts

# 3. Look at the content of the Cashout.consts.ts file to understand the usage
cat src/components/Cashout/Cashout.consts.ts

# 4. Search for any type usage pattern that might reference this type
rg "type.*=.*['\"](?:INITIAL|CONFIRM|SUCCESS)['\"]" --type ts

Length of output: 3185

package.json (4)

13-13: LGTM: Script addition aligns with PR objective

The addition of the "knip" script enables running dependency analysis to identify unused exports and dependencies.


69-69: Verify knip version stability

The knip version ^5.37.1 allows minor updates. Given this is a new tool being introduced for dependency management, we should verify its stability.

✅ Verification successful

Version 5.37.1 appears stable for production use

The version history shows:

  • Regular, incremental updates with no breaking changes since v5.0.0 (Feb 2024)
  • Active maintenance with consistent patch releases
  • No reported issues specific to version 5.37.1
  • Recent release (Nov 15, 2024) with previous version 5.37.0 released just a day before

The caret (^) version range is appropriate here as the project follows semantic versioning with stable minor releases.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check release history and frequency of breaking changes
curl -s https://registry.npmjs.org/knip | jq '.time' | grep -E '5\.[0-9]+\.[0-9]+'

# Check for any reported issues with this version
gh api graphql -f query='
{
  search(query: "repo:webpro/knip is:issue 5.37.1", type: ISSUE, first: 5) {
    nodes {
      ... on Issue {
        title
        state
        createdAt
      }
    }
  }
}'

Length of output: 5353


58-58: Verify wagmi version compatibility

The wagmi version is pinned to 2.8.6. While this is good for stability, we should verify it's compatible with the @wagmi/core and @web3modal/wagmi dependencies.

✅ Verification successful

Let me generate one more verification script to check the actual package.json dependencies to get a complete picture.


Version compatibility verified successfully

The wagmi version 2.8.6 is compatible with all related dependencies:

  • @web3modal/wagmi requires wagmi >= 2.0.0
  • viem ^2.21.10 satisfies wagmi's peer dependency of viem 2.x
  • All other peer dependencies (react, typescript, @tanstack/react-query) are not in conflict
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for peer dependency requirements
curl -s https://registry.npmjs.org/wagmi/2.8.6 | jq '.peerDependencies'

# Check if @wagmi/core and @web3modal/wagmi specify wagmi as a peer dependency
curl -s https://registry.npmjs.org/@wagmi/core/2.12.16 | jq '.peerDependencies'
curl -s https://registry.npmjs.org/@web3modal/wagmi/5.1.9 | jq '.peerDependencies'

Length of output: 577


Script:

#!/bin/bash
# Check package.json for related dependencies
cat package.json | jq '.dependencies | {wagmi, "@wagmi/core", "@web3modal/wagmi", viem}'

Length of output: 196


Line range hint 1-76: Verify impact of removed dependencies

The PR removes several dependencies (country-list, encoding, frames.js, etc.) as identified by knip. While this is good for maintenance, we should verify these aren't used indirectly.

✅ Verification successful

Let me run one more verification using ripgrep to ensure we don't miss any string-based requires or dynamic imports that ast-grep might have missed.


Let me try one final search without specifying file types since ripgrep had issues with jsx extension:


Dependencies safely removed - minor cleanup needed

The verification shows that most removed dependencies are not referenced in the codebase, with a few exceptions that need attention:

  • logrocket: Found commented-out code in src/config/peanut.config.tsx that should be removed
  • The word "three" appears in utility functions but refers to 3-character country codes, not the three.js package
  • "encoding" appears only in HTTP headers, not package usage

The remaining removed dependencies have no references, confirming they were unused.

Action items:

  • Remove commented LogRocket code from src/config/peanut.config.tsx
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any remaining imports of removed packages
echo "Checking for remaining imports of removed packages..."

packages=(
  "country-list"
  "encoding"
  "frames.js"
  "fs-extra"
  "libphonenumber-js"
  "logrocket"
  "lokijs"
  "node-fetch"
  "pino-pretty"
  "prop-types"
  "react-device-detect"
  "react-google-recaptcha"
  "sharp"
  "three"
)

for package in "${packages[@]}"; do
  echo "Checking imports for $package..."
  # Use ast-grep to find import statements
  ast-grep --pattern "import * from '$package'" || true
  ast-grep --pattern "require('$package')" || true
done

Length of output: 3446


Script:

#!/bin/bash
# Search for any string references to the removed packages
packages=(
  "country-list"
  "encoding"
  "frames.js"
  "fs-extra"
  "libphonenumber-js"
  "logrocket"
  "lokijs"
  "node-fetch"
  "pino-pretty"
  "prop-types"
  "react-device-detect"
  "react-google-recaptcha"
  "sharp"
  "three"
)

for package in "${packages[@]}"; do
  echo "Checking references for $package..."
  rg -i "$package" --type js --type ts --type jsx --type tsx
done

Length of output: 3150


Script:

#!/bin/bash
# Search for any string references to the removed packages without file type restrictions
packages=(
  "country-list"
  "encoding"
  "frames.js"
  "fs-extra"
  "libphonenumber-js"
  "logrocket"
  "lokijs"
  "node-fetch"
  "pino-pretty"
  "prop-types"
  "react-device-detect"
  "react-google-recaptcha"
  "sharp"
  "three"
)

for package in "${packages[@]}"; do
  echo "Checking references for $package..."
  rg -i "$package" --type-add 'web:*.{js,ts,jsx,tsx}' --type web
done

Length of output: 3783

src/components/Global/FileUploadInput/index.tsx (2)

17-17: LGTM: Component declaration modified as part of export refactoring

The removal of the export keyword from the component declaration aligns with the transition to using default export, which is part of the broader export refactoring effort initiated by running the knip tool.


Line range hint 73-73: LGTM: Export style updated

The change to default export is consistent with the PR's objective of optimizing exports based on knip analysis.

Let's verify this component's usage to ensure the export change doesn't break existing imports:

✅ Verification successful

Export style change is correctly aligned with imports

All imports of FileUploadInput across the codebase are using default import syntax, which aligns with the change to default export. Found in:

  • src/components/Request/Create/Views/Initial.view.tsx
  • src/components/Create/Link/Input.view.tsx
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check how FileUploadInput is imported across the codebase
# Expect: All imports should be default imports

# Search for FileUploadInput imports
rg "import.*FileUploadInput.*from.*components/Global/FileUploadInput"

Length of output: 298

src/components/Login/index.tsx (2)

Line range hint 11-89: Implementation looks good!

The component implementation is well-structured with proper:

  • Error handling
  • Loading states
  • Type safety
  • Separation of concerns

10-10: ⚠️ Potential issue

Verify component exports and imports

The export keyword has been removed from the LoginComponent declaration, but there's no visible default export statement. This could break imports in other files that depend on this component.

Let's verify the component usage and export pattern:

Consider adding either:

-const LoginComponent = () => {
+export const LoginComponent = () => {

or

const LoginComponent = () => {
  // ... component implementation
}
+export default LoginComponent
✅ Verification successful

Export removal is correct as part of the cleanup

The removal of the export keyword from LoginComponent is correct because:

  1. The component is not directly imported anywhere in the codebase
  2. Other files are using GlobalLoginComponent from a different path
  3. The export * from './Login' in components/index.ts suggests this was an unused export
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check LoginComponent imports and exports

# Check how LoginComponent is imported in other files
echo "Checking imports of LoginComponent:"
rg -l "import.*LoginComponent.*from.*components/Login"

# Check if there's a default export in this file that we might have missed
echo -e "\nChecking for default export:"
rg "export default" "src/components/Login/index.tsx"

# Check for any other exports in this file
echo -e "\nChecking for other exports:"
rg "export" "src/components/Login/index.tsx"

Length of output: 377


Script:

#!/bin/bash
# Let's try a broader search approach

# First, let's check if the file exists and see its content
echo "Checking Login component file content:"
cat src/components/Login/index.tsx

# Check for any imports of anything from Login directory
echo -e "\nChecking broader import patterns:"
rg "import.*from.*['\"].*Login['\"]"

# Check for file references to Login
echo -e "\nChecking file references to Login:"
rg -l "Login"

# List files in the Login directory
echo -e "\nListing files in Login directory:"
fd . src/components/Login

Length of output: 4131


Script:

#!/bin/bash
# Let's check the components/index.ts file since it might be the main export point
echo "Checking components/index.ts content:"
cat src/components/index.ts

# Let's also check if LoginComponent is used directly in any of the files we found
echo -e "\nChecking usage of LoginComponent:"
rg "LoginComponent" src/components/Register/index.tsx src/components/Profile/Components/SkeletonPage.tsx src/components/Global/LinkAccountComponent/index.tsx src/components/Global/KYCComponent/index.tsx

Length of output: 1306

src/components/Register/index.tsx (2)

Line range hint 12-82: Implementation looks good!

The component implementation is well-structured with:

  • Proper error handling in the logout flow
  • Clear loading states and user feedback
  • Well-organized conditional rendering
  • Type-safe state management

11-11: ⚠️ Potential issue

Missing default export for RegisterComponent

While changing the component to a local constant aligns with the knip cleanup, the component still needs to be exported if it's used in other files. I don't see a default export statement at the end of the file.

Let's verify if and where this component is imported:

src/components/Global/ConfirmDetails/Index.tsx (3)

Line range hint 3-11: LGTM! Props interface and component declaration are well-structured.

The interface and component declaration follow TypeScript best practices with proper typing.

Also applies to: 13-20


Line range hint 21-77: LGTM! Component implementation is sound.

The component logic is well-structured with proper conditional rendering and fallback handling.


13-13: Verify imports of ConfirmDetails component.

The change from named export to default export will require updates to import statements in other files.

✅ Verification successful

No updates needed for ConfirmDetails imports

The verification shows that all imports of the ConfirmDetails component are already using the default import syntax:

  • src/components/Claim/Generic/AlreadyClaimed.view.tsx
  • src/components/Create/Link/Confirm.view.tsx

Both files use import ConfirmDetails from '@/components/Global/ConfirmDetails/Index', which is the correct syntax for default exports. No changes are required.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Find all imports of ConfirmDetails to ensure they're updated
# to use default import syntax

# Search for any import of ConfirmDetails
rg "import.*ConfirmDetails.*from.*Global/ConfirmDetails" -A 1

# Search for specific named import pattern that needs to be updated
rg "import \{ ConfirmDetails \} from.*Global/ConfirmDetails" -A 1

Length of output: 518

src/constants/general.consts.ts (2)

Line range hint 18-34: Verify usage of supportedWalletconnectChains before removing export

The constant has been changed from exported to local scope. Let's verify it's only used within this module.

Additionally, consider adding a comment explaining why these specific chains are supported, as this could help future maintenance.

+// List of chains supported by WalletConnect integration
 const supportedWalletconnectChains = <{ chainId: string; name: string }[]>[
✅ Verification successful

Removing export is safe, consider adding documentation

The constant supportedWalletconnectChains is only used within its own module (src/constants/general.consts.ts) and has no external references. Removing the export is safe. As suggested, adding documentation about supported chains would improve maintainability.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any external usage of supportedWalletconnectChains
rg "supportedWalletconnectChains" --type ts --type tsx

Length of output: 82


Script:

#!/bin/bash
# Search for any external usage of supportedWalletconnectChains, using ripgrep without file type filters
rg "supportedWalletconnectChains"

Length of output: 141


Line range hint 3-13: Verify usage of ipfsProviderArray before removing export

The constant has been changed from exported to local scope. Let's verify it's only used within this module.

✅ Verification successful

✓ Safe to remove export from ipfsProviderArray

The constant ipfsProviderArray is only referenced in its declaration file and not imported or used anywhere else in the codebase. Removing its export status aligns with the knip tool's recommendations for eliminating unused exports.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any external usage of ipfsProviderArray
rg "ipfsProviderArray" --type ts --type tsx

Length of output: 71


Script:

#!/bin/bash
# Search for any usage of ipfsProviderArray with ripgrep, including TypeScript and JavaScript files
rg "ipfsProviderArray" -t ts -t js -t jsx -t tsx

# Backup search using ast-grep to find any references to ipfsProviderArray
ast-grep --pattern 'ipfsProviderArray'

Length of output: 177


Script:

#!/bin/bash
# Search for any usage of ipfsProviderArray with simpler ripgrep command
rg "ipfsProviderArray" --type-add 'ts:*.{ts,tsx}' --type-add 'js:*.{js,jsx}'

# Also search for IPFS gateway usage patterns to ensure we're not missing any references
rg "ipfs.*gateway" --type-add 'ts:*.{ts,tsx}' --type-add 'js:*.{js,jsx}'

Length of output: 211

src/components/Claim/useClaimLink.tsx (1)

11-11: Verify import statements in dependent components

The change from named export to default export might require updates in components that import this hook.

✅ Verification successful

No import updates needed - all imports are already using default import syntax

All files importing useClaimLink are already using the default import syntax (import useClaimLink from ...), which matches the change from named export to default export. No updates are required in the dependent components.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for files importing useClaimLink to ensure they're updated
rg "import.*useClaimLink.*from.*Claim/useClaimLink" -l

# Search for any remaining named imports that need to be updated
rg "import \{.*useClaimLink.*\} from.*Claim/useClaimLink" -l

Length of output: 159


Script:

#!/bin/bash
# Check the actual import statement in the dependent file
rg "import.*useClaimLink.*from.*Claim/useClaimLink" -A 1 src/components/Offramp/Confirm.view.tsx

# Also check if there are any other potential imports with different path patterns
rg "import.*useClaimLink" -A 1

Length of output: 1033

src/components/utils/utils.ts (1)

113-113: Verify the removal of ActionType.FULFILL

The removal of the FULFILL enum value might impact existing code that relies on this action type for points calculation. While knip detected this as unused, we should verify that:

  1. No other parts of the codebase reference this action type
  2. No API endpoints expect this value
  3. No existing transactions or historical data depend on this value
src/utils/sdkErrorHandler.utils.tsx (1)

Line range hint 3-7: Verify removal of SDKStatus export doesn't break dependencies

The removal of the export keyword from SDKStatus aligns with the PR's objective of reducing exported entities. However, let's verify this doesn't break any external dependencies.

✅ Verification successful

Removal of SDKStatus export is safe

The SDKStatus class is only used internally within the sdkErrorHandler.utils.tsx file:

  • One instance for the class declaration
  • One instance in error type checking logic

Since there are no external references to this class in the codebase, removing the export keyword is safe and aligns with the goal of reducing exported entities.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any external usage of SDKStatus class
rg "SDKStatus" --type ts --type tsx

Length of output: 63


Script:

#!/bin/bash
# Search for any usage of SDKStatus class with proper file extensions
rg "SDKStatus" -t ts -t jsx -t tsx -t js -t jsx

Length of output: 75


Script:

#!/bin/bash
# Search for any usage of SDKStatus class using ripgrep without file type filters
rg "SDKStatus"

Length of output: 206

src/components/Global/Testimonials/index.tsx (1)

202-202: LGTM! Appropriate encapsulation of internal component.

The removal of the export for TestimonialBody is correct as it's only used internally within the Testimonials component. This change aligns with the PR objective of cleaning up unused exports.

src/interfaces/interfaces.ts (5)

Line range hint 104-399: LGTM! Clean interface hierarchy maintained

The changes systematically remove exports from supporting interfaces while maintaining exports for main interfaces that compose them. This creates a cleaner public API surface while keeping implementation details internal.


210-213: Verify removal of export for KYCResponse interface

The interface acts as a wrapper for the exported KYCData interface. Let's verify it's not used externally.

✅ Verification successful

Removal of export for KYCResponse interface is appropriate

The interface is only used within its own file and not imported or referenced anywhere else in the codebase. Removing the export keyword aligns with the principle of minimal exposure and doesn't impact any external dependencies.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any usage of KYCResponse interface outside this file
rg "KYCResponse[^a-zA-Z]" --type ts --glob '!src/interfaces/interfaces.ts'

Length of output: 76


Script:

#!/bin/bash
# Let's try a more comprehensive search for KYCResponse usage
# Search without non-word character constraint
rg "KYCResponse" --type ts -A 2

# Also search for potential import statements
rg "import.*KYCResponse" --type ts

Length of output: 217


Line range hint 104-108: Verify removal of export for IChain interface

The removal of the export modifier suggests this interface is only used internally. Let's verify this assumption.

✅ Verification successful

Removal of export for IChain interface is appropriate

The comprehensive search across the codebase shows no external usage of the IChain interface. No type annotations, imports, generic type parameters, or interface extensions were found outside of the interfaces.ts file, confirming that this interface is only used internally within the file.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any usage of IChain interface outside this file
rg "IChain[^a-zA-Z]" --type ts --glob '!src/interfaces/interfaces.ts'

Length of output: 71


Script:

#!/bin/bash
# Let's try a more comprehensive search for IChain
# 1. Search for IChain as a type annotation
rg ":\s*IChain\b" --type ts

# 2. Search for IChain in import statements
rg "import.*IChain" --type ts

# 3. Search for IChain as a generic type parameter
rg "<\s*IChain\b" --type ts

# 4. Search for extends IChain
rg "extends\s+IChain\b" --type ts

Length of output: 127

🧰 Tools
🪛 Biome

[error] 101-101: Don't use '{}' as a type.

Prefer explicitly define the object shape. '{}' means "any non-nullable value".

(lint/complexity/noBannedTypes)


Line range hint 385-399: Verify removal of export for Contact interface

The interface is used within the exported IUserProfile interface. Let's verify it's not used elsewhere.

✅ Verification successful

Removal of export for Contact interface is appropriate

The Contact interface is only used internally within interfaces.ts as a type for the contacts array in IUserProfile. No other files import or use this interface, making it safe to remove the export keyword.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any usage of Contact interface outside this file
rg "Contact[^a-zA-Z]" --type ts --glob '!src/interfaces/interfaces.ts'

Length of output: 72


Script:

#!/bin/bash
# Let's try a more comprehensive search for Contact interface usage
# First, let's check for type annotations and interface extensions
rg ":\s*Contact\b|extends\s+Contact\b|implements\s+Contact\b" --type ts

# Also search for potential imports of Contact
rg "import.*Contact.*from" --type ts

# And check for any Contact type assertions
rg "as\s+Contact\b" --type ts

Length of output: 197


237-242: Verify removal of exports for Bridge-related interfaces

Multiple Bridge-related interfaces had their exports removed, while IBridgeAccount and IBridgeLiquidationAddress remain exported. This suggests these are supporting types used only within the main exported interfaces. Let's verify this restructuring.

Also applies to: 244-247, 250-256, 258-262, 264-268, 270-277, 279-293

✅ Verification successful

Let me try a different search strategy to verify the usage of these interfaces.


Let me try one final verification to check if these interfaces are used as types within IBridgeAccount or other exported interfaces.


Based on the output, I can now generate the final response since we found that IBridgeIbanDetails and IBridgeUsAccountDetails are used as internal types within the exported IBridgeAccount interface (in the account_details field). This confirms the original assumption about the interfaces being supporting types.

Removal of exports for Bridge-related interfaces is correct

The removed exports for Bridge-related interfaces are appropriate as they are internal supporting types. For example, IBridgeIbanDetails and IBridgeUsAccountDetails are used within the account_details field of the exported IBridgeAccount interface, making them implementation details that don't need to be exposed externally.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any external usage of the Bridge interfaces
echo "Checking IBridgeIbanDetails usage..."
rg "IBridgeIbanDetails[^a-zA-Z]" --type ts --glob '!src/interfaces/interfaces.ts'

echo "Checking IBridgeUsAccountDetails usage..."
rg "IBridgeUsAccountDetails[^a-zA-Z]" --type ts --glob '!src/interfaces/interfaces.ts'

echo "Checking IBridgeDepositInstructions usage..."
rg "IBridgeDepositInstructions[^a-zA-Z]" --type ts --glob '!src/interfaces/interfaces.ts'

echo "Checking IBridgeSource usage..."
rg "IBridgeSource[^a-zA-Z]" --type ts --glob '!src/interfaces/interfaces.ts'

echo "Checking IBridgeDestination usage..."
rg "IBridgeDestination[^a-zA-Z]" --type ts --glob '!src/interfaces/interfaces.ts'

echo "Checking IBridgeReceipt usage..."
rg "IBridgeReceipt[^a-zA-Z]" --type ts --glob '!src/interfaces/interfaces.ts'

echo "Checking IBridgeTransaction usage..."
rg "IBridgeTransaction[^a-zA-Z]" --type ts --glob '!src/interfaces/interfaces.ts'

Length of output: 1180


Script:

#!/bin/bash
# Search for any external usage of the Bridge interfaces with more context
# and without the boundary check to catch potential type extensions or implementations

echo "Checking IBridgeIbanDetails usage..."
rg "IBridgeIbanDetails" --type ts -A 2 --glob '!src/interfaces/interfaces.ts'

echo "Checking IBridgeUsAccountDetails usage..."
rg "IBridgeUsAccountDetails" --type ts -A 2 --glob '!src/interfaces/interfaces.ts'

echo "Checking IBridgeDepositInstructions usage..."
rg "IBridgeDepositInstructions" --type ts -A 2 --glob '!src/interfaces/interfaces.ts'

# Let's also check if these interfaces are used within IBridgeAccount or IBridgeLiquidationAddress
echo "Checking interface definitions in interfaces.ts..."
rg "interface IBridgeAccount|interface IBridgeLiquidationAddress" -A 10 src/interfaces/interfaces.ts

Length of output: 1374


Script:

#!/bin/bash
# Search for the usage of these interfaces within interfaces.ts
echo "Checking usage within interfaces.ts..."
cat src/interfaces/interfaces.ts | grep -A 20 "export interface IBridgeAccount"

# Also check for any imports of these interfaces in other files
echo "Checking for imports..."
rg "import.*{.*IBridgeIban|import.*{.*IBridgeUs|import.*{.*IBridgeDeposit|import.*{.*IBridgeSource" --type ts

Length of output: 1162

src/components/Global/Header/index.tsx (1)

29-29: LGTM! Export cleanup looks good.

The change from named export to default export aligns with the PR's objective of cleaning up exports using knip.

Also applies to: 293-293

src/components/Welcome/welcome.tsx (1)

166-166: Verify component export setup

The removal of the export keyword suggests this component is now exported from an index file. Let's verify this setup to ensure the component remains accessible.

✅ Verification successful

Export setup is correctly configured

The Welcome component is properly exported through the barrel file (index.ts) in the Welcome directory, which re-exports all from ./welcome. The removal of the direct export from the component is consistent with the codebase's structure, as components are centrally exported through their respective index files.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify Welcome component export and usage

# Check if Welcome is exported from an index file
echo "Checking for index file exports:"
rg -l "export.*Welcome" "src/components/Welcome/"

# Check for Welcome component usage
echo "Checking component usage:"
rg "Welcome" --type tsx --type ts

Length of output: 285


Script:

#!/bin/bash
# Let's try a different approach using fd and ast-grep

# Check for index files in Welcome directory
echo "Checking Welcome directory structure:"
fd . "src/components/Welcome"

# Check exports in welcomeSDK.tsx
echo -e "\nChecking welcomeSDK.tsx exports:"
cat "src/components/Welcome/welcomeSDK.tsx"

# Check Welcome component usage with ripgrep (without file type filter)
echo -e "\nChecking Welcome component usage:"
rg "Welcome" --type-not md --type-not json

Length of output: 28531


Script:

#!/bin/bash
# Let's check the index.ts file in Welcome directory to verify exports

echo "Checking Welcome component exports in index.ts:"
cat "src/components/Welcome/index.ts"

Length of output: 197

src/utils/cashout.utils.ts (1)

Line range hint 19-34: Verify internal usage of newly privatized functions

The removal of export keywords from these functions improves encapsulation. Let's verify that these functions are only used within this module.

Also applies to: 35-64, 101-114, 138-141, 485-499

Comment on lines +3 to 5
interface CombinedType extends interfaces.IPeanutChainDetails {
tokens: interfaces.IToken[]
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

💡 Codebase verification

Interface CombinedType is also defined and used in the Claim module

The removal of the export keyword from CombinedType in TokenSelector.consts.ts would be incorrect as there's a duplicate interface definition:

  • src/components/Claim/Claim.interfaces.ts exports the same interface
  • It's actively used in multiple files within the Claim module:
    • src/components/Claim/Link/Initial.view.tsx
    • src/components/Claim/Claim.utils.ts
    • src/components/Claim/Link/Onchain/Confirm.view.tsx

This suggests a potential code duplication issue that should be addressed by consolidating the interface definition into a single location.

🔗 Analysis chain

Verify the removal of export keyword from CombinedType interface

The change aligns with the PR objective of running knip, which identifies and removes unnecessary exports. Let's verify this change doesn't break any dependencies.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if CombinedType is imported/used outside this module
# Expected: No results if the interface is only used internally

# Search for CombinedType imports or usage
rg "import.*CombinedType.*from.*TokenSelector\.consts" 

# Search for any other potential references
rg "CombinedType[^a-zA-Z]" --type ts --glob '!*/TokenSelector.consts.ts'

Length of output: 1017

Comment on lines +298 to 300
function generateSafeUrl({ currentUrl, chainId }: { currentUrl: string; chainId: number }) {
return `https://app.safe.global/share/safe-app?appUrl=${encodeURIComponent(currentUrl)}&chain=${chainId}`
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Add input validation to generateSafeUrl

The function should validate its inputs to prevent potential XSS attacks through URL manipulation.

 function generateSafeUrl({ currentUrl, chainId }: { currentUrl: string; chainId: number }) {
+    if (!currentUrl || typeof chainId !== 'number') {
+        throw new Error('Invalid input parameters')
+    }
+    // Validate URL format
+    try {
+        new URL(currentUrl)
+    } catch {
+        throw new Error('Invalid URL format')
+    }
     return `https://app.safe.global/share/safe-app?appUrl=${encodeURIComponent(currentUrl)}&chain=${chainId}`
 }
📝 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
function generateSafeUrl({ currentUrl, chainId }: { currentUrl: string; chainId: number }) {
return `https://app.safe.global/share/safe-app?appUrl=${encodeURIComponent(currentUrl)}&chain=${chainId}`
}
function generateSafeUrl({ currentUrl, chainId }: { currentUrl: string; chainId: number }) {
if (!currentUrl || typeof chainId !== 'number') {
throw new Error('Invalid input parameters')
}
// Validate URL format
try {
new URL(currentUrl)
} catch {
throw new Error('Invalid URL format')
}
return `https://app.safe.global/share/safe-app?appUrl=${encodeURIComponent(currentUrl)}&chain=${chainId}`
}

Copy link
Copy Markdown
Contributor

@jjramirezn jjramirezn left a comment

Choose a reason for hiding this comment

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

This is my kind of PR, amazing!

Approved, please merge after fixing build

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🧹 Outside diff range and nitpick comments (6)
src/components/Club/index.ts (1)

2-2: Remove misleading comment

The comment "// ... other exports" is misleading since this file now only exports the Landing component. All other exports have been moved to src/components/LandingPage/index.ts.

export { Landing } from './landing'
-// ... other exports
sentry.client.config.ts (1)

10-10: Use strict equality comparison

When comparing strings in TypeScript/JavaScript, it's best practice to use strict equality (!==) instead of loose equality (!=) to avoid type coercion issues.

🧰 Tools
🪛 Biome

[error] 10-10: Unnecessary use of boolean literals in conditional expression.

Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with

(lint/complexity/noUselessTernary)

src/components/Claim/Generic/AlreadyClaimed.view.tsx (2)

15-17: Improve chain name logic with optional chaining and strict equality

The chain name lookup can be simplified and made more robust.

-const chainName =
-    consts.supportedPeanutChains &&
-    consts.supportedPeanutChains.find((chain) => chain.chainId == claimLinkData?.chainId)?.name
+const chainName = consts.supportedPeanutChains?.find(
+    (chain) => chain.chainId === claimLinkData?.chainId
+)?.name
🧰 Tools
🪛 Biome

[error] 16-17: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


59-62: Consider optimizing chain lookup

The chain lookup logic is duplicated from the earlier chainName calculation. Consider storing the found chain object in a variable to avoid repeated lookups.

+const selectedChain = consts.supportedPeanutChains?.find(
+    (chain) => chain.chainId === claimLinkData?.chainId
+)
 const chainName = selectedChain?.name

 // Later in JSX
-src={consts.supportedPeanutChains.find(
-    (detail) => detail.chainId === claimLinkData?.chainId
-)?.icon.url}
+src={selectedChain?.icon.url}
src/components/Request/Pay/Views/GeneralViews/AlreadyPaid.view.tsx (2)

10-12: Simplify chain name lookup with optional chaining

The chain name lookup can be simplified and made safer using optional chaining.

-    const chainName =
-        consts.supportedPeanutChains &&
-        consts.supportedPeanutChains.find((chain) => chain.chainId == requestLinkData?.chainId)?.name
+    const chainName = consts.supportedPeanutChains?.find(
+        (chain) => chain.chainId == requestLinkData?.chainId
+    )?.name
🧰 Tools
🪛 Biome

[error] 11-12: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


53-56: Optimize chain details lookup

The chain lookup is duplicated from the earlier chain name calculation. Consider extracting the chain details to avoid repeated lookups.

+    const chainDetails = consts.supportedPeanutChains?.find(
+        (detail) => detail.chainId === requestLinkData?.chainId
+    )
+    const chainName = chainDetails?.name
+
     // Later in the JSX
-    src={
-        consts.supportedPeanutChains.find(
-            (detail) => detail.chainId === requestLinkData?.chainId
-        )?.icon.url
-    }
+    src={chainDetails?.icon.url}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 863962c and ff3dd2b.

📒 Files selected for processing (30)
  • .github/workflows/prettier.yml (1 hunks)
  • .github/workflows/prettier.yml.disabled (0 hunks)
  • .prettierignore (1 hunks)
  • README.md (1 hunks)
  • global.d.ts (1 hunks)
  • sentry.client.config.ts (1 hunks)
  • sentry.edge.config.ts (1 hunks)
  • src/app/api/peanut/user/get-user-id/route.ts (1 hunks)
  • src/app/page.tsx (1 hunks)
  • src/components/Cashout/Cashout.consts.ts (1 hunks)
  • src/components/Cashout/Components/index.ts (1 hunks)
  • src/components/Claim/Claim.consts.ts (2 hunks)
  • src/components/Claim/Generic/AlreadyClaimed.view.tsx (2 hunks)
  • src/components/Claim/Generic/NotFound.view.tsx (0 hunks)
  • src/components/Claim/Generic/SenderClaim.view.tsx (0 hunks)
  • src/components/Claim/Link/Initial.view.tsx (0 hunks)
  • src/components/Claim/Link/Onchain/Confirm.view.tsx (0 hunks)
  • src/components/Claim/Link/Onchain/Success.view.tsx (0 hunks)
  • src/components/Club/index.ts (1 hunks)
  • src/components/Club/landing.tsx (1 hunks)
  • src/components/LandingPage/index.ts (1 hunks)
  • src/components/Offramp/Offramp.consts.ts (1 hunks)
  • src/components/Offramp/index.ts (1 hunks)
  • src/components/Refund/index.tsx (0 hunks)
  • src/components/Request/Pay/Pay.consts.ts (2 hunks)
  • src/components/Request/Pay/Pay.tsx (2 hunks)
  • src/components/Request/Pay/Views/GeneralViews/AlreadyPaid.view.tsx (2 hunks)
  • src/components/Request/Pay/Views/GeneralViews/Canceled.view.tsx (0 hunks)
  • src/components/Request/Pay/Views/GeneralViews/Error.view.tsx (0 hunks)
  • src/components/utils/utils.ts (0 hunks)
💤 Files with no reviewable changes (10)
  • .github/workflows/prettier.yml.disabled
  • src/components/Claim/Generic/NotFound.view.tsx
  • src/components/Claim/Generic/SenderClaim.view.tsx
  • src/components/Claim/Link/Initial.view.tsx
  • src/components/Claim/Link/Onchain/Confirm.view.tsx
  • src/components/Claim/Link/Onchain/Success.view.tsx
  • src/components/Refund/index.tsx
  • src/components/Request/Pay/Views/GeneralViews/Canceled.view.tsx
  • src/components/Request/Pay/Views/GeneralViews/Error.view.tsx
  • src/components/utils/utils.ts
✅ Files skipped from review due to trivial changes (10)
  • .github/workflows/prettier.yml
  • .prettierignore
  • README.md
  • global.d.ts
  • src/app/api/peanut/user/get-user-id/route.ts
  • src/components/Cashout/Components/index.ts
  • src/components/LandingPage/index.ts
  • src/components/Offramp/Offramp.consts.ts
  • src/components/Offramp/index.ts
  • src/components/Request/Pay/Pay.tsx
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/components/Cashout/Cashout.consts.ts
  • src/components/Club/landing.tsx
  • src/components/Request/Pay/Pay.consts.ts
🧰 Additional context used
📓 Learnings (1)
src/components/Request/Pay/Views/GeneralViews/AlreadyPaid.view.tsx (1)
Learnt from: jjramirezn
PR: peanutprotocol/peanut-ui#412
File: src/components/Request/Pay/Views/GeneralViews/AlreadyPaid.view.tsx:37-37
Timestamp: 2024-11-12T09:39:20.720Z
Learning: The files 'src/components/Claim/Generic/AlreadyClaimed.view.tsx' and 'NotFound.view.tsx' are part of the send flow, so the link text 'Make a payment yourself!' and href '/send' should remain as they are.
🪛 Biome
sentry.client.config.ts

[error] 10-10: Unnecessary use of boolean literals in conditional expression.

Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with

(lint/complexity/noUselessTernary)

sentry.edge.config.ts

[error] 10-10: Unnecessary use of boolean literals in conditional expression.

Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with

(lint/complexity/noUselessTernary)

src/components/Claim/Claim.consts.ts

[error] 22-22: Unexpected empty object pattern.

(lint/correctness/noEmptyPattern)


[error] 23-23: Unexpected empty object pattern.

(lint/correctness/noEmptyPattern)


[error] 23-23: Unexpected empty object pattern.

(lint/correctness/noEmptyPattern)


[error] 24-24: Unexpected empty object pattern.

(lint/correctness/noEmptyPattern)


[error] 24-24: Unexpected empty object pattern.

(lint/correctness/noEmptyPattern)


[error] 22-22: Don't use '{}' as a type.

Prefer explicitly define the object shape. '{}' means "any non-nullable value".

(lint/complexity/noBannedTypes)


[error] 23-23: Don't use '{}' as a type.

Prefer explicitly define the object shape. '{}' means "any non-nullable value".

(lint/complexity/noBannedTypes)


[error] 23-23: Don't use '{}' as a type.

Prefer explicitly define the object shape. '{}' means "any non-nullable value".

(lint/complexity/noBannedTypes)


[error] 24-24: Don't use '{}' as a type.

Prefer explicitly define the object shape. '{}' means "any non-nullable value".

(lint/complexity/noBannedTypes)


[error] 24-24: Don't use '{}' as a type.

Prefer explicitly define the object shape. '{}' means "any non-nullable value".

(lint/complexity/noBannedTypes)

src/components/Claim/Generic/AlreadyClaimed.view.tsx

[error] 16-17: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

src/components/Request/Pay/Views/GeneralViews/AlreadyPaid.view.tsx

[error] 11-12: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

🔇 Additional comments (7)
src/components/Club/index.ts (1)

1-1: LGTM!

The explicit named export of the Landing component follows TypeScript best practices.

sentry.edge.config.ts (1)

10-10: Verify environment configuration

Ensure that NODE_ENV is properly set in all deployment environments to maintain expected Sentry behavior:

  • Development: Sentry disabled
  • Production/Staging: Sentry enabled
🧰 Tools
🪛 Biome

[error] 10-10: Unnecessary use of boolean literals in conditional expression.

Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with

(lint/complexity/noUselessTernary)

src/components/Claim/Generic/AlreadyClaimed.view.tsx (2)

23-24: LGTM! Clear and readable data availability check

The boolean expression is well-formatted and logically sound.


Line range hint 1-93: Well-structured component with good error handling

The component is well-implemented with:

  • Proper TypeScript usage
  • Safe handling of undefined values
  • Clear user feedback
  • Consistent UI components
🧰 Tools
🪛 Biome

[error] 16-17: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)

src/components/Request/Pay/Views/GeneralViews/AlreadyPaid.view.tsx (2)

9-9: LGTM: Named export aligns with static analysis goals

The switch from default export to named export improves code maintainability and static analysis capabilities.


17-18: LGTM: Clear data availability check

The multi-line formatting improves readability while maintaining correct logic.

src/app/page.tsx (1)

7-7: LGTM! Import reorganization looks good.

The components have been logically reorganized under the LandingPage directory, which better reflects their usage context.

Comment on lines +7 to 8
import { Hero, FAQs, Features, Mike, Story, Intro, BuildOnUs, CashoutSection } from '@/components/LandingPage'
import { MarqueeComp } from '@/components/Global/MarqueeWrapper'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Remove unused imports and commented code.

Several imported components (MarqueeComp, Features, Mike, Story, Intro, CashoutSection) are only used in commented-out sections. Since this PR is focused on cleaning up unused exports with knip:

  1. If these sections are temporarily disabled for testing, consider using feature flags instead of comments
  2. If these sections are no longer needed, remove both the imports and the commented code
-import { Hero, FAQs, Features, Mike, Story, Intro, BuildOnUs, CashoutSection } from '@/components/LandingPage'
-import { MarqueeComp } from '@/components/Global/MarqueeWrapper'
+import { Hero, FAQs, BuildOnUs } from '@/components/LandingPage'

// ... later in the file ...
-            {/* <MarqueeComp
-                message="PEANUT PROTOCOL • BUILD WITH US • PEANUT PROTOCOL • BUILD WITH US"
-                imageSrc={assets.SmileStars.src}
-                backgroundColor="bg-n-1"
-            />
-            <div className="bg-blue-1">
-                <CashoutSection />
-            </div> */}
-
-            {/* <Features sections={[features.sections[0]]} marquee={features.marquee} />
-            <Intro />
-
-            <Story marquee={story.marquee} />
-            <Features sections={[features.sections[1]]} marquee={features.marquee} />
-            <Mike lines={mike.lines} /> */}

Also applies to: 144-157

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (6)
knip.json (2)

2-2: Consider pinning the schema version

Using latest in the schema URL could lead to unexpected breaking changes. Consider pinning to a specific version for better stability and predictability.

-    "$schema": "https://unpkg.com/knip@latest/schema.json",
+    "$schema": "https://unpkg.com/knip@3.0.0/schema.json",

4-4: Consider including additional configuration files

The entry points configuration could be expanded to include other common configuration files that might exist in the project, such as:

  • jest.config.js
  • babel.config.js
  • vite.config.js
-    "entry": ["src/**/*.{js,jsx,ts,tsx}", "postcss.config.js", "tailwind.config.js"],
+    "entry": ["src/**/*.{js,jsx,ts,tsx}", "*.config.{js,ts}"],
sentry.server.config.ts (1)

9-10: Remove redundant enabled flag

Since Sentry initialization is already conditionally wrapped in a production environment check, the enabled: true flag is redundant and can be safely removed.

    Sentry.init({
        dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
-        enabled: true,
next.config.js (2)

155-156: LGTM! Good separation of development and production configurations.

The conditional export effectively separates development from production configurations, which is a good practice for reducing overhead during development.

Consider adding a comment to make the development-only configuration more explicit:

 } else {
+    // Export without Sentry in development environment
     module.exports = nextConfig
 }

155-156: Consider extracting sensitive Sentry configuration.

The Sentry configuration contains organization and project identifiers. Consider moving these to environment variables for better security practices.

src/components/Welcome/welcomeSDK.tsx (1)

336-336: Consider adding explicit dimensions

While the new Lottie component usage is correct, you might want to add explicit width and height props or CSS styling to ensure consistent sizing across different viewports.

-                                <Lottie animationData={REDPACKET_LOTTIE} loop={true} autoplay={true} />
+                                <Lottie 
+                                    animationData={REDPACKET_LOTTIE} 
+                                    loop={true} 
+                                    autoplay={true}
+                                    style={{ width: '400px', height: '600px' }}
+                                />
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between ff3dd2b and dd15e16.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (7)
  • knip.json (1 hunks)
  • next.config.js (1 hunks)
  • package.json (1 hunks)
  • sentry.client.config.ts (1 hunks)
  • sentry.edge.config.ts (1 hunks)
  • sentry.server.config.ts (1 hunks)
  • src/components/Welcome/welcomeSDK.tsx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • sentry.client.config.ts
  • sentry.edge.config.ts
🔇 Additional comments (7)
knip.json (1)

4-5: Verify the need for separate entry and project patterns

The patterns in entry and project seem to overlap significantly. Consider if this is intentional or if they could be consolidated to avoid potential confusion.

sentry.server.config.ts (1)

12-13: Review tracesSampleRate for production

The comment suggests adjusting the sampling rate for production, but it's currently set to 1 (100% sampling). Consider reducing this value in production to manage performance and costs.

A typical production value might be between 0.1 (10%) and 0.3 (30%) depending on your traffic volume.

package.json (4)

13-13: LGTM: Knip script addition

The addition of the knip script aligns with the PR objective and follows standard configuration patterns.


20-23: Verify Chakra UI package changes

The addition of granular Chakra UI packages and the core package update suggest a move towards better tree-shaking. Please verify:

  1. That these changes don't introduce breaking changes in your Chakra UI components
  2. That all required Chakra UI sub-packages are included

29-30: Verify security-sensitive package updates

Several security-sensitive packages have been updated:

  • @sentry/nextjs to ^8.39.0
  • next.js to ^14.2.18

Please ensure:

  1. The changelog has been reviewed for breaking changes
  2. The application has been thoroughly tested with these new versions

Also applies to: 46-46


74-80: LGTM: Dev dependencies updates

The addition of knip and updates to dev dependencies look appropriate:

  • knip added as a dev dependency
  • Type definitions and dev tools received minor version updates
src/components/Welcome/welcomeSDK.tsx (1)

34-34: Verify the lottie-react migration impact

The change from 'react-lottie' to 'lottie-react' is good as it's a more modern and maintained library. However, ensure that all Lottie animations across the codebase have been updated to use the new API.

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.

2 participants