Skip to content

Commit

Permalink
chore: format code
Browse files Browse the repository at this point in the history
  • Loading branch information
nakasyou committed Jul 15, 2024
1 parent 8e2a454 commit 82828a1
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 30 deletions.
4 changes: 3 additions & 1 deletion src/islands/ai-quiz/components/InitialScreen.qwik.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
6 changes: 5 additions & 1 deletion src/islands/note/utils/file-format/index.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
8 changes: 6 additions & 2 deletions src/types.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
declare module 'fs-move' {
declare const defaultExport: (i: string, o: string, opt: unknown) => Promise<void>
declare const defaultExport: (
i: string,
o: string,
opt: unknown,
) => Promise<void>
export default defaultExport
}
}
44 changes: 22 additions & 22 deletions src/utils/google-oauth/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,32 +96,32 @@ type FetchResult<Schema extends BaseSchema<any, any, any>> = {
}
)
const makeFetchAPIFunc = // biome-ignore lint/suspicious/noExplicitAny: BaseSchema
<Schema extends BaseSchema<any, any, any>>(scope: string, schema: Schema) =>
async (accessToken: string): Promise<FetchResult<Schema>> => {
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) {
<Schema extends BaseSchema<any, any, any>>(scope: string, schema: Schema) =>
async (accessToken: string): Promise<FetchResult<Schema>> => {
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({
Expand Down
5 changes: 1 addition & 4 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,5 @@
"types": ["bun-types"],
"noUncheckedIndexedAccess": true
},
"exclude": [
"dist",
"./node_modules/@qwikdev/astro/**/*",
]
"exclude": ["dist", "./node_modules/@qwikdev/astro/**/*"]
}

0 comments on commit 82828a1

Please sign in to comment.