From 16b446201413d7d89c80e00f63a523003b5c2700 Mon Sep 17 00:00:00 2001 From: Ame_x <121654029+EdamAme-x@users.noreply.github.com> Date: Wed, 29 May 2024 03:40:21 +0000 Subject: [PATCH] chore: format (includes other middleware) --- packages/auth-js/src/client.ts | 11 +++++------ packages/auth-js/src/index.ts | 4 ++-- packages/auth-js/test/index.test.ts | 4 ++-- packages/node-ws/src/index.ts | 2 +- packages/valibot-validator/test/index.test.ts | 11 ++++++++++- 5 files changed, 20 insertions(+), 12 deletions(-) diff --git a/packages/auth-js/src/client.ts b/packages/auth-js/src/client.ts index 36e979cf..8af7a08e 100644 --- a/packages/auth-js/src/client.ts +++ b/packages/auth-js/src/client.ts @@ -66,7 +66,6 @@ export interface SignOutParams { redirect?: R } - export interface SessionProviderProps { children: React.ReactNode session?: Session | null @@ -136,11 +135,11 @@ export function now() { } export function parseUrl(url?: string) { - const defaultUrl = 'http://localhost:3000/api/auth'; - const parsedUrl = new URL(url?.startsWith('http') ? url : `https://${url}` || defaultUrl); + const defaultUrl = 'http://localhost:3000/api/auth' + const parsedUrl = new URL(url?.startsWith('http') ? url : `https://${url}` || defaultUrl) - const path = parsedUrl.pathname === '/' ? '/api/auth' : parsedUrl.pathname.replace(/\/$/, ''); - const base = `${parsedUrl.origin}${path}`; + const path = parsedUrl.pathname === '/' ? '/api/auth' : parsedUrl.pathname.replace(/\/$/, '') + const base = `${parsedUrl.origin}${path}` return { origin: parsedUrl.origin, @@ -148,5 +147,5 @@ export function parseUrl(url?: string) { path, base, toString: () => base, - }; + } } diff --git a/packages/auth-js/src/index.ts b/packages/auth-js/src/index.ts index 9e9baeed..ba4a2987 100644 --- a/packages/auth-js/src/index.ts +++ b/packages/auth-js/src/index.ts @@ -118,7 +118,7 @@ export function authHandler(): MiddlewareHandler { return async (c) => { const config = c.get('authConfig') let ctxEnv = env(c) as AuthEnv - + setEnvDefaults(ctxEnv, config) if (!config.secret || config.secret.length === 0) { @@ -128,4 +128,4 @@ export function authHandler(): MiddlewareHandler { const res = await Auth(reqWithEnvUrl(c.req.raw, ctxEnv.AUTH_URL), config) return new Response(res.body, res) } -} \ No newline at end of file +} diff --git a/packages/auth-js/test/index.test.ts b/packages/auth-js/test/index.test.ts index 09ecea4b..c251530b 100644 --- a/packages/auth-js/test/index.test.ts +++ b/packages/auth-js/test/index.test.ts @@ -192,8 +192,8 @@ describe('Credentials Provider', () => { it('Should respect x-forwarded-proto and x-forwarded-host', async () => { const headers = new Headers() - headers.append('x-forwarded-proto', "https") - headers.append('x-forwarded-host', "example.com") + headers.append('x-forwarded-proto', 'https') + headers.append('x-forwarded-host', 'example.com') const res = await app.request('http://localhost/api/auth/signin', { headers, }) diff --git a/packages/node-ws/src/index.ts b/packages/node-ws/src/index.ts index 34c4b1f0..0c696a58 100644 --- a/packages/node-ws/src/index.ts +++ b/packages/node-ws/src/index.ts @@ -20,7 +20,7 @@ export interface NodeWebSocketInit { * @returns NodeWebSocket */ export const createNodeWebSocket = (init: NodeWebSocketInit): NodeWebSocket => { - const wss = new WebSocketServer({noServer: true}) + const wss = new WebSocketServer({ noServer: true }) return { injectWebSocket(server) { diff --git a/packages/valibot-validator/test/index.test.ts b/packages/valibot-validator/test/index.test.ts index fd719c4a..1caf29ec 100644 --- a/packages/valibot-validator/test/index.test.ts +++ b/packages/valibot-validator/test/index.test.ts @@ -1,6 +1,15 @@ import { Hono } from 'hono' import type { Equal, Expect } from 'hono/utils/types' -import { number, object, string, optional, numberAsync, objectAsync, stringAsync, optionalAsync } from 'valibot' +import { + number, + object, + string, + optional, + numberAsync, + objectAsync, + stringAsync, + optionalAsync, +} from 'valibot' import { vValidator } from '../src' // eslint-disable-next-line @typescript-eslint/no-unused-vars