From 2ff6c397460fc310bb16810f943837320f97bead Mon Sep 17 00:00:00 2001 From: Aaron Klinker Date: Thu, 15 Feb 2024 16:03:05 -0600 Subject: [PATCH] chore: Update formatting --- src/apis/firefox-api.ts | 6 +++--- src/crawlers/chrome-crawler.ts | 10 +++++----- src/graphql.ts | 8 ++++---- src/public/playground.html | 4 ++-- src/server.ts | 6 +++--- src/services/chrome-service.ts | 2 +- src/utils/cache.ts | 2 +- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/apis/firefox-api.ts b/src/apis/firefox-api.ts index 3ab2786..0a0b2fd 100644 --- a/src/apis/firefox-api.ts +++ b/src/apis/firefox-api.ts @@ -3,16 +3,16 @@ import consola from "consola"; export function createFirefoxApiClient() { return { getAddon: async ( - idOrSlugOrGuid: number | string + idOrSlugOrGuid: number | string, ): Promise => { consola.info("Fetching " + idOrSlugOrGuid); const url = new URL( - `https://addons.mozilla.org/api/v5/addons/addon/${idOrSlugOrGuid}` + `https://addons.mozilla.org/api/v5/addons/addon/${idOrSlugOrGuid}`, ); const res = await fetch(url); if (res.status !== 200) throw Error( - `${url.href} failed with status: ${res.status} ${res.statusText}` + `${url.href} failed with status: ${res.status} ${res.statusText}`, ); const json = await res.json(); diff --git a/src/crawlers/chrome-crawler.ts b/src/crawlers/chrome-crawler.ts index e1eb630..311d35f 100644 --- a/src/crawlers/chrome-crawler.ts +++ b/src/crawlers/chrome-crawler.ts @@ -3,7 +3,7 @@ import { HTMLAnchorElement, HTMLElement, parseHTML } from "linkedom"; export async function crawlExtension( id: string, - lang: string + lang: string, ): Promise { consola.info("Crawling " + id); const url = `https://chromewebstore.google.com/detail/${id}?hl=${lang}`; @@ -28,13 +28,13 @@ export async function crawlExtension( const storeUrl = metaContent(document, "property=og:url"); const iconUrl = metaContent(document, "property=og:image")?.replace( /=.+?$/, - "=s256" + "=s256", ); const shortDescription = metaContent(document, "property=og:description"); // Grab the main sections that contain content const sections = (document as HTMLElement).querySelectorAll( - "main > * > section" + "main > * > section", ); const header: HTMLElement = sections[0]; const description: HTMLElement = sections[2]; @@ -69,10 +69,10 @@ export async function crawlExtension( // // const ratingRow = header.querySelector( - "div:first-child > div:nth-child(2) > span:last-child" + "div:first-child > div:nth-child(2) > span:last-child", ); const rating = extractNumber( - ratingRow.querySelector("span:first-child > span:first-child").textContent + ratingRow.querySelector("span:first-child > span:first-child").textContent, ); const reviewCount = extractNumber(ratingRow.querySelector("p").textContent); diff --git a/src/graphql.ts b/src/graphql.ts index b80dfbb..adab7f7 100644 --- a/src/graphql.ts +++ b/src/graphql.ts @@ -21,8 +21,8 @@ export function createGraphql(ctx: WxtQueueCtx) { const start = performance.now(); consola.debug( `${pc.dim(`←-- [${id}]`)} ${pc.green(method)} ${pc.cyan( - pc.bold(operationName) - )}` + pc.bold(operationName), + )}`, ); const response = await graphql({ @@ -36,8 +36,8 @@ export function createGraphql(ctx: WxtQueueCtx) { const end = performance.now(); consola.debug( `${pc.dim(`--→ [${id}]`)} ${pc.green(method)} ${pc.cyan( - pc.bold(operationName) - )} ${(end - start).toFixed(3)}ms` + pc.bold(operationName), + )} ${(end - start).toFixed(3)}ms`, ); return response; diff --git a/src/public/playground.html b/src/public/playground.html index 7acfcce..86f44a2 100644 --- a/src/public/playground.html +++ b/src/public/playground.html @@ -1,4 +1,4 @@ - + Playground - wxt-queue v{{VERSION}} @@ -50,7 +50,7 @@ fetcher, defaultEditorToolsVisibility: true, plugins: [explorerPlugin], - }) + }), ); diff --git a/src/server.ts b/src/server.ts index bc357b1..db1cf02 100644 --- a/src/server.ts +++ b/src/server.ts @@ -8,7 +8,7 @@ import { createFirefoxService } from "./services/firefox-service"; const playgroundHtml = playgroundHtmlTemplate.replace( "{{VERSION}}", - pkg.version + pkg.version, ); export function createServer(config?: ServerConfig) { @@ -62,7 +62,7 @@ export function createServer(config?: ServerConfig) { }); consola.info( - `${pc.cyan("store-api v" + pkg.version)} ${pc.dim("server started")}` + `${pc.cyan("store-api v" + pkg.version)} ${pc.dim("server started")}`, ); consola.log(` ${pc.bold(pc.green("➜"))} http://localhost:${port}`); console.log(); @@ -98,7 +98,7 @@ function createResponse( | FormData | URLSearchParams | null, - options?: ResponseInit + options?: ResponseInit, ) { const res = new Response(body, options); res.headers.set("Access-Control-Allow-Origin", "*"); diff --git a/src/services/chrome-service.ts b/src/services/chrome-service.ts index 3346c94..1e70ba2 100644 --- a/src/services/chrome-service.ts +++ b/src/services/chrome-service.ts @@ -7,7 +7,7 @@ export function createChromeService() { string, Gql.ChromeExtension | undefined >(DAY_MS, (ids) => - Promise.all(ids.map((id) => chrome.crawlExtension(id, "en"))) + Promise.all(ids.map((id) => chrome.crawlExtension(id, "en"))), ); return { diff --git a/src/utils/cache.ts b/src/utils/cache.ts index 346a628..fa25f6f 100644 --- a/src/utils/cache.ts +++ b/src/utils/cache.ts @@ -33,7 +33,7 @@ interface CacheEntry { export function createCachedDataLoader( ttl: number, - batchLoadFn: DataLoader.BatchLoadFn + batchLoadFn: DataLoader.BatchLoadFn, ) { return new DataLoader(batchLoadFn, { cacheMap: createInMemoryCache({ ttl }),