From 74cd5ae39aa82aa9eb73a1c2b6b9e0f51e319857 Mon Sep 17 00:00:00 2001 From: xdeq Date: Tue, 1 Oct 2024 23:48:58 +0300 Subject: [PATCH 1/3] biome init --- app.vue | 2 +- assets/workers/worker.js | 2 +- biome.json | 55 + components/AddressBadge.vue | 4 +- components/AmountInCurrency.vue | 12 +- components/BookmarkButton.vue | 9 +- components/Connection.vue | 5 +- components/DatePicker.vue | 73 +- components/Feed.vue | 14 +- components/GasBar.vue | 9 +- components/Icon.vue | 2 +- components/Text.vue | 8 +- components/TheFooter.vue | 2 +- components/cmd/CommandMenu.vue | 50 +- components/cmd/custom/FeeCalculator.vue | 6 +- .../BlocksTimeline/BlocksTimelineTable.vue | 12 +- components/data/RecentNamespacesTable.vue | 2 +- components/modals/AwaitingModal.vue | 42 +- components/modals/BlobModal.vue | 9 +- components/modals/CommitmentModal.vue | 3 +- components/modals/ConstantsModal.vue | 4 +- components/modals/HexSettingsModal.vue | 4 +- components/modals/ImportBookmarksModal.vue | 6 +- components/modals/LightNodeModal.vue | 11 +- components/modals/LightNodeSettingsModal.vue | 6 +- components/modals/ODSModal.vue | 135 +- components/modals/PayForBlobModal.vue | 26 +- components/modals/SendModal.vue | 53 +- components/modals/StakingModal.vue | 62 +- components/modals/VestingDetailsModal.vue | 9 +- components/modules/address/AddressCharts.vue | 37 +- .../modules/address/AddressOverview.vue | 53 +- .../modules/address/tables/VestingsTable.vue | 59 +- components/modules/blob/DataInspector.vue | 14 +- components/modules/blob/HexViewer.vue | 8 +- components/modules/block/BlockOverview.vue | 33 +- components/modules/gas/GasEfficiencyChart.vue | 48 +- components/modules/gas/GasFeeCalculator.vue | 8 +- components/modules/gas/GasPriceChart.vue | 19 +- components/modules/gas/GasPriceHeatmap.vue | 18 +- .../modules/namespace/NamespaceCharts.vue | 34 +- components/modules/navigation/NavLink.vue | 2 +- components/modules/navigation/Search.vue | 2 +- components/modules/rollup/RollupCharts.vue | 53 +- components/modules/rollup/RollupOverview.vue | 15 +- .../modules/rollup/tables/BlobsTable.vue | 2 +- components/modules/stats/BarChart.vue | 172 +- components/modules/stats/BlocksFeed.vue | 15 +- components/modules/stats/ChartCardPreview.vue | 104 +- components/modules/stats/DiffChip.vue | 94 +- components/modules/stats/HighlightCard.vue | 9 +- components/modules/stats/InsightCard.vue | 84 +- components/modules/stats/LineChart.vue | 141 +- components/modules/stats/PieChartCard.vue | 274 +- .../modules/stats/RollupsBubbleChart.vue | 443 +- components/modules/stats/SquareSizeCard.vue | 41 +- components/modules/stats/SquareSizeChart.vue | 239 +- components/modules/stats/tabs/BlocksTab.vue | 3 +- components/modules/stats/tabs/GeneralTab.vue | 31 +- components/modules/stats/tabs/RollupsTab.vue | 6 +- components/modules/tx/MessagesTable.vue | 6 +- components/modules/tx/TxOverview.vue | 11 +- .../modules/validator/ValidatorOverview.vue | 15 +- .../validator/tables/DelegatorsTable.vue | 4 +- .../modules/validator/tables/JailsTable.vue | 2 +- components/shared/AdvBanner.vue | 4 +- components/shared/tables/Events.vue | 24 +- .../{Dropdown.vue => DropdownRoot.vue} | 16 +- components/ui/Dropdown/index.js | 2 +- components/ui/Input.vue | 4 +- components/ui/Modal.vue | 28 +- components/ui/Tooltip.vue | 4 +- components/widgets/BlobsWidget.vue | 20 +- components/widgets/BlockWidget.vue | 2 +- components/widgets/StakingWidget.vue | 8 +- components/widgets/TransactionsWidget.vue | 23 +- layouts/default.vue | 1 - nuxt.config.ts | 4 +- package.json | 3 +- pages/addresses.vue | 10 +- pages/blob.vue | 30 +- pages/blobstream.vue | 6 +- pages/blocks.vue | 4 +- pages/bookmarks.vue | 8 +- pages/calculators/savings.vue | 36 +- pages/gas.vue | 12 +- pages/index.vue | 2 +- pages/namespaces/index.vue | 6 +- pages/namespaces/treemap/index.vue | 2 + pages/rollups.vue | 8 +- pages/stats/[metric].vue | 124 +- pages/stats/index.vue | 8 +- pages/txs.vue | 29 +- pages/validators.vue | 4 +- plugins/globalFunctions.js | 13 +- pnpm-lock.yaml | 4588 ++++++++--------- server/tsconfig.json | 2 +- services/api/address.js | 4 +- services/api/blobstream.js | 4 +- services/api/block.js | 4 +- services/api/socket.js | 13 +- services/api/stats.js | 8 +- services/config.js | 2 +- services/constants/advertising.js | 56 +- services/constants/stats.js | 172 +- services/editor/creator.js | 4 +- services/keplr.js | 6 +- services/utils/amounts.js | 46 +- services/utils/d3.js | 6 +- services/utils/encode.js | 85 +- services/utils/general.js | 36 +- services/utils/strings.js | 12 +- services/utils/tree.js | 33 +- store/bookmarks.js | 71 +- store/modals.js | 20 +- tsconfig.json | 4 +- 116 files changed, 3956 insertions(+), 4401 deletions(-) create mode 100644 biome.json rename components/ui/Dropdown/{Dropdown.vue => DropdownRoot.vue} (95%) diff --git a/app.vue b/app.vue index 1585cfab..a5c91fdc 100644 --- a/app.vue +++ b/app.vue @@ -52,7 +52,7 @@ onMounted(async () => { const gasPrice = await fetchGasPrice() appStore.gas = gasPrice - window.onbeforeunload = function () { + window.onbeforeunload = () => { Socket.close() } }) diff --git a/assets/workers/worker.js b/assets/workers/worker.js index 78b946f9..c6b20522 100644 --- a/assets/workers/worker.js +++ b/assets/workers/worker.js @@ -1,7 +1,7 @@ import init, { run_worker } from "@/services/lumina-node-wasm/index.js" async function worker_main() { - let queued = [] + const queued = [] if (typeof SharedWorkerGlobalScope !== "undefined" && self instanceof SharedWorkerGlobalScope) { onconnect = (event) => { queued.push(event) diff --git a/biome.json b/biome.json new file mode 100644 index 00000000..e0146ca8 --- /dev/null +++ b/biome.json @@ -0,0 +1,55 @@ +{ + "$schema": "https://biomejs.dev/schemas/1.9.3/schema.json", + "vcs": { "enabled": false, "clientKind": "git", "useIgnoreFile": false }, + "files": { + "ignoreUnknown": false, + "ignore": [ + ".nuxt", + ".output", + "node_modules/**", + "dist/**", + "services/utils/msgpayforblobs.js", + "services/utils/blobtx.js", + "services/utils/blob.js", + "services/lumina-node-wasm", + "services/proto/gen" + ] + }, + "formatter": { + "enabled": true, + "useEditorconfig": true, + "formatWithErrors": false, + "indentStyle": "tab", + "indentWidth": 4, + "lineEnding": "lf", + "lineWidth": 140, + "attributePosition": "auto", + "bracketSpacing": true + }, + "organizeImports": { "enabled": false }, + "linter": { + "enabled": true, + "rules": { + "recommended": true, + "style": { "noParameterAssign": "off" }, + "performance": { + "noDelete": "info" + }, + "suspicious": { "noAsyncPromiseExecutor": "off", "noGlobalAssign": "off" }, + "complexity": { "noExtraBooleanCast": "off" } + } + }, + "javascript": { + "formatter": { + "jsxQuoteStyle": "double", + "quoteProperties": "asNeeded", + "trailingCommas": "all", + "semicolons": "asNeeded", + "arrowParentheses": "always", + "bracketSameLine": false, + "quoteStyle": "double", + "attributePosition": "auto", + "bracketSpacing": true + } + } +} diff --git a/components/AddressBadge.vue b/components/AddressBadge.vue index b32a4a17..28b3404e 100644 --- a/components/AddressBadge.vue +++ b/components/AddressBadge.vue @@ -6,14 +6,14 @@ const props = defineProps({ }, color: { type: String, - default: "primary" + default: "primary", }, }) const alias = computed(() => { const { $getDisplayName } = useNuxtApp() - return $getDisplayName('addresses', props.hash) + return $getDisplayName("addresses", props.hash) }) diff --git a/components/AmountInCurrency.vue b/components/AmountInCurrency.vue index 96157464..060634b7 100644 --- a/components/AmountInCurrency.vue +++ b/components/AmountInCurrency.vue @@ -50,7 +50,7 @@ const defaultCurrencyStyle = { } const calculatedAmount = computed(() => { - let finalAmount = { + const finalAmount = { amount: { ...defaultAmount, ...props.amount, @@ -74,12 +74,12 @@ const calculatedAmount = computed(() => { ...defaultCurrencyStyle, ...props.styles.currency, }, - } + }, } let tiaDisplay let tiaExchange - if (finalAmount.amount.unit === 'utia') { + if (finalAmount.amount.unit === "utia") { tiaExchange = finalAmount.amount.value / 1_000_000 if (finalAmount.amount.currency === "TIA") { @@ -92,7 +92,7 @@ const calculatedAmount = computed(() => { tiaExchange = finalAmount.amount.value } - let amountConverted = tiaExchange * (currentPrice.value?.close ? currentPrice.value.close : 0) + const amountConverted = tiaExchange * (currentPrice.value?.close ? currentPrice.value.close : 0) if (displayCurrency.value === "TIA") { finalAmount.display.show = { @@ -124,7 +124,7 @@ const calculatedAmount = computed(() => { {{ calculatedAmount.display.show.value }} @@ -142,7 +142,7 @@ const calculatedAmount = computed(() => { {{ calculatedAmount.display.tooltip.value }} diff --git a/components/BookmarkButton.vue b/components/BookmarkButton.vue index 12cf1f54..93bcaddb 100644 --- a/components/BookmarkButton.vue +++ b/components/BookmarkButton.vue @@ -39,8 +39,7 @@ const bookmarkText = computed(() => { const handleBookmark = () => { if (!isBookmarked.value) { - - let newBookmark = { + const newBookmark = { id: props.id, type: capitilize(props.type), ts: new Date().getTime(), @@ -70,7 +69,6 @@ const handleBookmark = () => { cacheStore.current.bookmark = newBookmark modalsStore.open("edit_alias") } - } else { let notification = {} @@ -87,7 +85,7 @@ const handleBookmark = () => { notification = { type: "error", icon: "close", - title: `Failed to remove the bookmark`, + title: "Failed to remove the bookmark", autoDestroy: true, } } @@ -99,9 +97,8 @@ const handleBookmark = () => { } onMounted(() => { - isBookmarked.value = bookmarksStore.getBookmark(props.type, props.id) ? true : false + isBookmarked.value = !!bookmarksStore.getBookmark(props.type, props.id) }) -