Skip to content

misc: lint#229

Merged
antoncoding merged 12 commits intomasterfrom
misc/lint
Dec 9, 2025
Merged

misc: lint#229
antoncoding merged 12 commits intomasterfrom
misc/lint

Conversation

@antoncoding
Copy link
Owner

@antoncoding antoncoding commented Dec 8, 2025

Summary by CodeRabbit

  • New Features

    • In-edit allocator management added (add/remove allocators with per-item loading states).
  • Bug Fixes

    • Safer fallbacks and explicit defaults for unexpected data to improve stability.
    • Risk indicator now has a safe default display for unknown states.
  • Chores

    • Widespread formatting and logging standardization; CI now runs static type checks.
  • Refactor

    • Several UI flows reorganized so connection/approval states render clearer CTAs in deposit/withdraw/borrow screens.

✏️ Tip: You can customize this high-level summary in your review settings.

@vercel
Copy link
Contributor

vercel bot commented Dec 8, 2025

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

Project Deployment Preview Comments Updated (UTC)
monarch Ready Ready Preview Comment Dec 9, 2025 3:47am

@coderabbitai
Copy link

coderabbitai bot commented Dec 8, 2025

📝 Walkthrough

Walkthrough

Wide-ranging stylistic and small-surface edits: numeric literals reformatted with digit separators, template literals simplified to plain strings, some bindings made const/readonly, type import/export reorganized, default switch branches added, storage key exports centralized, and small parameter/identifier renames. No substantive runtime behavior changes.

Changes

Cohort / File(s) Summary
Numeric literal formatting
app/market/[chainId]/[marketid]/RateChart.tsx, app/markets/components/constants.ts, app/positions/report/components/ReportTable.tsx, src/constants/markets.ts, src/constants/vaults/known_vaults.ts, src/data-sources/morpho-api/vaults.ts, src/hooks/*(useAllowance,useBorrowTransaction,useFreshMarketsState,useMultiMarketSupply,usePermit2,useRebalance,useRepayTransaction,useSupplyMarket,useVaultV2Deposit,useUserPositions), src/components/providers/QueryProvider.tsx, src/utils/interest.ts, src/utils/networks.ts
Reformatted numeric literals with digit separators (e.g., 1000010_000, 8640086_400) and minor default value formatting; semantics unchanged.
Storage keys centralization
src/utils/storageKeys.ts, app/markets/components/markets.tsx, src/components/*, src/hooks/*(usePagination,useStaredMarkets,useUserMarketsCache,useStaredMarkets), app/positions/components/PositionsSummaryTable.tsx, src/components/common/MarketsTableWithSameLoanAsset.tsx
Replaced many individual exported storage key constants with a single storageKeys object and updated consumers to use storageKeys.*. Behavior preserved; access pattern changed.
String/log normalization & small renames
app/positions/components/RebalanceProcessModal.tsx, app/rewards/components/RewardTable.tsx, scripts/generate-oracle-cache.ts, scripts/generate-redstone-data.ts, src/components/TokenIcon.tsx, src/services/statsService.ts, src/utils/positions.ts, src/utils/subgraph-urls.ts, src/hooks/*(useMarketBorrows,useMarketData,useMarketHistoricalData/useMarketLiquidations/useMarketSupplies/useUserPosition/useUserBalances/useUserTransactions)
Converted unnecessary template/backtick literals to simple single-quoted strings in logs and UI text; renamed some params/catch variables and a JSDoc param; no behavior change.
Immutability / readonly
src/contexts/MarketsContext.tsx, src/data-sources/subgraph/market.ts, src/hooks/useLiquidations.ts, src/utils/blockFinder.ts, src/utils/external.ts, src/utils/merklApi.ts
Replaced some let with const and class fields with readonly; mutation via push or constructor assignment preserved; constructors initialize readonly fields.
Type import/export reorg
src/components/MarketOracle/GeneralFeedTooltip.tsx, src/constants/oracle/general-feeds/index.ts, src/data-sources/morpho-api/historical.ts, src/utils/oracle.ts
Moved GeneralPriceFeed type import to a /types path and removed a re-export from the feed index; updated imports accordingly.
Default / fallback cases added
app/markets/components/RiskIndicator.tsx, src/data-sources/subgraph/positions.ts, src/utils/statsUtils.ts, src/hooks/useUserPositionsSummaryData.ts
Added explicit default branches and deterministic fallbacks (visual default, warning on unknown position side, default time/period buckets).
JSX / minor logic tweaks
app/market/[chainId]/[marketid]/VolumeChart.tsx, app/market/[chainId]/[marketid]/content.tsx, app/markets/components/markets.tsx, various modal/component files (DepositToVaultModal.tsx, SupplyModalContent.tsx, WithdrawModalContent.tsx, PositionsContent.tsx, AgentsTab.tsx, CurrentCaps.tsx)
Minor control-flow/JSX branch reorganizations (mostly swapping connected/not-connected branches, small refactors, .at(-1) usage, fragment removal). No behavioral changes beyond structural gating.
Hook behavior/flow adjustments (UI step timing)
src/hooks/useSupplyMarket.ts, src/hooks/useVaultV2Deposit.ts, src/hooks/useVaultV2.ts, src/hooks/usePositionReport.ts, src/hooks/usePositionReport.ts
Small ordering/step-state tweaks in approve/execute flows and parameter renames/aliasing; UI step state set earlier when already approved in some flows. No external API surface change except internal parameter renames in useVaultV2.updateNameAndSymbol and usePositionReport param rename.
Formatting / imports / forwarding refs
src/components/common/IconSwitch.tsx, src/components/ui/button.tsx, src/components/ui/pagination.tsx, src/components/layout/header/ListItem.tsx
Switched some React namespace usages to direct imports (hooks, forwardRef), adjusted inner component naming and Link import; ref usage unchanged.
Lint / package changes
biome.jsonc, package.json, AGENTS.md
Removed/relaxed several biome rules, added typecheck script, changed lint scripts and devDependencies; CI/lint script adjustments.
Utilities & minor API surface changes
src/utils/balance.ts, src/utils/gtag.ts, src/utils/merklApi.ts, src/utils/blockFinder.ts, src/utils/positions.ts, src/utils/statsUtils.ts, src/data-sources/subgraph/historical.ts, src/data-sources/morpho-api/historical.ts
Added small utility functions (formatSimple, min), local type alias for window gtag, made baseUrl readonly, adjusted NaN checks, removed a re-export of timeseries types; mostly non-breaking internal changes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Areas to pay attention to:

  • Consumers of the removed re-export: GeneralPriceFeed is no longer re-exported from the feed index; verify updated import paths across the codebase.
  • Centralization to storageKeys: confirm all modules updated to use storageKeys.* and no missing imports remain.
  • Approve/deposit/supply step-state changes in hooks (useSupplyMarket, useVaultV2Deposit) — ensure UI step transitions remain correct in approval vs already-approved flows.
  • package.json/biome.jsonc changes affecting CI lint/typecheck scripts.

Possibly related PRs

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 11.90% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title check ❓ Inconclusive The title 'misc: lint' is too vague and doesn't convey the specific nature of the changes. The PR includes substantial refactoring beyond simple linting fixes, including logic restructures, config removals, and API changes. Consider a more specific title that captures the main intent—for example, 'refactor: cleanup linting rules and standardize formatting' or break into focused PRs by change category.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch misc/lint

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.

Copy link

@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: 1

🧹 Nitpick comments (3)
src/utils/balance.ts (1)

37-38: Inconsistent numeric literal formatting.

Lines 33-36 use underscores (1_000_000_000, 1_000_000) but these lines use 1000 without. Should be 1_000 to stay consistent.

-    } else if (Math.abs(num) >= 1000) {
-      return `${(num / 1000).toFixed(2)}K`;
+    } else if (Math.abs(num) >= 1_000) {
+      return `${(num / 1_000).toFixed(2)}K`;
app/market/[chainId]/[marketid]/VolumeChart.tsx (1)

102-105: Consider storing the last point to avoid double .at(-1)

Current code calls data.at(-1) twice; you could store it once (and assert non‑null after the length check) for a tiny readability win:

const last = data.at(-1)!;
const current = volumeView === 'USD' ? last.y : Number(formatUnits(BigInt(last.y), market.loanAsset.decimals));

Not critical, just a small tidy‑up.

src/utils/gtag.ts (1)

5-7: Local WindowWithGtag typing is cleaner; optional guard for logEvent

The WindowWithGtag alias and local casts are a nice improvement over globally augmenting Window.

You might also mirror the isClient() check from logPageview in logEvent to avoid any accidental server‑side window access; optional but a bit safer.

export const logEvent = ({ action, category, label, value }: { action: string; category: string; label: string; value: number }) => {
  if (!isClient()) return;
  (window as WindowWithGtag).gtag('event', action, {
    event_category: category,
    event_label: label,
    value,
  });
};

Also applies to: 14-17, 21-26

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b0904b6 and b69a66d.

📒 Files selected for processing (48)
  • app/market/[chainId]/[marketid]/RateChart.tsx (1 hunks)
  • app/market/[chainId]/[marketid]/VolumeChart.tsx (2 hunks)
  • app/market/[chainId]/[marketid]/content.tsx (0 hunks)
  • app/markets/components/constants.ts (1 hunks)
  • app/positions/components/RebalanceProcessModal.tsx (1 hunks)
  • app/positions/report/components/ReportTable.tsx (1 hunks)
  • app/rewards/components/RewardTable.tsx (1 hunks)
  • biome.jsonc (2 hunks)
  • scripts/generate-oracle-cache.ts (5 hunks)
  • src/components/MarketOracle/GeneralFeedTooltip.tsx (1 hunks)
  • src/components/TokenIcon.tsx (1 hunks)
  • src/components/providers/QueryProvider.tsx (2 hunks)
  • src/constants/markets.ts (1 hunks)
  • src/constants/oracle/general-feeds/index.ts (0 hunks)
  • src/constants/vaults/known_vaults.ts (4 hunks)
  • src/contexts/MarketsContext.tsx (1 hunks)
  • src/data-sources/morpho-api/historical.ts (1 hunks)
  • src/data-sources/morpho-api/vaults.ts (1 hunks)
  • src/data-sources/subgraph/market.ts (2 hunks)
  • src/hooks/useAllowance.ts (1 hunks)
  • src/hooks/useBorrowTransaction.ts (1 hunks)
  • src/hooks/useFreshMarketsState.ts (2 hunks)
  • src/hooks/useLiquidations.ts (3 hunks)
  • src/hooks/useMarketBorrows.ts (2 hunks)
  • src/hooks/useMarketData.ts (2 hunks)
  • src/hooks/useMarketHistoricalData.ts (2 hunks)
  • src/hooks/useMarketLiquidations.ts (2 hunks)
  • src/hooks/useMarketSupplies.ts (2 hunks)
  • src/hooks/useMultiMarketSupply.ts (1 hunks)
  • src/hooks/usePermit2.ts (1 hunks)
  • src/hooks/useRebalance.ts (1 hunks)
  • src/hooks/useRepayTransaction.ts (1 hunks)
  • src/hooks/useSupplyMarket.ts (1 hunks)
  • src/hooks/useUserPosition.ts (4 hunks)
  • src/hooks/useUserPositions.ts (1 hunks)
  • src/hooks/useUserPositionsSummaryData.ts (3 hunks)
  • src/hooks/useVaultV2Deposit.ts (1 hunks)
  • src/services/statsService.ts (2 hunks)
  • src/utils/balance.ts (1 hunks)
  • src/utils/blockFinder.ts (1 hunks)
  • src/utils/external.ts (1 hunks)
  • src/utils/gtag.ts (1 hunks)
  • src/utils/interest.ts (1 hunks)
  • src/utils/merklApi.ts (1 hunks)
  • src/utils/networks.ts (2 hunks)
  • src/utils/oracle.ts (1 hunks)
  • src/utils/positions.ts (2 hunks)
  • src/utils/subgraph-urls.ts (1 hunks)
💤 Files with no reviewable changes (2)
  • src/constants/oracle/general-feeds/index.ts
  • app/market/[chainId]/[marketid]/content.tsx
🧰 Additional context used
📓 Path-based instructions (9)
**/*.{ts,tsx,js,jsx,css,scss}

