From f7fc208b15e6e48e8c428c407d1d2105d3f2ca24 Mon Sep 17 00:00:00 2001 From: "Calum H. (IMB11)" Date: Fri, 1 Aug 2025 15:03:08 +0100 Subject: [PATCH] chore: lint frontend --- apps/frontend/eslint.config.mjs | 8 +- apps/frontend/nuxt.config.ts | 384 ++++---- .../components/ui/EnvironmentIndicator.vue | 2 +- .../src/components/ui/ModalCreation.vue | 4 +- apps/frontend/src/components/ui/NavTabs.vue | 2 +- .../src/components/ui/NewsletterButton.vue | 44 +- .../src/components/ui/NotificationItem.vue | 25 +- .../src/components/ui/Notifications.vue | 61 +- .../src/components/ui/OptionGroup.vue | 2 +- .../components/ui/OrganizationCreateModal.vue | 2 +- .../ui/OrganizationProjectTransferModal.vue | 2 +- .../src/components/ui/ProjectCard.vue | 5 +- .../src/components/ui/ProjectMemberHeader.vue | 15 +- .../src/components/ui/charts/Chart.client.vue | 2 +- .../src/components/ui/charts/ChartDisplay.vue | 10 +- .../moderation/ModerationDelphiReportCard.vue | 22 +- .../ui/moderation/ModerationQueueCard.vue | 78 +- .../ui/moderation/ModerationReportCard.vue | 149 +-- .../checklist/ChecklistKeybindsModal.vue | 4 +- .../checklist/ModerationChecklist.vue | 846 +++++++++--------- .../checklist/ModpackPermissionsFlow.vue | 10 +- .../ui/modrinth-loading-indicator.ts | 1 + .../src/components/ui/news/LatestNewsRow.vue | 2 +- .../src/components/ui/report/ReportInfo.vue | 3 +- .../src/components/ui/report/ReportView.vue | 2 +- .../src/components/ui/report/ReportsList.vue | 1 + .../ui/servers/BackupCreateModal.vue | 7 +- .../ui/servers/BackupDeleteModal.vue | 3 +- .../src/components/ui/servers/BackupItem.vue | 24 +- .../ui/servers/BackupRenameModal.vue | 7 +- .../ui/servers/BackupRestoreModal.vue | 8 +- .../ui/servers/BackupSettingsModal.vue | 7 +- .../ui/servers/ContentVersionEditModal.vue | 11 +- .../ui/servers/ContentVersionFilter.vue | 8 +- .../src/components/ui/servers/FileItem.vue | 25 +- .../ui/servers/FileManagerError.vue | 15 +- .../components/ui/servers/FileVirtualList.vue | 2 +- .../ui/servers/FilesBrowseNavbar.vue | 71 +- .../ui/servers/FilesContextMenu.vue | 29 +- .../ui/servers/FilesCreateItemModal.vue | 2 +- .../ui/servers/FilesDeleteItemModal.vue | 2 +- .../ui/servers/FilesEditingNavbar.vue | 44 +- .../ui/servers/FilesImageViewer.vue | 2 +- .../ui/servers/FilesMoveItemModal.vue | 2 +- .../ui/servers/FilesRenameItemModal.vue | 2 +- .../ui/servers/FilesUploadConflictModal.vue | 2 +- .../ui/servers/FilesUploadDropdown.vue | 11 +- .../ui/servers/FilesUploadZipUrlModal.vue | 8 +- .../src/components/ui/servers/Globe.vue | 2 +- .../ui/servers/InstallingTicker.vue | 2 +- .../src/components/ui/servers/LogLine.vue | 2 +- .../ui/servers/PanelServerActionButton.vue | 20 +- .../ui/servers/PanelServerStatus.vue | 2 +- .../components/ui/servers/PanelTerminal.vue | 7 +- .../PlatformChangeModpackVersionModal.vue | 5 +- .../ui/servers/PlatformMrpackModal.vue | 13 +- .../ui/servers/PlatformVersionSelectModal.vue | 9 +- .../src/components/ui/servers/SaveBanner.vue | 3 +- .../ui/servers/ServerInstallation.vue | 93 +- .../components/ui/servers/ServerListing.vue | 5 +- .../components/ui/servers/ServerSidebar.vue | 3 +- .../src/components/ui/servers/ServerStats.vue | 6 +- .../ui/servers/TeleportDropdownMenu.vue | 411 +++++---- .../ui/servers/TeleportOverflowMenu.vue | 2 +- .../servers/marketing/ServerPlanSelector.vue | 2 +- .../ui/servers/notice/AssignNoticeModal.vue | 3 +- .../ui/servers/notice/NoticeDashboardItem.vue | 40 +- .../ui/thread/ConversationThread.vue | 167 ++-- .../src/components/ui/thread/ReportThread.vue | 138 +-- .../components/ui/thread/ThreadMessage.vue | 7 +- .../components/ui/thread/ThreadSummary.vue | 1 + apps/frontend/src/composables/country.ts | 2 +- .../frontend/src/composables/display-names.ts | 4 +- .../composables/servers/modrinth-servers.ts | 10 +- .../composables/servers/modules/backups.ts | 3 +- .../composables/servers/modules/content.ts | 3 +- .../src/composables/servers/modules/fs.ts | 5 +- .../composables/servers/modules/general.ts | 3 +- .../src/composables/servers/modules/index.ts | 2 +- .../composables/servers/modules/network.ts | 1 + .../composables/servers/modules/startup.ts | 3 +- .../src/composables/servers/modules/ws.ts | 1 + .../src/composables/servers/servers-fetch.ts | 4 +- apps/frontend/src/error.vue | 3 +- apps/frontend/src/helpers/highlight.js | 20 +- apps/frontend/src/helpers/infer.js | 6 +- apps/frontend/src/helpers/moderation.ts | 10 +- apps/frontend/src/helpers/package.js | 6 +- apps/frontend/src/layouts/default.vue | 72 +- apps/frontend/src/pages/[type]/[id].vue | 17 +- .../src/pages/[type]/[id]/changelog.vue | 4 +- .../src/pages/[type]/[id]/gallery.vue | 28 +- .../src/pages/[type]/[id]/moderation.vue | 3 +- .../[type]/[id]/settings/description.vue | 1 + .../src/pages/[type]/[id]/settings/index.vue | 5 +- .../pages/[type]/[id]/settings/license.vue | 30 +- .../src/pages/[type]/[id]/settings/links.vue | 2 +- .../pages/[type]/[id]/settings/members.vue | 17 +- .../src/pages/[type]/[id]/settings/tags.vue | 3 +- .../pages/[type]/[id]/version/[version].vue | 56 +- .../src/pages/[type]/[id]/versions.vue | 35 +- .../frontend/src/pages/admin/billing/[id].vue | 21 +- .../src/pages/admin/servers/notices.vue | 19 +- apps/frontend/src/pages/admin/user_email.vue | 2 +- apps/frontend/src/pages/app.vue | 16 +- apps/frontend/src/pages/auth/authorize.vue | 8 +- .../src/pages/auth/reset-password.vue | 3 +- apps/frontend/src/pages/auth/sign-in.vue | 15 +- apps/frontend/src/pages/auth/sign-up.vue | 15 +- apps/frontend/src/pages/auth/verify-email.vue | 2 +- apps/frontend/src/pages/auth/welcome.vue | 52 +- apps/frontend/src/pages/collection/[id].vue | 8 +- apps/frontend/src/pages/dashboard.vue | 13 +- .../src/pages/dashboard/collections.vue | 72 +- apps/frontend/src/pages/dashboard/index.vue | 1 + .../src/pages/dashboard/notifications.vue | 9 +- .../src/pages/dashboard/organizations.vue | 37 +- .../frontend/src/pages/dashboard/projects.vue | 184 ++-- .../src/pages/dashboard/revenue/transfers.vue | 101 +-- .../src/pages/dashboard/revenue/withdraw.vue | 13 +- apps/frontend/src/pages/flags.vue | 2 +- apps/frontend/src/pages/index.vue | 22 +- apps/frontend/src/pages/legal.vue | 7 +- apps/frontend/src/pages/legal/cmp-info.vue | 2 +- apps/frontend/src/pages/moderation.vue | 3 +- apps/frontend/src/pages/moderation/index.vue | 260 +++--- .../src/pages/moderation/reports/[id].vue | 3 +- .../src/pages/moderation/reports/index.vue | 225 +++-- .../moderation/technical-review-mockup.vue | 9 +- .../src/pages/news/article/[slug].vue | 11 +- .../pages/news/changelog/[product]/[date].vue | 4 +- .../src/pages/news/changelog/index.vue | 3 +- apps/frontend/src/pages/news/index.vue | 7 +- apps/frontend/src/pages/organization/[id].vue | 27 +- .../organization/[id]/settings/index.vue | 4 +- .../organization/[id]/settings/members.vue | 7 +- .../organization/[id]/settings/projects.vue | 14 +- apps/frontend/src/pages/plus.vue | 5 +- apps/frontend/src/pages/report.vue | 395 ++++---- .../src/pages/search/[searchProjectType].vue | 39 +- apps/frontend/src/pages/servers/index.vue | 13 +- .../src/pages/servers/manage/[id].vue | 42 +- .../src/pages/servers/manage/[id]/backups.vue | 13 +- .../src/pages/servers/manage/[id]/content.vue | 2 +- .../servers/manage/[id]/content/index.vue | 25 +- .../src/pages/servers/manage/[id]/files.vue | 22 +- .../src/pages/servers/manage/[id]/index.vue | 313 ++++--- .../src/pages/servers/manage/[id]/options.vue | 56 +- .../servers/manage/[id]/options/index.vue | 3 +- .../servers/manage/[id]/options/info.vue | 5 +- .../servers/manage/[id]/options/loader.vue | 4 +- .../servers/manage/[id]/options/network.vue | 17 +- .../manage/[id]/options/preferences.vue | 3 +- .../manage/[id]/options/properties.vue | 7 +- .../servers/manage/[id]/options/startup.vue | 5 +- .../src/pages/servers/manage/index.vue | 7 +- apps/frontend/src/pages/settings.vue | 11 +- apps/frontend/src/pages/settings/account.vue | 15 +- .../src/pages/settings/applications.vue | 16 +- .../src/pages/settings/authorizations.vue | 5 +- .../src/pages/settings/billing/charges.vue | 3 +- .../src/pages/settings/billing/index.vue | 49 +- apps/frontend/src/pages/settings/index.vue | 1 + apps/frontend/src/pages/settings/language.vue | 5 +- apps/frontend/src/pages/settings/pats.vue | 13 +- apps/frontend/src/pages/settings/profile.vue | 4 +- apps/frontend/src/pages/user/[id].vue | 251 +++--- apps/frontend/src/plugins/dayjs.js | 2 +- apps/frontend/src/plugins/floating-vue.js | 3 +- apps/frontend/src/plugins/theme/index.ts | 3 +- apps/frontend/src/store/moderation.ts | 2 +- apps/frontend/src/types/vintl.d.ts | 3 +- apps/frontend/src/utils/analytics.js | 7 +- apps/frontend/tailwind.config.ts | 232 ++--- packages/tooling-config/eslint/base.mjs | 1 + packages/tooling-config/eslint/nuxt.mjs | 17 +- 176 files changed, 3105 insertions(+), 2995 deletions(-) diff --git a/apps/frontend/eslint.config.mjs b/apps/frontend/eslint.config.mjs index 2ff2c4cf0..06f1344a9 100644 --- a/apps/frontend/eslint.config.mjs +++ b/apps/frontend/eslint.config.mjs @@ -1,2 +1,8 @@ import config from '@modrinth/tooling-config/eslint/nuxt.mjs' -export default config \ No newline at end of file +export default config.append([{ + rules: { + '@typescript-eslint/no-explicit-any': 'off', + "import/no-unresolved": "off", + 'no-undef': 'off' + } +}]) \ No newline at end of file diff --git a/apps/frontend/nuxt.config.ts b/apps/frontend/nuxt.config.ts index 354bff294..50f13c165 100644 --- a/apps/frontend/nuxt.config.ts +++ b/apps/frontend/nuxt.config.ts @@ -1,27 +1,28 @@ -import { promises as fs } from "fs"; -import { pathToFileURL } from "node:url"; -import svgLoader from "vite-svg-loader"; -import { resolve, basename, relative } from "pathe"; -import { defineNuxtConfig } from "nuxt/config"; -import { $fetch } from "ofetch"; -import { globIterate } from "glob"; -import { match as matchLocale } from "@formatjs/intl-localematcher"; -import { consola } from "consola"; +import { pathToFileURL } from 'node:url' -const STAGING_API_URL = "https://staging-api.modrinth.com/v2/"; +import { match as matchLocale } from '@formatjs/intl-localematcher' +import { consola } from 'consola' +import { promises as fs } from 'fs' +import { globIterate } from 'glob' +import { defineNuxtConfig } from 'nuxt/config' +import { $fetch } from 'ofetch' +import { basename, relative, resolve } from 'pathe' +import svgLoader from 'vite-svg-loader' + +const STAGING_API_URL = 'https://staging-api.modrinth.com/v2/' const preloadedFonts = [ - "inter/Inter-Regular.woff2", - "inter/Inter-Medium.woff2", - "inter/Inter-SemiBold.woff2", - "inter/Inter-Bold.woff2", -]; + 'inter/Inter-Regular.woff2', + 'inter/Inter-Medium.woff2', + 'inter/Inter-SemiBold.woff2', + 'inter/Inter-Bold.woff2', +] const favicons = { - "(prefers-color-scheme:no-preference)": "/favicon-light.ico", - "(prefers-color-scheme:light)": "/favicon-light.ico", - "(prefers-color-scheme:dark)": "/favicon.ico", -}; + '(prefers-color-scheme:no-preference)': '/favicon-light.ico', + '(prefers-color-scheme:light)': '/favicon-light.ico', + '(prefers-color-scheme:dark)': '/favicon.ico', +} /** * Tags of locales that are auto-discovered besides the default locale. @@ -29,52 +30,52 @@ const favicons = { * Preferably only the locales that reach a certain threshold of complete * translations would be included in this array. */ -const enabledLocales: string[] = []; +const enabledLocales: string[] = [] /** * Overrides for the categories of the certain locales. */ -const localesCategoriesOverrides: Partial> = { - "en-x-pirate": "fun", - "en-x-updown": "fun", - "en-x-lolcat": "fun", - "en-x-uwu": "fun", - "ru-x-bandit": "fun", - ar: "experimental", - he: "experimental", - pes: "experimental", -}; +const localesCategoriesOverrides: Partial> = { + 'en-x-pirate': 'fun', + 'en-x-updown': 'fun', + 'en-x-lolcat': 'fun', + 'en-x-uwu': 'fun', + 'ru-x-bandit': 'fun', + ar: 'experimental', + he: 'experimental', + pes: 'experimental', +} export default defineNuxtConfig({ - srcDir: "src/", + srcDir: 'src/', app: { head: { htmlAttrs: { - lang: "en", + lang: 'en', }, - title: "Modrinth", + title: 'Modrinth', link: [ // The type is necessary because the linter can't always compare this very nested/complex type on itself ...preloadedFonts.map((font): object => { return { - rel: "preload", + rel: 'preload', href: `https://cdn-raw.modrinth.com/fonts/${font}?v=3.19`, - as: "font", - type: "font/woff2", - crossorigin: "anonymous", - }; + as: 'font', + type: 'font/woff2', + crossorigin: 'anonymous', + } }), ...Object.entries(favicons).map(([media, href]): object => { - return { rel: "icon", type: "image/x-icon", href, media }; + return { rel: 'icon', type: 'image/x-icon', href, media } }), ...Object.entries(favicons).map(([media, href]): object => { - return { rel: "apple-touch-icon", type: "image/x-icon", href, media, sizes: "64x64" }; + return { rel: 'apple-touch-icon', type: 'image/x-icon', href, media, sizes: '64x64' } }), { - rel: "search", - type: "application/opensearchdescription+xml", - href: "/opensearch.xml", - title: "Modrinth mods", + rel: 'search', + type: 'application/opensearchdescription+xml', + href: '/opensearch.xml', + title: 'Modrinth mods', }, ], }, @@ -85,19 +86,19 @@ export default defineNuxtConfig({ }, esbuild: { define: { - global: "globalThis", + global: 'globalThis', }, }, - cacheDir: "../../node_modules/.vite/apps/knossos", + cacheDir: '../../node_modules/.vite/apps/knossos', resolve: { - dedupe: ["vue"], + dedupe: ['vue'], }, plugins: [ svgLoader({ svgoConfig: { plugins: [ { - name: "preset-default", + name: 'preset-default', params: { overrides: { removeViewBox: false, @@ -110,33 +111,33 @@ export default defineNuxtConfig({ ], }, hooks: { - async "build:before"() { + async 'build:before'() { // 30 minutes - const TTL = 30 * 60 * 1000; + const TTL = 30 * 60 * 1000 let state: { - lastGenerated?: string; - apiUrl?: string; - categories?: any[]; - loaders?: any[]; - gameVersions?: any[]; - donationPlatforms?: any[]; - reportTypes?: any[]; - homePageProjects?: any[]; - homePageSearch?: any[]; - homePageNotifs?: any[]; - products?: any[]; - errors?: number[]; - } = {}; + lastGenerated?: string + apiUrl?: string + categories?: any[] + loaders?: any[] + gameVersions?: any[] + donationPlatforms?: any[] + reportTypes?: any[] + homePageProjects?: any[] + homePageSearch?: any[] + homePageNotifs?: any[] + products?: any[] + errors?: number[] + } = {} try { - state = JSON.parse(await fs.readFile("./src/generated/state.json", "utf8")); + state = JSON.parse(await fs.readFile('./src/generated/state.json', 'utf8')) } catch { // File doesn't exist, create folder - await fs.mkdir("./src/generated", { recursive: true }); + await fs.mkdir('./src/generated', { recursive: true }) } - const API_URL = getApiUrl(); + const API_URL = getApiUrl() if ( // Skip regeneration if within TTL... @@ -145,25 +146,25 @@ export default defineNuxtConfig({ // ...but only if the API URL is the same state.apiUrl === API_URL ) { - return; + return } - state.lastGenerated = new Date().toISOString(); + state.lastGenerated = new Date().toISOString() - state.apiUrl = API_URL; + state.apiUrl = API_URL const headers = { headers: { - "user-agent": "Knossos generator (support@modrinth.com)", + 'user-agent': 'Knossos generator (support@modrinth.com)', }, - }; + } - const caughtErrorCodes = new Set(); + const caughtErrorCodes = new Set() function handleFetchError(err: any, defaultValue: any) { - console.error("Error generating state: ", err); - caughtErrorCodes.add(err.status); - return defaultValue; + console.error('Error generating state: ', err) + caughtErrorCodes.add(err.status) + return defaultValue } const [ @@ -193,152 +194,152 @@ export default defineNuxtConfig({ $fetch(`${API_URL}search?limit=3&query=&index=updated`, headers).catch((err) => handleFetchError(err, {}), ), - $fetch(`${API_URL.replace("/v2/", "/_internal/")}billing/products`, headers).catch((err) => + $fetch(`${API_URL.replace('/v2/', '/_internal/')}billing/products`, headers).catch((err) => handleFetchError(err, []), ), - ]); + ]) - state.categories = categories; - state.loaders = loaders; - state.gameVersions = gameVersions; - state.donationPlatforms = donationPlatforms; - state.reportTypes = reportTypes; - state.homePageProjects = homePageProjects; - state.homePageSearch = homePageSearch; - state.homePageNotifs = homePageNotifs; - state.products = products; - state.errors = [...caughtErrorCodes]; + state.categories = categories + state.loaders = loaders + state.gameVersions = gameVersions + state.donationPlatforms = donationPlatforms + state.reportTypes = reportTypes + state.homePageProjects = homePageProjects + state.homePageSearch = homePageSearch + state.homePageNotifs = homePageNotifs + state.products = products + state.errors = [...caughtErrorCodes] - await fs.writeFile("./src/generated/state.json", JSON.stringify(state)); + await fs.writeFile('./src/generated/state.json', JSON.stringify(state)) - console.log("Tags generated!"); + console.log('Tags generated!') }, - "pages:extend"(routes) { + 'pages:extend'(routes) { routes.splice( - routes.findIndex((x) => x.name === "search-searchProjectType"), + routes.findIndex((x) => x.name === 'search-searchProjectType'), 1, - ); + ) - const types = ["mods", "modpacks", "plugins", "resourcepacks", "shaders", "datapacks"]; + const types = ['mods', 'modpacks', 'plugins', 'resourcepacks', 'shaders', 'datapacks'] types.forEach((type) => routes.push({ name: `search-${type}`, path: `/${type}`, - file: resolve(__dirname, "src/pages/search/[searchProjectType].vue"), + file: resolve(__dirname, 'src/pages/search/[searchProjectType].vue'), children: [], }), - ); + ) }, - async "vintl:extendOptions"(opts) { - opts.locales ??= []; + async 'vintl:extendOptions'(opts) { + opts.locales ??= [] - const isProduction = getDomain() === "https://modrinth.com"; + const isProduction = getDomain() === 'https://modrinth.com' const resolveCompactNumberDataImport = await (async () => { - const compactNumberLocales: string[] = []; + const compactNumberLocales: string[] = [] for await (const localeFile of globIterate( - "node_modules/@vintl/compact-number/dist/locale-data/*.mjs", - { ignore: "**/*.data.mjs" }, + 'node_modules/@vintl/compact-number/dist/locale-data/*.mjs', + { ignore: '**/*.data.mjs' }, )) { - const tag = basename(localeFile, ".mjs"); - compactNumberLocales.push(tag); + const tag = basename(localeFile, '.mjs') + compactNumberLocales.push(tag) } function resolveImport(tag: string) { - const matchedTag = matchLocale([tag], compactNumberLocales, "en-x-placeholder"); - return matchedTag === "en-x-placeholder" + const matchedTag = matchLocale([tag], compactNumberLocales, 'en-x-placeholder') + return matchedTag === 'en-x-placeholder' ? undefined - : `@vintl/compact-number/locale-data/${matchedTag}`; + : `@vintl/compact-number/locale-data/${matchedTag}` } - return resolveImport; - })(); + return resolveImport + })() const resolveOmorphiaLocaleImport = await (async () => { - const omorphiaLocales: string[] = []; - const omorphiaLocaleSets = new Map(); + const omorphiaLocales: string[] = [] + const omorphiaLocaleSets = new Map() - for await (const localeDir of globIterate("node_modules/@modrinth/ui/src/locales/*", { + for await (const localeDir of globIterate('node_modules/@modrinth/ui/src/locales/*', { posix: true, })) { - const tag = basename(localeDir); - omorphiaLocales.push(tag); + const tag = basename(localeDir) + omorphiaLocales.push(tag) - const localeFiles: { from: string; format?: string }[] = []; + const localeFiles: { from: string; format?: string }[] = [] - omorphiaLocaleSets.set(tag, { files: localeFiles }); + omorphiaLocaleSets.set(tag, { files: localeFiles }) for await (const localeFile of globIterate(`${localeDir}/*`, { posix: true })) { localeFiles.push({ from: pathToFileURL(localeFile).toString(), - format: "default", - }); + format: 'default', + }) } } return function resolveLocaleImport(tag: string) { - return omorphiaLocaleSets.get(matchLocale([tag], omorphiaLocales, "en-x-placeholder")); - }; - })(); + return omorphiaLocaleSets.get(matchLocale([tag], omorphiaLocales, 'en-x-placeholder')) + } + })() - for await (const localeDir of globIterate("src/locales/*/", { posix: true })) { - const tag = basename(localeDir); - if (isProduction && !enabledLocales.includes(tag) && opts.defaultLocale !== tag) continue; + for await (const localeDir of globIterate('src/locales/*/', { posix: true })) { + const tag = basename(localeDir) + if (isProduction && !enabledLocales.includes(tag) && opts.defaultLocale !== tag) continue const locale = opts.locales.find((locale) => locale.tag === tag) ?? - opts.locales[opts.locales.push({ tag }) - 1]!; + opts.locales[opts.locales.push({ tag }) - 1]! - const localeFiles = (locale.files ??= []); + const localeFiles = (locale.files ??= []) for await (const localeFile of globIterate(`${localeDir}/*`, { posix: true })) { - const fileName = basename(localeFile); - if (fileName === "index.json") { + const fileName = basename(localeFile) + if (fileName === 'index.json') { localeFiles.push({ - from: `./${relative("./src", localeFile)}`, - format: "crowdin", - }); - } else if (fileName === "meta.json") { + from: `./${relative('./src', localeFile)}`, + format: 'crowdin', + }) + } else if (fileName === 'meta.json') { const meta: Record = await fs - .readFile(localeFile, "utf8") - .then((date) => JSON.parse(date)); - const localeMeta = (locale.meta ??= {}); + .readFile(localeFile, 'utf8') + .then((date) => JSON.parse(date)) + const localeMeta = (locale.meta ??= {}) for (const key in meta) { - const value = meta[key]; - if (value === undefined) continue; - localeMeta[key] = value.message; + const value = meta[key] + if (value === undefined) continue + localeMeta[key] = value.message } } else { - (locale.resources ??= {})[fileName] = `./${relative("./src", localeFile)}`; + ;(locale.resources ??= {})[fileName] = `./${relative('./src', localeFile)}` } } - const categoryOverride = localesCategoriesOverrides[tag]; + const categoryOverride = localesCategoriesOverrides[tag] if (categoryOverride != null) { - (locale.meta ??= {}).category = categoryOverride; + ;(locale.meta ??= {}).category = categoryOverride } - const omorphiaLocaleData = resolveOmorphiaLocaleImport(tag); + const omorphiaLocaleData = resolveOmorphiaLocaleImport(tag) if (omorphiaLocaleData != null) { - localeFiles.push(...omorphiaLocaleData.files); + localeFiles.push(...omorphiaLocaleData.files) } - const cnDataImport = resolveCompactNumberDataImport(tag); + const cnDataImport = resolveCompactNumberDataImport(tag) if (cnDataImport != null) { - (locale.additionalImports ??= []).push({ + ;(locale.additionalImports ??= []).push({ from: cnDataImport, resolve: false, - }); + }) } } }, }, runtimeConfig: { - // @ts-ignore + // @ts-expect-error apiBaseUrl: process.env.BASE_URL ?? globalThis.BASE_URL ?? getApiUrl(), - // @ts-ignore + // @ts-expect-error rateLimitKey: process.env.RATE_LIMIT_IGNORE_KEY ?? globalThis.RATE_LIMIT_IGNORE_KEY, pyroBaseUrl: process.env.PYRO_BASE_URL, public: { @@ -348,25 +349,26 @@ export default defineNuxtConfig({ production: isProduction(), featureFlagOverrides: getFeatureFlagOverrides(), - owner: process.env.VERCEL_GIT_REPO_OWNER || "modrinth", - slug: process.env.VERCEL_GIT_REPO_SLUG || "code", + owner: process.env.VERCEL_GIT_REPO_OWNER || 'modrinth', + slug: process.env.VERCEL_GIT_REPO_SLUG || 'code', branch: process.env.VERCEL_GIT_COMMIT_REF || process.env.CF_PAGES_BRANCH || - // @ts-ignore + // @ts-expect-error globalThis.CF_PAGES_BRANCH || - "master", + 'master', hash: process.env.VERCEL_GIT_COMMIT_SHA || process.env.CF_PAGES_COMMIT_SHA || - // @ts-ignore + // @ts-expect-error globalThis.CF_PAGES_COMMIT_SHA || - "unknown", + 'unknown', stripePublishableKey: process.env.STRIPE_PUBLISHABLE_KEY || + // @ts-expect-error globalThis.STRIPE_PUBLISHABLE_KEY || - "pk_test_51JbFxJJygY5LJFfKV50mnXzz3YLvBVe2Gd1jn7ljWAkaBlRz3VQdxN9mXcPSrFbSqxwAb0svte9yhnsmm7qHfcWn00R611Ce7b", + 'pk_test_51JbFxJJygY5LJFfKV50mnXzz3YLvBVe2Gd1jn7ljWAkaBlRz3VQdxN9mXcPSrFbSqxwAb0svte9yhnsmm7qHfcWn00R611Ce7b', }, }, typescript: { @@ -375,62 +377,62 @@ export default defineNuxtConfig({ typeCheck: false, tsConfig: { compilerOptions: { - moduleResolution: "bundler", + moduleResolution: 'bundler', allowImportingTsExtensions: true, }, }, }, - modules: ["@vintl/nuxt", "@pinia/nuxt"], + modules: ['@vintl/nuxt', '@pinia/nuxt'], vintl: { - defaultLocale: "en-US", + defaultLocale: 'en-US', locales: [ { - tag: "en-US", + tag: 'en-US', meta: { static: { - iso: "en", + iso: 'en', }, }, }, ], - storage: "cookie", - parserless: "only-prod", + storage: 'cookie', + parserless: 'only-prod', seo: { defaultLocaleHasParameter: false, }, onParseError({ error, message, messageId, moduleId, parseMessage, parserOptions }) { - const errorMessage = String(error); - const modulePath = relative(__dirname, moduleId); + const errorMessage = String(error) + const modulePath = relative(__dirname, moduleId) try { - const fallback = parseMessage(message, { ...parserOptions, ignoreTag: true }); + const fallback = parseMessage(message, { ...parserOptions, ignoreTag: true }) consola.warn( `[i18n] ${messageId} in ${modulePath} cannot be parsed normally due to ${errorMessage}. The tags will will not be parsed.`, - ); + ) - return fallback; + return fallback } catch (err) { - const secondaryErrorMessage = String(err); + const secondaryErrorMessage = String(err) const reason = errorMessage === secondaryErrorMessage ? errorMessage - : `${errorMessage} and ${secondaryErrorMessage}`; + : `${errorMessage} and ${secondaryErrorMessage}` consola.warn( `[i18n] ${messageId} in ${modulePath} cannot be parsed due to ${reason}. It will be skipped.`, - ); + ) } }, }, nitro: { - moduleSideEffects: ["@vintl/compact-number/locale-data"], + moduleSideEffects: ['@vintl/compact-number/locale-data'], }, devtools: { enabled: true, }, - css: ["~/assets/styles/tailwind.css"], + css: ['~/assets/styles/tailwind.css'], postcss: { plugins: { tailwindcss: {}, @@ -438,50 +440,50 @@ export default defineNuxtConfig({ }, }, routeRules: { - "/**": { + '/**': { headers: { - "Accept-CH": "Sec-CH-Prefers-Color-Scheme", - "Critical-CH": "Sec-CH-Prefers-Color-Scheme", + 'Accept-CH': 'Sec-CH-Prefers-Color-Scheme', + 'Critical-CH': 'Sec-CH-Prefers-Color-Scheme', }, }, }, - compatibilityDate: "2024-07-03", + compatibilityDate: '2024-07-03', telemetry: false, -}); +}) function getApiUrl() { - // @ts-ignore - return process.env.BROWSER_BASE_URL ?? globalThis.BROWSER_BASE_URL ?? STAGING_API_URL; + // @ts-expect-error + return process.env.BROWSER_BASE_URL ?? globalThis.BROWSER_BASE_URL ?? STAGING_API_URL } function isProduction() { - return process.env.NODE_ENV === "production"; + return process.env.NODE_ENV === 'production' } function getFeatureFlagOverrides() { - return JSON.parse(process.env.FLAG_OVERRIDES ?? "{}"); + return JSON.parse(process.env.FLAG_OVERRIDES ?? '{}') } function getDomain() { - if (process.env.NODE_ENV === "production") { + if (process.env.NODE_ENV === 'production') { if (process.env.SITE_URL) { - return process.env.SITE_URL; + return process.env.SITE_URL } - // @ts-ignore + // @ts-expect-error else if (process.env.CF_PAGES_URL || globalThis.CF_PAGES_URL) { - // @ts-ignore - return process.env.CF_PAGES_URL ?? globalThis.CF_PAGES_URL; + // @ts-expect-error + return process.env.CF_PAGES_URL ?? globalThis.CF_PAGES_URL } else if (process.env.HEROKU_APP_NAME) { - return `https://${process.env.HEROKU_APP_NAME}.herokuapp.com`; + return `https://${process.env.HEROKU_APP_NAME}.herokuapp.com` } else if (process.env.VERCEL_URL) { - return `https://${process.env.VERCEL_URL}`; + return `https://${process.env.VERCEL_URL}` } else if (getApiUrl() === STAGING_API_URL) { - return "https://staging.modrinth.com"; + return 'https://staging.modrinth.com' } else { - return "https://modrinth.com"; + return 'https://modrinth.com' } } else { - const port = process.env.PORT || 3000; - return `http://localhost:${port}`; + const port = process.env.PORT || 3000 + return `http://localhost:${port}` } } diff --git a/apps/frontend/src/components/ui/EnvironmentIndicator.vue b/apps/frontend/src/components/ui/EnvironmentIndicator.vue index 84254dde6..5cdf0ae79 100644 --- a/apps/frontend/src/components/ui/EnvironmentIndicator.vue +++ b/apps/frontend/src/components/ui/EnvironmentIndicator.vue @@ -49,7 +49,7 @@ diff --git a/apps/frontend/src/components/ui/NotificationItem.vue b/apps/frontend/src/components/ui/NotificationItem.vue index 4a293684a..1b8672e87 100644 --- a/apps/frontend/src/components/ui/NotificationItem.vue +++ b/apps/frontend/src/components/ui/NotificationItem.vue @@ -319,26 +319,27 @@ diff --git a/apps/frontend/src/components/ui/moderation/checklist/ChecklistKeybindsModal.vue b/apps/frontend/src/components/ui/moderation/checklist/ChecklistKeybindsModal.vue index db8b931ba..53e491df9 100644 --- a/apps/frontend/src/components/ui/moderation/checklist/ChecklistKeybindsModal.vue +++ b/apps/frontend/src/components/ui/moderation/checklist/ChecklistKeybindsModal.vue @@ -29,9 +29,9 @@