From a679134e8a684688f4fe8b3cfb642e70c0be746d Mon Sep 17 00:00:00 2001 From: tuanddd Date: Tue, 22 Aug 2023 08:06:18 +0700 Subject: [PATCH] fix: wlv not using formatter --- .husky/pre-commit | 1 + package.json | 3 ++- src/adapters/community.ts | 2 +- src/commands/vault/list/processor.ts | 2 +- src/commands/watchlist/view/processor.ts | 10 +++++----- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.husky/pre-commit b/.husky/pre-commit index b86865e88..4545018f7 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -3,3 +3,4 @@ npx lint-staged yarn generate:types && git add src/types/api.ts +yarn format diff --git a/package.json b/package.json index b646043cf..5c14b04ea 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,8 @@ "lint:fix": "eslint --fix --ext .js,.jsx,.ts .", "prepare": "husky install", "generate:types": "node ./scripts/generate-types.js", - "guilds:prune": "node ./scripts/leave-server.js" + "guilds:prune": "node ./scripts/leave-server.js", + "format": "npx prettier src/** --write" }, "devDependencies": { "@babel/preset-typescript": "^7.15.0", diff --git a/src/adapters/community.ts b/src/adapters/community.ts index fe9849fac..435dd98ff 100644 --- a/src/adapters/community.ts +++ b/src/adapters/community.ts @@ -361,7 +361,7 @@ class Community extends Fetcher { public async getFeedbackList( discordId?: string, page = 0, - profileId?: string, + profileId?: string ) { return await this.jsonFetch<{ data: ResponseUserFeedbackResponse }>( `${API_BASE_URL}/community/feedback`, diff --git a/src/commands/vault/list/processor.ts b/src/commands/vault/list/processor.ts index d0d37cb86..ceeef48bb 100644 --- a/src/commands/vault/list/processor.ts +++ b/src/commands/vault/list/processor.ts @@ -95,7 +95,7 @@ export async function runVaultList(interaction: CommandInteraction) { new MessageSelectMenu() .setPlaceholder("💰 View a vault") .setCustomId("view_vault") - .addOptions(options), + .addOptions(options) ), ] diff --git a/src/commands/watchlist/view/processor.ts b/src/commands/watchlist/view/processor.ts index 9be4b30f4..f4e46c765 100644 --- a/src/commands/watchlist/view/processor.ts +++ b/src/commands/watchlist/view/processor.ts @@ -6,12 +6,12 @@ import CacheManager from "cache/node-cache" import community from "adapters/community" import { getSlashCommand } from "utils/commands" import { ResponseGetWatchlistResponse } from "types/api" -import { formatPercentDigit, formatUsdDigit } from "utils/defi" -import { VERTICAL_BAR } from "utils/constants" import { groupBy } from "lodash" +import { getProfileIdByDiscord } from "../../../utils/profile" +import { utils } from "@consolelabs/mochi-formatter" +import { VERTICAL_BAR } from "utils/constants" import { renderChart } from "./chart" import { paginationButtons } from "utils/router" -import { getProfileIdByDiscord } from "../../../utils/profile" export function buildSwitchViewActionRow(currentView: string) { const tokenButton = new MessageButton({ @@ -133,8 +133,8 @@ export async function composeWatchlist( const priceChange = t.price_change_percentage_24h ?? 0 return { symbol: (t.symbol ?? "").toUpperCase(), - priceChange: `${formatPercentDigit(String(priceChange))}%`, - usd: `$${formatUsdDigit(String(price))}`, + priceChange: utils.formatPercentDigit(priceChange), + usd: utils.formatUsdDigit(price), } }), {