📄 CodeRabbit inference engine (AGENTS.md)

Run pnpm format (Prettier) before pushing with 2-space indentation, 100-character width, single quotes, and Tailwind-aware class ordering

Files:

  • src/hooks/useMultiMarketSupply.ts
  • src/services/statsService.ts
  • src/hooks/useRepayTransaction.ts
  • src/hooks/useMarketLiquidations.ts
  • src/utils/external.ts
  • src/utils/blockFinder.ts
  • src/hooks/useVaultV2Deposit.ts
  • src/hooks/useUserPositions.ts
  • src/hooks/useBorrowTransaction.ts
  • src/utils/subgraph-urls.ts
  • src/hooks/useMarketHistoricalData.ts
  • app/markets/components/constants.ts
  • src/hooks/useMarketSupplies.ts
  • app/positions/components/RebalanceProcessModal.tsx
  • src/components/providers/QueryProvider.tsx
  • src/constants/vaults/known_vaults.ts
  • src/utils/positions.ts
  • src/contexts/MarketsContext.tsx
  • src/hooks/useFreshMarketsState.ts
  • src/utils/gtag.ts
  • app/market/[chainId]/[marketid]/RateChart.tsx
  • src/hooks/useUserPositionsSummaryData.ts
  • src/hooks/useAllowance.ts
  • src/constants/markets.ts
  • app/rewards/components/RewardTable.tsx
  • src/utils/oracle.ts
  • src/hooks/useRebalance.ts
  • app/positions/report/components/ReportTable.tsx
  • src/hooks/useSupplyMarket.ts
  • src/hooks/useMarketBorrows.ts
  • src/data-sources/morpho-api/vaults.ts
  • src/hooks/usePermit2.ts
  • scripts/generate-oracle-cache.ts
  • src/utils/interest.ts
  • src/hooks/useLiquidations.ts
  • src/hooks/useUserPosition.ts
  • src/components/TokenIcon.tsx
  • src/hooks/useMarketData.ts
  • src/components/MarketOracle/GeneralFeedTooltip.tsx
  • app/market/[chainId]/[marketid]/VolumeChart.tsx
  • src/data-sources/subgraph/market.ts
  • src/utils/balance.ts
  • src/utils/networks.ts
  • src/utils/merklApi.ts
  • src/data-sources/morpho-api/historical.ts
src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use camelCase for helper function names (e.g., formatApr)

Files:

  • src/hooks/useMultiMarketSupply.ts
  • src/services/statsService.ts
  • src/hooks/useRepayTransaction.ts
  • src/hooks/useMarketLiquidations.ts
  • src/utils/external.ts
  • src/utils/blockFinder.ts
  • src/hooks/useVaultV2Deposit.ts
  • src/hooks/useUserPositions.ts
  • src/hooks/useBorrowTransaction.ts
  • src/utils/subgraph-urls.ts
  • src/hooks/useMarketHistoricalData.ts
  • src/hooks/useMarketSupplies.ts
  • src/components/providers/QueryProvider.tsx
  • src/constants/vaults/known_vaults.ts
  • src/utils/positions.ts
  • src/contexts/MarketsContext.tsx
  • src/hooks/useFreshMarketsState.ts
  • src/utils/gtag.ts
  • src/hooks/useUserPositionsSummaryData.ts
  • src/hooks/useAllowance.ts
  • src/constants/markets.ts
  • src/utils/oracle.ts
  • src/hooks/useRebalance.ts
  • src/hooks/useSupplyMarket.ts
  • src/hooks/useMarketBorrows.ts
  • src/data-sources/morpho-api/vaults.ts
  • src/hooks/usePermit2.ts
  • src/utils/interest.ts
  • src/hooks/useLiquidations.ts
  • src/hooks/useUserPosition.ts
  • src/components/TokenIcon.tsx
  • src/hooks/useMarketData.ts
  • src/components/MarketOracle/GeneralFeedTooltip.tsx
  • src/data-sources/subgraph/market.ts
  • src/utils/balance.ts
  • src/utils/networks.ts
  • src/utils/merklApi.ts
  • src/data-sources/morpho-api/historical.ts
src/hooks/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

When building on-chain hooks, mirror useERC20Approval and useTransactionWithToast patterns and memoize arrays/objects before using them in effect dependencies to prevent redundant RPC calls

Files:

  • src/hooks/useMultiMarketSupply.ts
  • src/hooks/useRepayTransaction.ts
  • src/hooks/useMarketLiquidations.ts
  • src/hooks/useVaultV2Deposit.ts
  • src/hooks/useUserPositions.ts
  • src/hooks/useBorrowTransaction.ts
  • src/hooks/useMarketHistoricalData.ts
  • src/hooks/useMarketSupplies.ts
  • src/hooks/useFreshMarketsState.ts
  • src/hooks/useUserPositionsSummaryData.ts
  • src/hooks/useAllowance.ts
  • src/hooks/useRebalance.ts
  • src/hooks/useSupplyMarket.ts
  • src/hooks/useMarketBorrows.ts
  • src/hooks/usePermit2.ts
  • src/hooks/useLiquidations.ts
  • src/hooks/useUserPosition.ts
  • src/hooks/useMarketData.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

ESLint (Airbnb + Next.js) enforces hook safety and import hygiene

Files:

  • src/hooks/useMultiMarketSupply.ts
  • src/services/statsService.ts
  • src/hooks/useRepayTransaction.ts
  • src/hooks/useMarketLiquidations.ts
  • src/utils/external.ts
  • src/utils/blockFinder.ts
  • src/hooks/useVaultV2Deposit.ts
  • src/hooks/useUserPositions.ts
  • src/hooks/useBorrowTransaction.ts
  • src/utils/subgraph-urls.ts
  • src/hooks/useMarketHistoricalData.ts
  • app/markets/components/constants.ts
  • src/hooks/useMarketSupplies.ts
  • app/positions/components/RebalanceProcessModal.tsx
  • src/components/providers/QueryProvider.tsx
  • src/constants/vaults/known_vaults.ts
  • src/utils/positions.ts
  • src/contexts/MarketsContext.tsx
  • src/hooks/useFreshMarketsState.ts
  • src/utils/gtag.ts
  • app/market/[chainId]/[marketid]/RateChart.tsx
  • src/hooks/useUserPositionsSummaryData.ts
  • src/hooks/useAllowance.ts
  • src/constants/markets.ts
  • app/rewards/components/RewardTable.tsx
  • src/utils/oracle.ts
  • src/hooks/useRebalance.ts
  • app/positions/report/components/ReportTable.tsx
  • src/hooks/useSupplyMarket.ts
  • src/hooks/useMarketBorrows.ts
  • src/data-sources/morpho-api/vaults.ts
  • src/hooks/usePermit2.ts
  • scripts/generate-oracle-cache.ts
  • src/utils/interest.ts
  • src/hooks/useLiquidations.ts
  • src/hooks/useUserPosition.ts
  • src/components/TokenIcon.tsx
  • src/hooks/useMarketData.ts
  • src/components/MarketOracle/GeneralFeedTooltip.tsx
  • app/market/[chainId]/[marketid]/VolumeChart.tsx
  • src/data-sources/subgraph/market.ts
  • src/utils/balance.ts
  • src/utils/networks.ts
  • src/utils/merklApi.ts
  • src/data-sources/morpho-api/historical.ts
app/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Next.js routes must live under app/ directory

Files:

  • app/markets/components/constants.ts
  • app/positions/components/RebalanceProcessModal.tsx
  • app/market/[chainId]/[marketid]/RateChart.tsx
  • app/rewards/components/RewardTable.tsx
  • app/positions/report/components/ReportTable.tsx
  • app/market/[chainId]/[marketid]/VolumeChart.tsx
