From 82828a15851961081293a64f140c0aa299e969a8 Mon Sep 17 00:00:00 2001 From: nakasyou Date: Mon, 15 Jul 2024 18:28:37 +0900 Subject: [PATCH] chore: format code --- .../ai-quiz/components/InitialScreen.qwik.tsx | 4 +- src/islands/note/utils/file-format/index.ts | 6 ++- src/types.d.ts | 8 +++- src/utils/google-oauth/index.ts | 44 +++++++++---------- tsconfig.json | 5 +-- 5 files changed, 37 insertions(+), 30 deletions(-) diff --git a/src/islands/ai-quiz/components/InitialScreen.qwik.tsx b/src/islands/ai-quiz/components/InitialScreen.qwik.tsx index 07c71ddd..a5738bdf 100644 --- a/src/islands/ai-quiz/components/InitialScreen.qwik.tsx +++ b/src/islands/ai-quiz/components/InitialScreen.qwik.tsx @@ -58,7 +58,9 @@ export const InitialScreen = component$(() => { } screenState.note = noSerialize({ name: gotNote.name, - notes: loaded.notes.filter((note): note is TextNoteData => note.type === 'text'), + notes: loaded.notes.filter( + (note): note is TextNoteData => note.type === 'text', + ), }) stateToLoad.value = { type: 'success', diff --git a/src/islands/note/utils/file-format/index.ts b/src/islands/note/utils/file-format/index.ts index 9a687cb6..7f4d22bf 100644 --- a/src/islands/note/utils/file-format/index.ts +++ b/src/islands/note/utils/file-format/index.ts @@ -1,5 +1,9 @@ import { zipSync, zip, unzipSync, type Unzipped } from 'fflate' -import type { MargedNoteData, Note, NoteData } from '../../components/notes-utils' +import type { + MargedNoteData, + Note, + NoteData, +} from '../../components/notes-utils' import { manifest0, note0, type Manifest0, type Note0 } from './manifest-schema' import { parse, type InferOutput } from 'valibot' interface FileTree { diff --git a/src/types.d.ts b/src/types.d.ts index 8207d343..ed091b15 100644 --- a/src/types.d.ts +++ b/src/types.d.ts @@ -1,4 +1,8 @@ declare module 'fs-move' { - declare const defaultExport: (i: string, o: string, opt: unknown) => Promise + declare const defaultExport: ( + i: string, + o: string, + opt: unknown, + ) => Promise export default defaultExport -} \ No newline at end of file +} diff --git a/src/utils/google-oauth/index.ts b/src/utils/google-oauth/index.ts index 30bac090..f9fb8b8e 100644 --- a/src/utils/google-oauth/index.ts +++ b/src/utils/google-oauth/index.ts @@ -96,32 +96,32 @@ type FetchResult> = { } ) const makeFetchAPIFunc = // biome-ignore lint/suspicious/noExplicitAny: BaseSchema - >(scope: string, schema: Schema) => - async (accessToken: string): Promise> => { - const token = `Bearer ${accessToken}` - const req = new Request(scope, { - headers: { - 'x-goog-api-client': 'gdcl/7.0.1 gl-node/20.11.0', - 'Accept-Encoding': 'gzip', - 'User-Agent': 'google-api-nodejs-client/7.0.1 (gzip)', - Authorization: token, - }, - }) - const res = await fetch(req) - const result = await res.json() - const parsed = safeParse(schema, result) - if (parsed.success) { + >(scope: string, schema: Schema) => + async (accessToken: string): Promise> => { + const token = `Bearer ${accessToken}` + const req = new Request(scope, { + headers: { + 'x-goog-api-client': 'gdcl/7.0.1 gl-node/20.11.0', + 'Accept-Encoding': 'gzip', + 'User-Agent': 'google-api-nodejs-client/7.0.1 (gzip)', + Authorization: token, + }, + }) + const res = await fetch(req) + const result = await res.json() + const parsed = safeParse(schema, result) + if (parsed.success) { + return { + success: true, + data: result, + response: res, + } + } return { - success: true, - data: result, + success: false, response: res, } } - return { - success: false, - response: res, - } - } export const fetchUserInfo = makeFetchAPIFunc( 'https://www.googleapis.com/oauth2/v2/userinfo', object({ diff --git a/tsconfig.json b/tsconfig.json index bb29c438..a608cda6 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -7,8 +7,5 @@ "types": ["bun-types"], "noUncheckedIndexedAccess": true }, - "exclude": [ - "dist", - "./node_modules/@qwikdev/astro/**/*", - ] + "exclude": ["dist", "./node_modules/@qwikdev/astro/**/*"] }