**/*.tsx

📄 CodeRabbit inference engine (AGENTS.md)

Use PascalCase for React component file names (e.g., VaultBanner.tsx)

Files:

  • app/positions/components/RebalanceProcessModal.tsx
  • src/components/providers/QueryProvider.tsx
  • src/contexts/MarketsContext.tsx
  • app/market/[chainId]/[marketid]/RateChart.tsx
  • app/rewards/components/RewardTable.tsx
  • app/positions/report/components/ReportTable.tsx
  • src/components/TokenIcon.tsx
  • src/components/MarketOracle/GeneralFeedTooltip.tsx
  • app/market/[chainId]/[marketid]/VolumeChart.tsx
**/*.{tsx,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{tsx,jsx}: Keep Tailwind class lists lean and dedupe variants with tailwind-merge
All toggles must use the shared IconSwitch component from @/components/common/IconSwitch for consistent sizing and animation

Files:

  • app/positions/components/RebalanceProcessModal.tsx
  • src/components/providers/QueryProvider.tsx
  • src/contexts/MarketsContext.tsx
  • app/market/[chainId]/[marketid]/RateChart.tsx
  • app/rewards/components/RewardTable.tsx
  • app/positions/report/components/ReportTable.tsx
  • src/components/TokenIcon.tsx
  • src/components/MarketOracle/GeneralFeedTooltip.tsx
  • app/market/[chainId]/[marketid]/VolumeChart.tsx
src/constants/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use SCREAMING_SNAKE_CASE for shared constants

Files:

  • src/constants/vaults/known_vaults.ts
  • src/constants/markets.ts
scripts/**/*

📄 CodeRabbit inference engine (AGENTS.md)

Smart-contract scripts and artifacts belong in scripts/

Files:

  • scripts/generate-oracle-cache.ts
🧠 Learnings (12)
📓 Common learnings
Learnt from: CR
Repo: antoncoding/monarch PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T14:45:50.416Z
Learning: Applies to **/*.{ts,tsx,js,jsx,css,scss} : Run `pnpm format` (Prettier) before pushing with 2-space indentation, 100-character width, single quotes, and Tailwind-aware class ordering
Learnt from: CR
Repo: antoncoding/monarch PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T14:45:50.416Z
Learning: Applies to src/**/*.{ts,tsx} : Use camelCase for helper function names (e.g., `formatApr`)
📚 Learning: 2024-10-07T14:38:04.384Z
Learnt from: antoncoding
Repo: antoncoding/monarch PR: 57
File: src/hooks/useRebalance.ts:112-114
Timestamp: 2024-10-07T14:38:04.384Z
Learning: In `src/hooks/useRebalance.ts`, adding a delay is necessary because Rabby wallet cannot handle sequential requests.

Applied to files:

  • src/hooks/useRepayTransaction.ts
  • src/hooks/useBorrowTransaction.ts
  • src/hooks/useRebalance.ts
📚 Learning: 2025-11-25T14:45:50.416Z
Learnt from: CR
Repo: antoncoding/monarch PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T14:45:50.416Z
Learning: Applies to src/hooks/**/*.{ts,tsx} : When building on-chain hooks, mirror `useERC20Approval` and `useTransactionWithToast` patterns and memoize arrays/objects before using them in effect dependencies to prevent redundant RPC calls

Applied to files:

  • src/hooks/useRepayTransaction.ts
  • src/hooks/useBorrowTransaction.ts
  • src/hooks/useAllowance.ts
  • src/hooks/useRebalance.ts
  • src/hooks/useLiquidations.ts
📚 Learning: 2024-10-23T16:17:02.841Z
Learnt from: antoncoding
Repo: antoncoding/monarch PR: 77
File: src/graphql/queries.ts:168-193
Timestamp: 2024-10-23T16:17:02.841Z
Learning: In `src/graphql/queries.ts`, handling only `MarketTransferTransactionData` is intentional at this time.

Applied to files:

  • src/hooks/useMarketLiquidations.ts
  • src/hooks/useMarketHistoricalData.ts
  • src/contexts/MarketsContext.tsx
  • src/hooks/useMarketBorrows.ts
  • src/hooks/useMarketData.ts
  • src/data-sources/subgraph/market.ts
  • src/data-sources/morpho-api/historical.ts
📚 Learning: 2025-11-25T14:45:50.416Z
Learnt from: CR
Repo: antoncoding/monarch PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T14:45:50.416Z
Learning: Applies to src/constants/**/*.{ts,tsx,js,jsx} : Use SCREAMING_SNAKE_CASE for shared constants

Applied to files:

  • app/markets/components/constants.ts
📚 Learning: 2024-12-16T02:01:51.219Z
Learnt from: antoncoding
Repo: antoncoding/monarch PR: 97
File: app/positions/components/onboarding/OnboardingContext.tsx:36-43
Timestamp: 2024-12-16T02:01:51.219Z
Learning: In `app/positions/components/onboarding/OnboardingContext.tsx`, the `defaultStep` variable is no longer needed and can be removed.

Applied to files:

  • app/positions/components/RebalanceProcessModal.tsx
📚 Learning: 2024-10-12T09:23:16.495Z
Learnt from: antoncoding
Repo: antoncoding/monarch PR: 63
File: app/markets/components/MarketRowDetail.tsx:49-52
Timestamp: 2024-10-12T09:23:16.495Z
Learning: When rendering oracle feeds in `ExpandedMarketDetail` (`app/markets/components/MarketRowDetail.tsx`), prefer explicit rendering over iterating keys when dealing with a small number of feeds.

Applied to files:

  • src/contexts/MarketsContext.tsx
  • src/utils/oracle.ts
  • src/hooks/useMarketData.ts
  • src/components/MarketOracle/GeneralFeedTooltip.tsx
📚 Learning: 2024-11-20T07:21:06.756Z
Learnt from: antoncoding
Repo: antoncoding/monarch PR: 83
File: app/settings/page.tsx:8-16
Timestamp: 2024-11-20T07:21:06.756Z
Learning: In `app/settings/page.tsx`, the default value for `usePermit2` is intentionally set to `true`.

Applied to files:

  • src/hooks/useSupplyMarket.ts
  • src/hooks/usePermit2.ts
📚 Learning: 2025-11-25T14:45:50.416Z
Learnt from: CR
Repo: antoncoding/monarch PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T14:45:50.416Z
Learning: Applies to **/*.{ts,tsx,js,jsx,css,scss} : Run `pnpm format` (Prettier) before pushing with 2-space indentation, 100-character width, single quotes, and Tailwind-aware class ordering

Applied to files:

  • biome.jsonc
📚 Learning: 2025-11-13T20:32:48.908Z
Learnt from: antoncoding
Repo: antoncoding/monarch PR: 183
File: app/positions/components/RebalanceModal.tsx:301-308
Timestamp: 2025-11-13T20:32:48.908Z
Learning: The TokenIcon component in the codebase accepts a `symbol` prop as part of its valid interface, in addition to `address`, `chainId`, `width`, `height`, and other props.

Applied to files:

  • src/components/TokenIcon.tsx
📚 Learning: 2025-11-25T14:45:50.416Z
Learnt from: CR
Repo: antoncoding/monarch PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T14:45:50.416Z
Learning: Applies to **/*.{tsx,jsx} : All toggles must use the shared `IconSwitch` component from `@/components/common/IconSwitch` for consistent sizing and animation

Applied to files:

  • src/components/TokenIcon.tsx
📚 Learning: 2025-11-25T14:45:50.416Z
Learnt from: CR
Repo: antoncoding/monarch PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T14:45:50.416Z
Learning: Review `docs/Styling.md` before touching UI to stay aligned with Monarch design tokens and component patterns

Applied to files:

  • src/components/TokenIcon.tsx
🧬 Code graph analysis (3)
src/utils/external.ts (1)
src/utils/networks.ts (1)
  • getNetworkName (200-203)
src/contexts/MarketsContext.tsx (1)
src/utils/types.ts (1)
  • Market (293-345)
src/data-sources/subgraph/market.ts (1)
src/utils/types.ts (1)
  • MarketWarning (83-87)
🔇 Additional comments (54)
src/components/TokenIcon.tsx (1)

55-57: tokenSource string change is safe

Only the string literal syntax changed; text and behavior stay the same. Looks good.

app/markets/components/constants.ts (1)

18-32: Numeric separators look good

Underscores keep the gas values the same and make them easier to read; fits the lint/format goal.

src/utils/external.ts (1)

4-4: Const binding is appropriate here

network is not reassigned, so switching to const is a clean, no-op lint improvement. Looks good.

biome.jsonc (3)

7-7: Verify lineWidth alignment with team's Prettier config.

The Biome lineWidth is set to 140, but learnings indicate Prettier uses 100-character width for formatting. Confirm this intentional difference doesn't conflict with your formatting pipeline.


93-93: Reasonable rule disable.

Turning off useDefaultSwitchClause aligns with your documented team preference to keep switch statements flexible during migration.


115-115: Reasonable rule disable.

Disabling useIndexOf in the complexity rules fits the gentle migration strategy noted in your comments.

src/services/statsService.ts (1)

92-92: Inconsistency between AI summary and actual code.

The AI summary states the log messages "consistently emit 'Sample transaction' (without the trailing colon)," but both modified lines (92 and 155) retain colons: 'Sample transaction:' and 'Sample transaction structure:'. These messages are also semantically different, not consistent. Please verify the actual intent of these changes.

Also applies to: 155-155

src/constants/vaults/known_vaults.ts (1)

87-87: LGTM — numeric separator formatting improves readability.

All chainId literals are updated consistently with underscores, which is a standard practice in modern TypeScript for large numeric values. No functional impact.

Also applies to: 122-122, 227-227, 290-290, 297-297

src/utils/networks.ts (1)

13-13: LGTM — numeric separator formatting is safe.

Both enum and constant numeric values are updated with underscores for readability. No logic changes, and the file is widely imported without risk of functional regression.

Also applies to: 34-34

app/positions/report/components/ReportTable.tsx (2)

57-57: Numeric literal formatting looks good.

The change from 86400 to 86_400 improves readability for the seconds-per-day constant. This aligns with the PR's lint objectives and maintains semantic equivalence.


147-147: Verify Prettier formatting was applied.

There are trailing spaces in className values (lines 147, 165, 181: "mt-1 text-lg ") that suggest Prettier may not have been run on this file. Per the coding guidelines, ensure pnpm format is executed with the configured settings (2-space indentation, 100-character width, single quotes).

Confirm that Prettier formatting has been applied to this file by running pnpm format before finalizing the PR.

Also applies to: 165-165, 181-181

src/contexts/MarketsContext.tsx (1)

166-167: Solid const-by-default refactoring.

Converting let to const here is correct—both arrays are only mutated (via .push()) and never reassigned, so this prevents accidental reassignment bugs while keeping the mutation semantics intact.

src/hooks/useLiquidations.ts (2)

24-24: Good immutability improvement.

Changing to const prevents accidental reassignment while still allowing the intended mutation via push.


39-39: LGTM! Consistent string formatting.

Replacing template literals with single-quoted strings where no interpolation occurs aligns with Prettier configuration.

Also applies to: 55-55

src/utils/merklApi.ts (1)

6-6: Good immutability enforcement.

Making baseUrl readonly is appropriate since it's assigned once in the constructor and never modified.

src/utils/blockFinder.ts (1)

10-14: Good immutability enforcement.

All three fields are assigned once in the constructor and never modified, so marking them readonly is appropriate.

src/hooks/useUserPositionsSummaryData.ts (1)

29-29: LGTM—purely cosmetic improvements to numeric readability.

The underscore formatting on direct numeric literals improves clarity without affecting behavior. The pattern of leaving arithmetic expressions like 5 * 60 * 1000 intact is sensible, since those are self-documenting. All values are correct, and the formatting aligns with Prettier standards.

Also applies to: 129-129, 151-151

scripts/generate-oracle-cache.ts (1)

47-51: Logging template → string literal changes look good

Across these ranges the only change is from backtick template literals to plain string literals while keeping the same arguments and formatting, so runtime behavior and error diagnostics stay the same. Fits the linting goal without side effects.

Also applies to: 60-63, 87-95, 137-143, 153-161

app/positions/components/RebalanceProcessModal.tsx (1)

24-30: Permit2 detail text change is behavior‑neutral

Template literal was replaced by an equivalent plain string; no runtime or UI change.

src/utils/positions.ts (2)

176-184: Error log in fetchPositionsSnapshots unchanged in effect

Only the string literal syntax changed; the logged message and context object remain the same.


255-262: Error log in fetchMarketSnapshot unchanged in effect

Same message text and metadata are logged; just a template → plain string swap.

src/hooks/useSupplyMarket.ts (1)

82-82: LGTM!

Numeric separator improves readability.

src/hooks/useVaultV2Deposit.ts (1)

86-86: LGTM!

Consistent with other hooks.

src/constants/markets.ts (1)

1-2: LGTM!

Numeric separator applied to constant. Naming follows SCREAMING_SNAKE_CASE as expected.

src/hooks/useMarketData.ts (2)

51-51: LGTM!

Plain string is appropriate since no interpolation is needed.


61-61: LGTM!

Same rationale - no interpolation needed.

src/components/providers/QueryProvider.tsx (2)

16-16: LGTM!

Clearer that this is 30,000ms.


27-27: LGTM!

Consistent formatting for the retry delay cap.

src/hooks/useMultiMarketSupply.ts (1)

48-48: LGTM!

Consistent with other Permit2 usages across hooks.

src/utils/interest.ts (1)

12-12: LGTM. Underscore separator improves readability for the seconds-in-a-day constant.

app/market/[chainId]/[marketid]/RateChart.tsx (1)

93-93: LGTM. Consistent formatting with 86_400 used elsewhere in the codebase.

src/hooks/useMarketHistoricalData.ts (2)

35-35: LGTM. Plain string is appropriate here since there's no interpolation.


46-46: LGTM. Same pattern as above.

src/data-sources/morpho-api/vaults.ts (1)

5-5: LGTM. Underscore on 42_161 (Arbitrum) improves readability.

src/hooks/useRepayTransaction.ts (1)

53-53: LGTM. Underscore formatting for 10-second interval.

src/hooks/useUserPositions.ts (1)

231-231: LGTM. Underscore formatting for 30-second stale time.

src/utils/subgraph-urls.ts (1)

30-30: LGTM!

Plain string is correct here—no interpolation needed.

src/hooks/useMarketSupplies.ts (1)

48-48: LGTM!

Plain strings for static log messages are fine. Error objects still passed correctly.

Also applies to: 58-58

src/hooks/useFreshMarketsState.ts (1)

9-9: LGTM!

Underscores improve readability for millisecond values.

Also applies to: 117-117

src/hooks/usePermit2.ts (1)

28-28: LGTM!

Formatting change only.

src/hooks/useBorrowTransaction.ts (1)

60-60: LGTM!

Consistent with the formatting in usePermit2.ts.

src/hooks/useRebalance.ts (1)

55-55: LGTM!

Underscore formatting improves readability.

src/hooks/useMarketLiquidations.ts (2)

33-33: LGTM!

Plain string is appropriate here since there's no interpolation.


44-44: LGTM!

Consistent with the other error log format change above.

src/hooks/useMarketBorrows.ts (2)

48-48: LGTM!

Plain string without interpolation.


58-58: LGTM!

Consistent formatting.

app/rewards/components/RewardTable.tsx (1)

47-48: LGTM!

Plain strings are fine here - no interpolation needed.

src/hooks/useUserPosition.ts (1)

90-90: Console error message tweaks look good

Backtick → single‑quoted strings keep the same message content and behavior; matches the repo’s string style.

Also applies to: 101-101, 134-134, 145-145

src/hooks/useAllowance.ts (1)

24-24: Numeric separator change is fine

Using 10_000 for refetchInterval improves readability with no runtime change.

app/market/[chainId]/[marketid]/VolumeChart.tsx (1)

330-340: Historical averages map simplification looks good

Dropping the fragment and mapping directly to <div>s keeps the JSX flatter without changing output.

src/data-sources/morpho-api/historical.ts (1)

3-5: Type import/re‑export cleanup looks good

Pulling TimeseriesOptions / TimeseriesDataPoint from @/utils/types and re‑exporting them here keeps types centralized without changing behavior.

src/utils/oracle.ts (1)

4-5: General feed imports aligned with new types module

Separating the runtime imports from the GeneralPriceFeed type import keeps the oracle utils in sync with the new general-feeds/types layout. No behavior change.

src/components/MarketOracle/GeneralFeedTooltip.tsx (1)

4-4: Updated GeneralPriceFeed import path is consistent

Importing GeneralPriceFeed from the dedicated general-feeds/types module matches the new oracle typings setup; component behavior is unchanged.

src/data-sources/subgraph/market.ts (1)

135-135: Const for warnings is correct

warnings is only mutated via .push and never reassigned, so const is valid and keeps intent clear. No behavior change.

Copy link

@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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/utils/gtag.ts (1)

19-26: Add isClient() and gtag existence checks.

This function is missing both the server-side check and the gtag existence check that logPageview has. This could cause errors on SSR or if the analytics script doesn't load.

Apply this diff:

 export const logEvent = ({ action, category, label, value }: { action: string; category: string; label: string; value: number }) => {
+  if (!isClient()) {
+    return;
+  }
+  const gtag = (window as WindowWithGtag).gtag;
+  if (!gtag) {
+    return;
+  }
   // eslint-disable-next-line @typescript-eslint/no-unsafe-call
-  (window as WindowWithGtag).gtag('event', action, {
+  gtag('event', action, {
     event_category: category,
     event_label: label,
     value: value,
   });
 };
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 398f9ea and 9e13c08.

📒 Files selected for processing (3)
  • package.json (1 hunks)
  • src/data-sources/morpho-api/historical.ts (1 hunks)
  • src/utils/gtag.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{ts,tsx,js,jsx,css,scss}

📄 CodeRabbit inference engine (AGENTS.md)

Run pnpm format (Prettier) before pushing with 2-space indentation, 100-character width, single quotes, and Tailwind-aware class ordering

Files:

  • src/utils/gtag.ts
  • src/data-sources/morpho-api/historical.ts
src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use camelCase for helper function names (e.g., formatApr)

Files:

  • src/utils/gtag.ts
  • src/data-sources/morpho-api/historical.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

ESLint (Airbnb + Next.js) enforces hook safety and import hygiene

Files:

  • src/utils/gtag.ts
  • src/data-sources/morpho-api/historical.ts
🧠 Learnings (2)
📚 Learning: 2025-11-25T14:45:50.416Z
Learnt from: CR
Repo: antoncoding/monarch PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T14:45:50.416Z
Learning: Applies to **/*.{ts,tsx,js,jsx,css,scss} : Run `pnpm format` (Prettier) before pushing with 2-space indentation, 100-character width, single quotes, and Tailwind-aware class ordering

Applied to files:

  • package.json
📚 Learning: 2024-10-23T16:17:02.841Z
Learnt from: antoncoding
Repo: antoncoding/monarch PR: 77
File: src/graphql/queries.ts:168-193
Timestamp: 2024-10-23T16:17:02.841Z
Learning: In `src/graphql/queries.ts`, handling only `MarketTransferTransactionData` is intentional at this time.

Applied to files:

  • src/data-sources/morpho-api/historical.ts
🔇 Additional comments (3)
src/data-sources/morpho-api/historical.ts (1)

3-3: Consolidated type import is correct

Importing TimeseriesOptions and TimeseriesDataPoint alongside the other market types from @/utils/types matches their usage below and keeps types centralized. No issues from this change.

package.json (1)

14-14: Good addition of typecheck to build workflow.

Adding type checking to the lint:check and the new standalone typecheck script improves type safety in your CI/CD pipeline. The tsc --noEmit configuration is correct.

Also applies to: 21-21

src/utils/gtag.ts (1)

5-7: Cleaner than global augmentation.

The local type alias approach is more modular and avoids polluting the global namespace.

Copy link

@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

🧹 Nitpick comments (2)
biome.jsonc (1)

182-182: Commenting out noShadow works, but clarify intent.

Commenting rather than removing signals "we may revisit this"—good for migration. Add a brief comment if the reasoning differs from other disabled rules (or is it just phase 2 work?).

Example:

-        // "noShadow": "off",
+        // "noShadow": "off",  // TODO: Phase 2 migration
src/components/Input/Input.tsx (1)

61-64: Good rename, but update the console label.

The catch parameter rename to err is clearer. However, the console.log label still says 'e' but logs err. Update it to match.

-        console.log('e', err);
+        console.log('err', err);
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9e13c08 and b160ec4.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (7)
  • biome.jsonc (2 hunks)
  • package.json (1 hunks)
  • scripts/generate-redstone-data.ts (2 hunks)
  • src/components/Input/Input.tsx (1 hunks)
  • src/components/layout/header/ListItem.tsx (1 hunks)
  • src/hooks/useUserBalances.ts (1 hunks)
  • src/hooks/useVaultV2.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (7)
**/*.{ts,tsx,js,jsx,css,scss}

📄 CodeRabbit inference engine (AGENTS.md)

Run pnpm format (Prettier) before pushing with 2-space indentation, 100-character width, single quotes, and Tailwind-aware class ordering

Files:

  • src/hooks/useVaultV2.ts
  • src/hooks/useUserBalances.ts
  • src/components/layout/header/ListItem.tsx
  • src/components/Input/Input.tsx
  • scripts/generate-redstone-data.ts
src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use camelCase for helper function names (e.g., formatApr)

Files:

  • src/hooks/useVaultV2.ts
  • src/hooks/useUserBalances.ts
  • src/components/layout/header/ListItem.tsx
  • src/components/Input/Input.tsx
src/hooks/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

When building on-chain hooks, mirror useERC20Approval and useTransactionWithToast patterns and memoize arrays/objects before using them in effect dependencies to prevent redundant RPC calls

Files:

  • src/hooks/useVaultV2.ts
  • src/hooks/useUserBalances.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

ESLint (Airbnb + Next.js) enforces hook safety and import hygiene

Files:

  • src/hooks/useVaultV2.ts
  • src/hooks/useUserBalances.ts
  • src/components/layout/header/ListItem.tsx
  • src/components/Input/Input.tsx
  • scripts/generate-redstone-data.ts
**/*.tsx

📄 CodeRabbit inference engine (AGENTS.md)

Use PascalCase for React component file names (e.g., VaultBanner.tsx)

Files:

  • src/components/layout/header/ListItem.tsx
  • src/components/Input/Input.tsx
**/*.{tsx,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{tsx,jsx}: Keep Tailwind class lists lean and dedupe variants with tailwind-merge
All toggles must use the shared IconSwitch component from @/components/common/IconSwitch for consistent sizing and animation

Files:

  • src/components/layout/header/ListItem.tsx
  • src/components/Input/Input.tsx
scripts/**/*

📄 CodeRabbit inference engine (AGENTS.md)

Smart-contract scripts and artifacts belong in scripts/

Files:

  • scripts/generate-redstone-data.ts
🧠 Learnings (4)
📚 Learning: 2025-11-25T14:45:50.416Z
Learnt from: CR
Repo: antoncoding/monarch PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T14:45:50.416Z
Learning: Applies to **/*.tsx : Use PascalCase for React component file names (e.g., `VaultBanner.tsx`)

Applied to files:

  • src/hooks/useVaultV2.ts
📚 Learning: 2025-11-25T14:45:50.416Z
Learnt from: CR
Repo: antoncoding/monarch PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T14:45:50.416Z
Learning: Applies to **/*.{ts,tsx,js,jsx,css,scss} : Run `pnpm format` (Prettier) before pushing with 2-space indentation, 100-character width, single quotes, and Tailwind-aware class ordering

Applied to files:

  • package.json
  • biome.jsonc
📚 Learning: 2025-11-25T14:45:50.416Z
Learnt from: CR
Repo: antoncoding/monarch PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T14:45:50.416Z
Learning: Applies to **/*.{tsx,jsx} : Keep Tailwind class lists lean and dedupe variants with `tailwind-merge`

Applied to files:

  • package.json
📚 Learning: 2025-11-25T14:45:50.416Z
Learnt from: CR
Repo: antoncoding/monarch PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T14:45:50.416Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : ESLint (Airbnb + Next.js) enforces hook safety and import hygiene

Applied to files:

  • package.json
  • biome.jsonc
🔇 Additional comments (8)
src/components/layout/header/ListItem.tsx (1)

5-34: Inner function rename looks good

Renaming the inner function to ListItemComponent keeps the export name intact and makes stack traces clearer, with no behavior change. All good here.

scripts/generate-redstone-data.ts (1)

101-133: Param rename keeps behavior and improves clarity

Updating the JSDoc, parameter name, and conditional to isFundamentalFeed matches the existing isFundamental helper usage and makes the boolean’s meaning clearer without changing behavior.

biome.jsonc (2)

102-102: Configuration looks appropriate for migration phase.

Keeping useIndexOf disabled with a note about the single error is reasonable—defer, don't block. Same approach for other single-error rules.


1-257: Configuration aligns with team preferences and migration strategy.

The overall setup is thoughtfully structured: strict correctness rules enabled, opinionated style/complexity rules disabled during migration, and detailed comments for each decision. This is a sensible phased approach. No conflicts flagged with Prettier or ESLint learnings (Biome is separate).

package.json (2)

7-7: Confirm styling checks are no longer part of the main check pipeline.

The changes address the past redundancy issue by decoupling typecheck into its own script (line 21) and removing it from lint:check (line 14 now just calls biome check). However, stylelint:check has been removed from the main check command (line 7).

Is this intentional? The stylelint scripts still exist (lines 16–17), but they won't run as part of routine checks anymore.

Also applies to: 14-14, 21-21


14-14: Minor: clarify intent of removing the "." argument.

Line 14 changed from biome check . to biome check. Both forms should work, but confirm whether this is just a style preference or has functional implications.

src/hooks/useUserBalances.ts (1)

44-47: LGTM! Better naming.

Renaming the parameter to errorData clarifies it holds the error response body, not regular data.

src/hooks/useVaultV2.ts (1)

233-237: Alias and trimming change is solid

Aliasing to newName/newSymbol avoids shadowing the outer name/symbol values in this hook, and trimming before building calls keeps whitespace-only inputs from triggering a tx while preserving existing behavior.

Copy link

@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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/components/common/IconSwitch.tsx (1)

2-25: React types referenced without React namespace import

The code uses React.ComponentType (lines 14–16), React.ButtonHTMLAttributes (line 25), React.KeyboardEvent (line 124), and React.CSSProperties (lines 135, 143), but only imports named hooks from React. TypeScript will fail to resolve the React namespace.

Add a type-only React import:

'use client';
+import type React from 'react';
import { useCallback, useState } from 'react';
🧹 Nitpick comments (9)
src/utils/gtag.ts (2)

5-7: Local WindowWithGtag alias looks good

Nice move away from global window augmentation. If you later want a bit more type safety, you could narrow gtag to something like ((...args: unknown[]) => void) | undefined instead of any, but this is fine for now.


24-32: Consistent guarding pattern in logEvent

Mirroring the logPageview guard pattern here is solid and keeps analytics failures from breaking the app. If this grows, consider a tiny helper like getGtag() to share the guard logic, but not required.

src/components/WithdrawModalContent.tsx (1)

122-173: Connected / not‑connected branching looks correct; button disable condition can be trimmed

The isConnected ? … : <AccountConnect /> structure reads clearly and matches the expected UX.

Inside the connected branch, the withdraw button is only rendered when isConnected is true, so this part of the predicate is redundant:

isDisabled={!isConnected || isConfirming || !withdrawAmount}

You can simplify to:

isDisabled={isConfirming || !withdrawAmount}

to keep the condition minimal and avoid dead checks.

src/utils/balance.ts (2)

25-45: formatReadable param reassignment fix is fine; precision use is a small nit

Using _num with a local num avoids param reassignment and keeps the existing string‑parsing path intact. One small thought: precision only affects values < 1000, while the B/M/K branches always use toFixed(2); if you ever want a single precision knob, you could pass precision into those toFixed calls too.


51-56: formatSimple helper looks good; locale/precision are currently baked in

Implementation is straightforward and works for number | bigint. If you later need different locales or fraction ranges, consider exposing them as optional parameters instead of hardcoding 'en-us' and 2..4 here.

app/positions/components/onboarding/SetupPositions.tsx (1)

96-97: Parameter rename with immediate reassignment is slightly unusual.

The _newPercentage parameter is immediately assigned to a local newPercentage variable. This pattern works but adds an extra step. Consider keeping the parameter name as newPercentage directly if there's no specific linting requirement.

If there's no linting constraint, you could simplify to:

-    (marketKey: string, _newPercentage: number) => {
-      let newPercentage = _newPercentage;
-
+    (marketKey: string, newPercentage: number) => {
       // If the input is invalid (NaN), set it to 0
       if (Number.isNaN(newPercentage)) {
-        newPercentage = 0;
+        newPercentage = 0;  // Note: can't reassign const parameter in this flow
       }

Actually, the let is needed for the NaN reassignment on line 101, so the pattern makes sense.

src/components/Borrow/AddCollateralAndBorrow.tsx (1)

356-356: Use strict equality for consistency.

borrowAmount == 0n uses loose equality. While it works for bigints, strict === is more consistent with the codebase style.

-{collateralAmount > 0n && borrowAmount == 0n ? 'Add Collateral' : 'Borrow'}
+{collateralAmount > 0n && borrowAmount === 0n ? 'Add Collateral' : 'Borrow'}
src/components/Borrow/WithdrawCollateralAndRepay.tsx (1)

334-340: Mixed bigint comparison styles.

Line 338 uses withdrawAmount > 0 (number), but withdrawAmount is bigint. Works via coercion but inconsistent with other comparisons using 0n.

 {isLoadingPermit2
   ? 'Loading...'
   : !isApproved && !permit2Authorized
     ? 'Approve & Repay'
-    : withdrawAmount > 0
+    : withdrawAmount > 0n
       ? 'Withdraw & Repay'
       : 'Repay'}
app/positions/components/RebalanceModal.tsx (1)

91-95: Tidy invalid-market error message formatting

Logic is fine, but when both markets are missing the message becomes Invalid "From" Market"To" Market (no separator). You can keep the same behavior while making the string cleaner.

For example:

-    if (!fromMarket || !toMarket) {
-      const errorMessage = `Invalid ${fromMarket ? '' : '"From" Market'}${toMarket ? '' : '"To" Market'}`;
+    if (!fromMarket || !toMarket) {
+      const missingLabels = [
+        fromMarket ? null : '"From" Market',
+        toMarket ? null : '"To" Market',
+      ].filter(Boolean);
+      const errorMessage = `Invalid ${missingLabels.join(' and ')}`;
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b160ec4 and f4dc766.

📒 Files selected for processing (39)
  • AGENTS.md (1 hunks)
  • app/HomePage.tsx (2 hunks)
  • app/admin/stats/components/AssetMetricsTable.tsx (1 hunks)
  • app/admin/stats/components/TransactionsTable.tsx (1 hunks)
  • app/api/block/route.ts (0 hunks)
  • app/autovault/[chainId]/[vaultAddress]/components/DepositToVaultModal.tsx (2 hunks)
  • app/autovault/[chainId]/[vaultAddress]/components/settings/AgentsTab.tsx (2 hunks)
  • app/autovault/[chainId]/[vaultAddress]/components/settings/CurrentCaps.tsx (2 hunks)
  • app/market/[chainId]/[marketid]/VolumeChart.tsx (3 hunks)
  • app/markets/components/markets.tsx (4 hunks)
  • app/positions/components/PositionsContent.tsx (1 hunks)
  • app/positions/components/PositionsSummaryTable.tsx (2 hunks)
  • app/positions/components/RebalanceModal.tsx (1 hunks)
  • app/positions/components/onboarding/SetupPositions.tsx (1 hunks)
  • biome.jsonc (2 hunks)
  • src/components/Borrow/AddCollateralAndBorrow.tsx (3 hunks)
  • src/components/Borrow/WithdrawCollateralAndRepay.tsx (3 hunks)
  • src/components/Status/LoadingScreen.tsx (1 hunks)
  • src/components/SupplyModalContent.tsx (2 hunks)
  • src/components/SupplyModalV2.tsx (1 hunks)
  • src/components/WithdrawModalContent.tsx (2 hunks)
  • src/components/common/IconSwitch.tsx (4 hunks)
  • src/components/common/MarketsTableWithSameLoanAsset.tsx (3 hunks)
  • src/components/layout/header/ListItem.tsx (3 hunks)
  • src/components/ui/button.tsx (2 hunks)
  • src/components/ui/pagination.tsx (3 hunks)
  • src/data-sources/subgraph/historical.ts (1 hunks)
  • src/hooks/usePagination.ts (2 hunks)
  • src/hooks/usePositionReport.ts (1 hunks)
  • src/hooks/useStaredMarkets.ts (3 hunks)
  • src/hooks/useSupplyMarket.ts (2 hunks)
  • src/hooks/useUserMarketsCache.ts (3 hunks)
  • src/hooks/useUserTransactions.ts (2 hunks)
  • src/hooks/useVaultV2Deposit.ts (2 hunks)
  • src/utils/balance.ts (2 hunks)
  • src/utils/external.ts (1 hunks)
  • src/utils/gtag.ts (1 hunks)
  • src/utils/positions.ts (2 hunks)
  • src/utils/storageKeys.ts (1 hunks)
💤 Files with no reviewable changes (1)
  • app/api/block/route.ts
✅ Files skipped from review due to trivial changes (2)
  • src/components/SupplyModalContent.tsx
  • app/autovault/[chainId]/[vaultAddress]/components/DepositToVaultModal.tsx
🚧 Files skipped from review as they are similar to previous changes (3)
  • app/market/[chainId]/[marketid]/VolumeChart.tsx
  • src/components/layout/header/ListItem.tsx
  • src/utils/external.ts
🧰 Additional context used
📓 Path-based instructions (7)
**/*.{ts,tsx,js,jsx,css,scss}

📄 CodeRabbit inference engine (AGENTS.md)

Run pnpm format (Prettier) before pushing with 2-space indentation, 100-character width, single quotes, and Tailwind-aware class ordering

Files:

  • src/hooks/usePagination.ts
  • src/hooks/usePositionReport.ts
  • src/components/Borrow/AddCollateralAndBorrow.tsx
  • src/hooks/useStaredMarkets.ts
  • app/admin/stats/components/AssetMetricsTable.tsx
  • app/autovault/[chainId]/[vaultAddress]/components/settings/AgentsTab.tsx
  • src/utils/gtag.ts
  • src/hooks/useUserTransactions.ts
  • src/components/ui/pagination.tsx
  • app/positions/components/PositionsSummaryTable.tsx
  • src/components/WithdrawModalContent.tsx
  • src/hooks/useSupplyMarket.ts
  • app/markets/components/markets.tsx
  • src/components/common/MarketsTableWithSameLoanAsset.tsx
  • src/data-sources/subgraph/historical.ts
  • app/positions/components/onboarding/SetupPositions.tsx
  • app/positions/components/RebalanceModal.tsx
  • app/positions/components/PositionsContent.tsx
  • src/components/SupplyModalV2.tsx
  • src/utils/storageKeys.ts
  • app/autovault/[chainId]/[vaultAddress]/components/settings/CurrentCaps.tsx
  • src/hooks/useUserMarketsCache.ts
  • src/components/common/IconSwitch.tsx
  • src/utils/positions.ts
  • src/components/ui/button.tsx
  • app/admin/stats/components/TransactionsTable.tsx
  • app/HomePage.tsx
  • src/hooks/useVaultV2Deposit.ts
  • src/components/Status/LoadingScreen.tsx
  • src/utils/balance.ts
  • src/components/Borrow/WithdrawCollateralAndRepay.tsx
src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use camelCase for helper function names (e.g., formatApr)

Files:

  • src/hooks/usePagination.ts
  • src/hooks/usePositionReport.ts
  • src/components/Borrow/AddCollateralAndBorrow.tsx
  • src/hooks/useStaredMarkets.ts
  • src/utils/gtag.ts
  • src/hooks/useUserTransactions.ts
  • src/components/ui/pagination.tsx
  • src/components/WithdrawModalContent.tsx
  • src/hooks/useSupplyMarket.ts
  • src/components/common/MarketsTableWithSameLoanAsset.tsx
  • src/data-sources/subgraph/historical.ts
  • src/components/SupplyModalV2.tsx
  • src/utils/storageKeys.ts
  • src/hooks/useUserMarketsCache.ts
  • src/components/common/IconSwitch.tsx
  • src/utils/positions.ts
  • src/components/ui/button.tsx
  • src/hooks/useVaultV2Deposit.ts
  • src/components/Status/LoadingScreen.tsx
  • src/utils/balance.ts
  • src/components/Borrow/WithdrawCollateralAndRepay.tsx
src/hooks/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

When building on-chain hooks, mirror useERC20Approval and useTransactionWithToast patterns and memoize arrays/objects before using them in effect dependencies to prevent redundant RPC calls

Files:

  • src/hooks/usePagination.ts
  • src/hooks/usePositionReport.ts
  • src/hooks/useStaredMarkets.ts
  • src/hooks/useUserTransactions.ts
  • src/hooks/useSupplyMarket.ts
  • src/hooks/useUserMarketsCache.ts
  • src/hooks/useVaultV2Deposit.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

ESLint (Airbnb + Next.js) enforces hook safety and import hygiene

Files:

  • src/hooks/usePagination.ts
  • src/hooks/usePositionReport.ts
  • src/components/Borrow/AddCollateralAndBorrow.tsx
  • src/hooks/useStaredMarkets.ts
  • app/admin/stats/components/AssetMetricsTable.tsx
  • app/autovault/[chainId]/[vaultAddress]/components/settings/AgentsTab.tsx
  • src/utils/gtag.ts
  • src/hooks/useUserTransactions.ts
  • src/components/ui/pagination.tsx
  • app/positions/components/PositionsSummaryTable.tsx
  • src/components/WithdrawModalContent.tsx
  • src/hooks/useSupplyMarket.ts
  • app/markets/components/markets.tsx
  • src/components/common/MarketsTableWithSameLoanAsset.tsx
  • src/data-sources/subgraph/historical.ts
  • app/positions/components/onboarding/SetupPositions.tsx
  • app/positions/components/RebalanceModal.tsx
  • app/positions/components/PositionsContent.tsx
  • src/components/SupplyModalV2.tsx
  • src/utils/storageKeys.ts
  • app/autovault/[chainId]/[vaultAddress]/components/settings/CurrentCaps.tsx
  • src/hooks/useUserMarketsCache.ts
  • src/components/common/IconSwitch.tsx
  • src/utils/positions.ts
  • src/components/ui/button.tsx
  • app/admin/stats/components/TransactionsTable.tsx
  • app/HomePage.tsx
  • src/hooks/useVaultV2Deposit.ts
  • src/components/Status/LoadingScreen.tsx
  • src/utils/balance.ts
  • src/components/Borrow/WithdrawCollateralAndRepay.tsx
**/*.tsx

📄 CodeRabbit inference engine (AGENTS.md)

Use PascalCase for React component file names (e.g., VaultBanner.tsx)

Files:

  • src/components/Borrow/AddCollateralAndBorrow.tsx
  • app/admin/stats/components/AssetMetricsTable.tsx
  • app/autovault/[chainId]/[vaultAddress]/components/settings/AgentsTab.tsx
  • src/components/ui/pagination.tsx
  • app/positions/components/PositionsSummaryTable.tsx
  • src/components/WithdrawModalContent.tsx
  • app/markets/components/markets.tsx
  • src/components/common/MarketsTableWithSameLoanAsset.tsx
  • app/positions/components/onboarding/SetupPositions.tsx
  • app/positions/components/RebalanceModal.tsx
  • app/positions/components/PositionsContent.tsx
  • src/components/SupplyModalV2.tsx
  • app/autovault/[chainId]/[vaultAddress]/components/settings/CurrentCaps.tsx
  • src/components/common/IconSwitch.tsx
  • src/components/ui/button.tsx
  • app/admin/stats/components/TransactionsTable.tsx
  • app/HomePage.tsx
  • src/components/Status/LoadingScreen.tsx
  • src/components/Borrow/WithdrawCollateralAndRepay.tsx
**/*.{tsx,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{tsx,jsx}: Keep Tailwind class lists lean and dedupe variants with tailwind-merge
All toggles must use the shared IconSwitch component from @/components/common/IconSwitch for consistent sizing and animation

Files:

  • src/components/Borrow/AddCollateralAndBorrow.tsx
  • app/admin/stats/components/AssetMetricsTable.tsx
  • app/autovault/[chainId]/[vaultAddress]/components/settings/AgentsTab.tsx
  • src/components/ui/pagination.tsx
  • app/positions/components/PositionsSummaryTable.tsx
  • src/components/WithdrawModalContent.tsx
  • app/markets/components/markets.tsx
  • src/components/common/MarketsTableWithSameLoanAsset.tsx
  • app/positions/components/onboarding/SetupPositions.tsx
  • app/positions/components/RebalanceModal.tsx
  • app/positions/components/PositionsContent.tsx
  • src/components/SupplyModalV2.tsx
  • app/autovault/[chainId]/[vaultAddress]/components/settings/CurrentCaps.tsx
  • src/components/common/IconSwitch.tsx
  • src/components/ui/button.tsx
  • app/admin/stats/components/TransactionsTable.tsx
  • app/HomePage.tsx
  • src/components/Status/LoadingScreen.tsx
  • src/components/Borrow/WithdrawCollateralAndRepay.tsx
app/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Next.js routes must live under app/ directory

Files:

  • app/admin/stats/components/AssetMetricsTable.tsx
  • app/autovault/[chainId]/[vaultAddress]/components/settings/AgentsTab.tsx
  • app/positions/components/PositionsSummaryTable.tsx
  • app/markets/components/markets.tsx
  • app/positions/components/onboarding/SetupPositions.tsx
  • app/positions/components/RebalanceModal.tsx
  • app/positions/components/PositionsContent.tsx
  • app/autovault/[chainId]/[vaultAddress]/components/settings/CurrentCaps.tsx
  • app/admin/stats/components/TransactionsTable.tsx
  • app/HomePage.tsx
🧠 Learnings (14)
📚 Learning: 2025-11-25T14:45:50.416Z
Learnt from: CR
Repo: antoncoding/monarch PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T14:45:50.416Z
Learning: Applies to **/*.{ts,tsx,js,jsx,css,scss} : Run `pnpm format` (Prettier) before pushing with 2-space indentation, 100-character width, single quotes, and Tailwind-aware class ordering

Applied to files:

  • AGENTS.md
  • biome.jsonc
📚 Learning: 2025-11-25T14:45:50.416Z
Learnt from: CR
Repo: antoncoding/monarch PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T14:45:50.416Z
Learning: Use `pnpm` for dependency installation to maintain lockfile parity

Applied to files:

  • AGENTS.md
📚 Learning: 2025-11-25T14:45:50.416Z
Learnt from: CR
Repo: antoncoding/monarch PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T14:45:50.416Z
Learning: Rebase onto `main` and run `pnpm check` before opening a pull request

Applied to files:

  • AGENTS.md
📚 Learning: 2025-11-25T14:45:50.416Z
Learnt from: CR
Repo: antoncoding/monarch PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T14:45:50.416Z
Learning: Applies to **/*.test.{ts,tsx} : Add regression coverage for protocol-critical flows (transactions, risk filters) mirroring real network scenarios

Applied to files:

  • src/hooks/useUserTransactions.ts
  • src/utils/positions.ts
📚 Learning: 2024-10-23T16:17:02.841Z
Learnt from: antoncoding
Repo: antoncoding/monarch PR: 77
File: src/graphql/queries.ts:168-193
Timestamp: 2024-10-23T16:17:02.841Z
Learning: In `src/graphql/queries.ts`, handling only `MarketTransferTransactionData` is intentional at this time.

Applied to files:

  • src/hooks/useUserTransactions.ts
📚 Learning: 2025-11-25T14:45:50.416Z
Learnt from: CR
Repo: antoncoding/monarch PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T14:45:50.416Z
Learning: Applies to src/hooks/**/*.{ts,tsx} : When building on-chain hooks, mirror `useERC20Approval` and `useTransactionWithToast` patterns and memoize arrays/objects before using them in effect dependencies to prevent redundant RPC calls

Applied to files:

  • src/hooks/useUserTransactions.ts
  • src/hooks/useSupplyMarket.ts
  • src/hooks/useVaultV2Deposit.ts
📚 Learning: 2025-11-25T14:45:50.416Z
Learnt from: CR
Repo: antoncoding/monarch PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T14:45:50.416Z
Learning: Applies to **/*.{tsx,jsx} : All toggles must use the shared `IconSwitch` component from `@/components/common/IconSwitch` for consistent sizing and animation

Applied to files:

  • src/components/ui/pagination.tsx
  • src/components/common/IconSwitch.tsx
  • src/components/ui/button.tsx
📚 Learning: 2024-11-25T09:39:42.148Z
Learnt from: antoncoding
Repo: antoncoding/monarch PR: 87
File: app/home/HomePage.tsx:17-39
Timestamp: 2024-11-25T09:39:42.148Z
Learning: In `app/home/HomePage.tsx`, the `useEffect` hook depends on `[showCustomized]` because changing `showCustomized` triggers updates to the yield and risk terms.

Applied to files:

  • app/positions/components/PositionsSummaryTable.tsx
  • app/markets/components/markets.tsx
  • src/components/common/MarketsTableWithSameLoanAsset.tsx
📚 Learning: 2024-11-20T07:19:08.123Z
Learnt from: antoncoding
Repo: antoncoding/monarch PR: 83
File: src/hooks/useERC20Approval.ts:45-59
Timestamp: 2024-11-20T07:19:08.123Z
Learning: In `src/hooks/useERC20Approval.ts`, the `approve` function intentionally does not wait for the transaction receipt after `sendTransactionAsync` to allow Safe to batch execute transactions.

Applied to files:

  • src/hooks/useSupplyMarket.ts
  • src/hooks/useVaultV2Deposit.ts
📚 Learning: 2024-10-12T09:23:16.495Z
Learnt from: antoncoding
Repo: antoncoding/monarch PR: 63
File: app/markets/components/MarketRowDetail.tsx:49-52
Timestamp: 2024-10-12T09:23:16.495Z
Learning: When rendering oracle feeds in `ExpandedMarketDetail` (`app/markets/components/MarketRowDetail.tsx`), prefer explicit rendering over iterating keys when dealing with a small number of feeds.

Applied to files:

  • app/markets/components/markets.tsx
  • src/components/common/MarketsTableWithSameLoanAsset.tsx
  • app/positions/components/PositionsContent.tsx
📚 Learning: 2024-12-16T02:01:51.219Z
Learnt from: antoncoding
Repo: antoncoding/monarch PR: 97
File: app/positions/components/onboarding/OnboardingContext.tsx:36-43
Timestamp: 2024-12-16T02:01:51.219Z
Learning: In `app/positions/components/onboarding/OnboardingContext.tsx`, the `defaultStep` variable is no longer needed and can be removed.

Applied to files:

  • app/positions/components/onboarding/SetupPositions.tsx
  • src/components/Status/LoadingScreen.tsx
📚 Learning: 2025-11-25T14:45:50.416Z
Learnt from: CR
Repo: antoncoding/monarch PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T14:45:50.416Z
Learning: Applies to **/*.tsx : Use PascalCase for React component file names (e.g., `VaultBanner.tsx`)

Applied to files:

  • app/autovault/[chainId]/[vaultAddress]/components/settings/CurrentCaps.tsx
📚 Learning: 2025-11-25T14:45:50.416Z
Learnt from: CR
Repo: antoncoding/monarch PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T14:45:50.416Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : ESLint (Airbnb + Next.js) enforces hook safety and import hygiene

Applied to files:

  • src/components/common/IconSwitch.tsx
  • biome.jsonc
📚 Learning: 2024-12-08T12:10:17.127Z
Learnt from: antoncoding
Repo: antoncoding/monarch PR: 94
File: src/components/supplyModal.tsx:449-452
Timestamp: 2024-12-08T12:10:17.127Z
Learning: The 'solid' variant is defined in the new `Button` component and is a valid variant.

Applied to files:

  • src/components/ui/button.tsx
🧬 Code graph analysis (10)
src/hooks/usePagination.ts (1)
src/utils/storageKeys.ts (1)
  • storageKeys (1-26)
src/components/Borrow/AddCollateralAndBorrow.tsx (1)
src/components/common/Button.tsx (1)
  • Button (4-54)
src/hooks/useStaredMarkets.ts (1)
src/utils/storageKeys.ts (1)
  • storageKeys (1-26)
app/autovault/[chainId]/[vaultAddress]/components/settings/AgentsTab.tsx (1)
app/autovault/[chainId]/[vaultAddress]/components/settings/AgentListItem.tsx (1)
  • AgentListItem (10-27)
app/positions/components/PositionsSummaryTable.tsx (2)
src/hooks/useLocalStorage.ts (1)
  • useLocalStorage (4-63)
src/utils/storageKeys.ts (1)
  • storageKeys (1-26)
app/markets/components/markets.tsx (3)
src/hooks/useLocalStorage.ts (1)
  • useLocalStorage (4-63)
src/utils/storageKeys.ts (1)
  • storageKeys (1-26)
src/constants/markets.ts (2)
  • DEFAULT_MIN_SUPPLY_USD (1-1)
  • DEFAULT_MIN_LIQUIDITY_USD (2-2)
src/components/common/MarketsTableWithSameLoanAsset.tsx (3)
src/hooks/useLocalStorage.ts (1)
  • useLocalStorage (4-63)
src/utils/storageKeys.ts (1)
  • storageKeys (1-26)
src/constants/markets.ts (2)
  • DEFAULT_MIN_SUPPLY_USD (1-1)
  • DEFAULT_MIN_LIQUIDITY_USD (2-2)
app/positions/components/PositionsContent.tsx (1)
app/positions/components/PositionsSummaryTable.tsx (1)
  • PositionsSummaryTable (109-470)
src/hooks/useUserMarketsCache.ts (1)
src/utils/storageKeys.ts (1)
  • storageKeys (1-26)
src/components/Borrow/WithdrawCollateralAndRepay.tsx (1)
src/components/common/Button.tsx (1)
  • Button (4-54)
🔇 Additional comments (36)
AGENTS.md (1)

12-12: Documentation update is clear.

Line 12 appropriately documents the targeted linting command following the consolidation described in the PR. The distinction between pnpm check (comprehensive: format + ESLint + Stylelint) and pnpm lint (targeted to specific file types) is well-articulated.

src/components/SupplyModalV2.tsx (1)

51-52: LGTM!

Removing the unnecessary else after early return is clean. Logic is identical, just follows the no-else-return pattern.

biome.jsonc (2)

171-171: Clarify the noShadow rule change.

The rule is now commented out (disabled), but the comment "noShadow is now commented out" is a bit redundant with the syntax. Was this intentional to completely remove the configuration, or should it remain as an explicit "noShadow": "off" setting?


34-186: Verify ESLint vs. Biome tooling alignment.

The learnings mention ESLint (Airbnb + Next.js) enforcement for hook safety and import hygiene on TypeScript/JavaScript files, but this PR is adjusting Biome configuration. Confirm whether:

  • ESLint and Biome are running simultaneously, or if the project is migrating from ESLint to Biome.
  • The relaxed Biome rules (especially useIndexOf, noShadow, and others) align with your migration strategy and don't create blind spots for issues that ESLint would have caught.

This matters because disabling rules across both tools could hide legitimate bugs during the transition period.

src/utils/positions.ts (2)

176-185: Logging change is purely cosmetic

Swapping the template literal for a plain string keeps the log shape identical; no behavior change here.


249-256: Consistent error log style

Same as above: message string change only, structured payload untouched. Looks good.

src/utils/gtag.ts (1)

13-18: Safe guard around window.gtag in logPageview

isClient() plus the null-check on gtag avoids crashes when the analytics script is missing or blocked; the local variable also keeps the call site clean. All good here.

src/data-sources/subgraph/historical.ts (1)

74-81: NaN guard rewrite keeps behavior, improves readability

Switching to isNaN(value) ? 0 : value from the negated form is equivalent here and easier to read; looks good.

src/hooks/usePositionReport.ts (1)

37-51: Param rename + local endDate looks good

Using _endDate as the parameter and a local endDate variable keeps behavior the same while avoiding parameter mutation, which fits typical lint rules against no-param-reassign. No issues spotted.

src/hooks/useSupplyMarket.ts (2)

82-82: LGTM - readability improvement.

Digit separator makes the interval value clearer.


264-286: LGTM - improves UI consistency.

Explicitly setting the step to 'supplying' when already approved ensures the modal displays the correct state regardless of the approval path taken.

src/hooks/useVaultV2Deposit.ts (2)

86-86: LGTM!

Numeric separator improves readability without changing behavior.


229-231: LGTM!

The explicit approval check clarifies the flow. When already approved, it skips directly to depositing, which is correct since no approval transaction is needed. The built-in 800ms delay at line 162 applies to all paths.

src/utils/balance.ts (1)

58-60: Bigint min helper is correct and clear

The comparison logic is correct, side‑effect free, and reads easily.

src/components/common/IconSwitch.tsx (2)

102-106: State initialization change is safe

Using the named useState import instead of React.useState preserves the same uncontrolled vs controlled behavior here; no functional change.


113-131: Callbacks and dependency arrays look correct

handleToggle and handleKeyDown use useCallback with appropriate dependency lists; click and keyboard handling behavior is unchanged and stays accessible.

app/admin/stats/components/TransactionsTable.tsx (1)

170-173: LGTM!

The sort logic refactor is correct. The ascending case returns early, so the descending comparison executes unconditionally for the desc case.

src/components/ui/button.tsx (1)

1-1: LGTM!

Clean refactor to use direct forwardRef import instead of namespace access. No functional change.

Also applies to: 38-38

app/admin/stats/components/AssetMetricsTable.tsx (1)

79-82: LGTM!

Sort logic refactor matches the pattern in TransactionsTable. The ascending case returns early, leaving the descending comparison to execute unconditionally.

src/components/Status/LoadingScreen.tsx (1)

65-76: LGTM!

The typing animation control flow has been reorganized to check deletion first, but the observable behavior remains identical.

app/autovault/[chainId]/[vaultAddress]/components/settings/CurrentCaps.tsx (1)

151-309: LGTM!

Inverting the conditional to show the main content when caps exist is more readable. No functional change.

src/hooks/useUserTransactions.ts (1)

103-104: LGTM!

Removing the else blocks is clean since the success case returns early. Functionally equivalent to the previous implementation.

Also applies to: 134-135

app/HomePage.tsx (1)

105-120: LGTM!

Typing animation refactored consistently with LoadingScreen.tsx. The control flow reorganization preserves the deletion → typing → pause cycle.

src/components/Borrow/AddCollateralAndBorrow.tsx (2)

83-96: LTV guard logic looks good.

Clean refactor - explicit else branch for the zero case improves readability.


317-323: Invalid button variant.

variant="solid" isn't defined in the Button component. Available variants per src/components/common/Button.tsx: default, cta, secondary, interactive, ghost, subtle.

 <Button
   onPress={switchToNetwork}
   className="min-w-32"
-  variant="solid"
+  variant="cta"
 >
   Switch Chain
 </Button>
⛔ Skipped due to learnings
Learnt from: antoncoding
Repo: antoncoding/monarch PR: 94
File: src/components/supplyModal.tsx:449-452
Timestamp: 2024-12-08T12:10:17.127Z
Learning: The 'solid' variant is defined in the new `Button` component and is a valid variant.
src/components/Borrow/WithdrawCollateralAndRepay.tsx (2)

105-118: LTV guard refactor is consistent.

Matches the pattern in AddCollateralAndBorrow.tsx.


306-312: Invalid button variant.

Same issue as AddCollateralAndBorrow.tsx - variant="solid" isn't defined.

 <Button
   onPress={switchToNetwork}
   className="min-w-32"
-  variant="solid"
+  variant="cta"
 >
   Switch Chain
 </Button>
⛔ Skipped due to learnings
Learnt from: antoncoding
Repo: antoncoding/monarch PR: 94
File: src/components/supplyModal.tsx:449-452
Timestamp: 2024-12-08T12:10:17.127Z
Learning: The 'solid' variant is defined in the new `Button` component and is a valid variant.
src/utils/storageKeys.ts (1)

1-26: Clean consolidation.

Single object with as const is better than scattered exports. Enables IDE autocomplete and keeps keys in one place.

app/autovault/[chainId]/[vaultAddress]/components/settings/AgentsTab.tsx (1)

113-203: UI restructure looks solid.

Edit/read-only branching is clearer. Per-item loading states (allocatorToAdd/allocatorToRemove) prevent action on the specific item being processed while allowing interaction with others.

src/hooks/useUserMarketsCache.ts (1)

3-3: LGTM — storage key centralization.

The migration to storageKeys.CacheMarketPositionKeys is consistent with the broader refactor.

Also applies to: 18-18, 31-31

src/hooks/usePagination.ts (1)

3-3: LGTM — storage key centralization.

The migration to storageKeys.MarketEntriesPerPageKey follows the same centralization pattern.

Also applies to: 14-14, 22-22

src/components/common/MarketsTableWithSameLoanAsset.tsx (1)

27-27: LGTM — storage key centralization.

All localStorage keys now correctly reference the centralized storageKeys object.

Also applies to: 672-685, 705-713

src/hooks/useStaredMarkets.ts (1)

4-4: LGTM — storage key centralization + defensive coding.

The migration to storageKeys.MarketFavoritesKey is consistent. The explicit return [] on line 12 ensures a safe fallback on error.

Also applies to: 8-14, 26-26, 38-38

app/positions/components/PositionsSummaryTable.tsx (1)

26-26: LGTM — storage key centralization.

The migration to storageKeys.PositionsShowEmptyKey and storageKeys.PositionsShowCollateralExposureKey is correct.

Also applies to: 124-128

app/markets/components/markets.tsx (1)

31-31: LGTM — storage key centralization.

All localStorage keys consistently migrated to the centralized storageKeys object.

Also applies to: 81-82, 95-96, 101-106, 110-114, 116-116, 120-120, 134-134

app/positions/components/RebalanceModal.tsx (1)

78-82: The comparison scaledAmount <= 0 works correctly in JavaScript. parseUnits returns a bigint, and JavaScript coerces bigint <= number comparisons without throwing a TypeError. The condition correctly evaluates to true when the amount is zero or negative. No fix is required.

Likely an incorrect or invalid review comment.

@antoncoding antoncoding merged commit 56b396a into master Dec 9, 2025
4 checks passed
@antoncoding antoncoding deleted the misc/lint branch December 9, 2025 03:56
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