From 98688feea371b0d95616be272a54d9824b609f54 Mon Sep 17 00:00:00 2001 From: Yusuke Wada Date: Sun, 26 May 2024 05:05:09 +0900 Subject: [PATCH 1/2] chore(lint): update eslint rules --- bun.lockb | Bin 345115 -> 345115 bytes package.json | 2 +- runtime_tests/bun/index.test.tsx | 5 ++- runtime_tests/deno-jsx/jsx.test.tsx | 2 +- src/adapter/aws-lambda/handler.ts | 2 +- src/adapter/bun/websocket.ts | 12 +++--- src/compose.ts | 2 +- src/helper/accepts/accepts.test.ts | 2 +- src/helper/cookie/index.test.ts | 2 +- src/helper/cookie/index.ts | 2 +- src/helper/css/common.case.test.tsx | 4 +- src/helper/css/index.test.tsx | 2 +- src/helper/css/index.ts | 8 ++-- src/helper/dev/index.test.ts | 2 +- src/helper/factory/index.test.ts | 2 +- src/helper/html/index.test.ts | 2 +- src/helper/html/index.ts | 4 +- src/helper/ssg/ssg.test.tsx | 10 ++--- src/helper/ssg/ssg.ts | 4 +- src/helper/ssg/utils.test.ts | 4 +- src/hono-base.ts | 10 ++--- src/hono.test.ts | 2 +- src/jsx/base.ts | 5 +-- src/jsx/components.ts | 4 +- src/jsx/dom/components.test.tsx | 5 +-- src/jsx/dom/components.ts | 4 +- src/jsx/dom/context.test.tsx | 11 ++++-- src/jsx/dom/css.test.tsx | 2 +- src/jsx/dom/css.ts | 8 ++-- src/jsx/dom/index.test.tsx | 24 ++++++------ src/jsx/dom/index.ts | 41 ++++++++++---------- src/jsx/dom/jsx-dev-runtime.ts | 2 +- src/jsx/dom/render.ts | 5 +-- src/jsx/dom/utils.ts | 2 +- src/jsx/hooks/dom.test.tsx | 21 +++++----- src/jsx/hooks/index.ts | 4 +- src/jsx/index.test.tsx | 2 +- src/jsx/index.ts | 32 +++++++-------- src/jsx/jsx-runtime.ts | 2 +- src/jsx/streaming.ts | 2 +- src/middleware/etag/index.test.ts | 2 +- src/middleware/jsx-renderer/index.ts | 5 +-- src/middleware/secure-headers/index.test.ts | 2 +- src/middleware/trailing-slash/index.test.ts | 2 +- src/request.ts | 6 +-- src/router/common.case.test.ts | 2 +- src/router/linear-router/router.ts | 2 +- src/router/pattern-router/router.ts | 2 +- src/router/reg-exp-router/router.ts | 7 ++-- src/router/reg-exp-router/trie.ts | 2 +- src/router/smart-router/router.ts | 4 +- src/router/trie-router/node.ts | 2 +- src/types.test.ts | 4 +- src/utils/body.test.ts | 3 +- src/utils/buffer.test.ts | 2 +- src/utils/crypto.test.ts | 2 +- src/utils/jwt/index.ts | 2 +- src/utils/jwt/jws.ts | 3 +- src/utils/jwt/jwt.ts | 16 ++++---- src/utils/mime.test.ts | 2 +- src/utils/url.test.ts | 10 ++--- src/validator/validator.ts | 2 +- yarn.lock | 10 ++--- 63 files changed, 177 insertions(+), 178 deletions(-) diff --git a/bun.lockb b/bun.lockb index c1654be2c33b3b903e2bc5e17b02c5cd1d981194..212679cdb2f542df97b3f3b1e788c504289d21c8 100755 GIT binary patch delta 173 zcmV;e08;;(h!vZN6_73<1f>YMR=LT??!dmj)g^(!ZSama$G#a)>0ABby@j0pfljqf z0ZIdtSYI%Q$O8el$O8h!VnDL-N7HVVrweHq+T@hJE+dnSj?W&*d(W&<=n2LfzibY*jNhX|zu bw+N*K#DW1fm;ONo7nj;W1r4|HCj}}TcjQu7 delta 173 zcmV;e08;;(h!vZN6_73Nvb$;fA+ov<)^k%WUZV1&j>$Q<`GS zbs<|g1iV9jFVi%B!MieTT!G)DGk8VtBuO}Z8W@MoW&*d(W&<=n2LWC%E-)@MhX|zu bw+N*K#DW1dm;ONo7nj;W1r4|HCj}}Ty*Nj- diff --git a/package.json b/package.json index 0dd9b02c7..ded87aa0c 100644 --- a/package.json +++ b/package.json @@ -561,7 +561,7 @@ "nodejs" ], "devDependencies": { - "@hono/eslint-config": "^0.0.4", + "@hono/eslint-config": "^0.0.6", "@hono/node-server": "^1.8.2", "@types/crypto-js": "^4.1.1", "@types/glob": "^8.0.0", diff --git a/runtime_tests/bun/index.test.tsx b/runtime_tests/bun/index.test.tsx index 086c07e7c..3904c9edf 100644 --- a/runtime_tests/bun/index.test.tsx +++ b/runtime_tests/bun/index.test.tsx @@ -1,6 +1,7 @@ -import { describe, it, expect, vi, beforeEach, afterAll } from 'vitest' +import { afterAll, beforeEach, describe, expect, it, vi } from 'vitest' import { serveStatic, toSSG } from '../../src/adapter/bun' -import { createBunWebSocket, type BunWebSocketData } from '../../src/adapter/bun/websocket' +import { createBunWebSocket } from '../../src/adapter/bun/websocket' +import type { BunWebSocketData } from '../../src/adapter/bun/websocket' import { Context } from '../../src/context' import { env, getRuntimeKey } from '../../src/helper/adapter' import type { WSMessageReceive } from '../../src/helper/websocket' diff --git a/runtime_tests/deno-jsx/jsx.test.tsx b/runtime_tests/deno-jsx/jsx.test.tsx index 2bd506e4f..6e4580fc6 100644 --- a/runtime_tests/deno-jsx/jsx.test.tsx +++ b/runtime_tests/deno-jsx/jsx.test.tsx @@ -2,7 +2,7 @@ import { Style, css } from '../../src/helper/css/index.ts' import { Suspense, renderToReadableStream } from '../../src/jsx/streaming.ts' import type { HtmlEscapedString } from '../../src/utils/html.ts' -import { resolveCallback, HtmlEscapedCallbackPhase } from '../../src/utils/html.ts' +import { HtmlEscapedCallbackPhase, resolveCallback } from '../../src/utils/html.ts' import { assertEquals } from '../deno/deps.ts' Deno.test('JSX', () => { diff --git a/src/adapter/aws-lambda/handler.ts b/src/adapter/aws-lambda/handler.ts index 49cf1918a..9a43f8817 100644 --- a/src/adapter/aws-lambda/handler.ts +++ b/src/adapter/aws-lambda/handler.ts @@ -3,9 +3,9 @@ import type { Hono } from '../../hono' import type { Env, Schema } from '../../types' import { decodeBase64, encodeBase64 } from '../../utils/encode' import type { + ALBRequestContext, ApiGatewayRequestContext, ApiGatewayRequestContextV2, - ALBRequestContext, } from './custom-context' import type { Handler, LambdaContext } from './types' diff --git a/src/adapter/bun/websocket.ts b/src/adapter/bun/websocket.ts index 063d995fd..2e1797fce 100644 --- a/src/adapter/bun/websocket.ts +++ b/src/adapter/bun/websocket.ts @@ -1,9 +1,9 @@ -import { - createWSMessageEvent, - type UpgradeWebSocket, - type WSContext, - type WSEvents, - type WSMessageReceive, +import { createWSMessageEvent } from '../../helper/websocket' +import type { + UpgradeWebSocket, + WSContext, + WSEvents, + WSMessageReceive, } from '../../helper/websocket' interface BunServerWebSocket { diff --git a/src/compose.ts b/src/compose.ts index 168c42523..d5e32ea04 100644 --- a/src/compose.ts +++ b/src/compose.ts @@ -1,6 +1,6 @@ import { Context } from './context' import type { ParamIndexMap, Params } from './router' -import type { Env, NotFoundHandler, ErrorHandler } from './types' +import type { Env, ErrorHandler, NotFoundHandler } from './types' interface ComposeContext { finalized: boolean diff --git a/src/helper/accepts/accepts.test.ts b/src/helper/accepts/accepts.test.ts index 583df50a9..df4f764dc 100644 --- a/src/helper/accepts/accepts.test.ts +++ b/src/helper/accepts/accepts.test.ts @@ -1,6 +1,6 @@ import { Hono } from '../..' import type { Accept, acceptsConfig, acceptsOptions } from './accepts' -import { parseAccept, defaultMatch, accepts } from './accepts' +import { accepts, defaultMatch, parseAccept } from './accepts' describe('parseAccept', () => { test('should parse accept header', () => { diff --git a/src/helper/cookie/index.test.ts b/src/helper/cookie/index.test.ts index 9a6d47c20..406c6988a 100644 --- a/src/helper/cookie/index.test.ts +++ b/src/helper/cookie/index.test.ts @@ -1,5 +1,5 @@ import { Hono } from '../../hono' -import { getCookie, getSignedCookie, setCookie, setSignedCookie, deleteCookie } from '.' +import { deleteCookie, getCookie, getSignedCookie, setCookie, setSignedCookie } from '.' describe('Cookie Middleware', () => { describe('Parse cookie', () => { diff --git a/src/helper/cookie/index.ts b/src/helper/cookie/index.ts index fd90704bb..af3549cb1 100644 --- a/src/helper/cookie/index.ts +++ b/src/helper/cookie/index.ts @@ -1,6 +1,6 @@ import type { Context } from '../../context' import { parse, parseSigned, serialize, serializeSigned } from '../../utils/cookie' -import type { CookieOptions, Cookie, SignedCookie, CookiePrefixOptions } from '../../utils/cookie' +import type { Cookie, CookieOptions, CookiePrefixOptions, SignedCookie } from '../../utils/cookie' interface GetCookie { (c: Context, key: string): string | undefined diff --git a/src/helper/css/common.case.test.tsx b/src/helper/css/common.case.test.tsx index 2a9046e7e..74422944c 100644 --- a/src/helper/css/common.case.test.tsx +++ b/src/helper/css/common.case.test.tsx @@ -1,11 +1,11 @@ /* eslint-disable quotes */ /** @jsxImportSource ../../jsx */ import type { + Style as StyleComponent, css as cssHelper, keyframes as keyframesHelper, - viewTransition as viewTransitionHelper, rawCssString as rawCssStringHelper, - Style as StyleComponent, + viewTransition as viewTransitionHelper, } from './index' interface Support { diff --git a/src/helper/css/index.test.tsx b/src/helper/css/index.test.tsx index abb9c0554..a08e9e61e 100644 --- a/src/helper/css/index.test.tsx +++ b/src/helper/css/index.test.tsx @@ -8,7 +8,7 @@ import { Suspense, renderToReadableStream } from '../../jsx/streaming' import type { HtmlEscapedString } from '../../utils/html' import { HtmlEscapedCallbackPhase, resolveCallback } from '../../utils/html' import { renderTest } from './common.case.test' -import { css, cx, keyframes, viewTransition, rawCssString, Style, createCssContext } from './index' +import { Style, createCssContext, css, cx, keyframes, rawCssString, viewTransition } from './index' async function toString( template: JSXNode | Promise | Promise | HtmlEscapedString diff --git a/src/helper/css/index.ts b/src/helper/css/index.ts index 0393e9e29..b8fc5cfc4 100644 --- a/src/helper/css/index.ts +++ b/src/helper/css/index.ts @@ -4,12 +4,12 @@ import { createCssJsxDomObjects } from '../../jsx/dom/css' import type { HtmlEscapedCallback, HtmlEscapedString } from '../../utils/html' import type { CssClassName as CssClassNameCommon, CssVariableType } from './common' import { - SELECTOR, CLASS_NAME, - STYLE_STRING, - SELECTORS, - PSEUDO_GLOBAL_SELECTOR, DEFAULT_STYLE_ID, + PSEUDO_GLOBAL_SELECTOR, + SELECTOR, + SELECTORS, + STYLE_STRING, cssCommon, cxCommon, keyframesCommon, diff --git a/src/helper/dev/index.test.ts b/src/helper/dev/index.test.ts index 54bb2071e..7b41aa175 100644 --- a/src/helper/dev/index.test.ts +++ b/src/helper/dev/index.test.ts @@ -1,7 +1,7 @@ import { Hono } from '../../hono' import { RegExpRouter } from '../../router/reg-exp-router' import type { Handler, MiddlewareHandler } from '../../types' -import { inspectRoutes, showRoutes, getRouterName } from '.' +import { getRouterName, inspectRoutes, showRoutes } from '.' const namedMiddleware: MiddlewareHandler = (_, next) => next() const namedHandler: Handler = (c) => c.text('hi') diff --git a/src/helper/factory/index.test.ts b/src/helper/factory/index.test.ts index c8f18f465..82105f3cc 100644 --- a/src/helper/factory/index.test.ts +++ b/src/helper/factory/index.test.ts @@ -5,7 +5,7 @@ import { Hono } from '../../index' import type { ToSchema, TypedResponse } from '../../types' import type { StatusCode } from '../../utils/http-status' import { validator } from '../../validator' -import { createMiddleware, createFactory } from './index' +import { createFactory, createMiddleware } from './index' describe('createMiddleware', () => { type Env = { Variables: { foo: string } } diff --git a/src/helper/html/index.test.ts b/src/helper/html/index.test.ts index 401955869..ab4199fd7 100644 --- a/src/helper/html/index.test.ts +++ b/src/helper/html/index.test.ts @@ -1,4 +1,4 @@ -import { resolveCallback, HtmlEscapedCallbackPhase } from '../../utils/html' +import { HtmlEscapedCallbackPhase, resolveCallback } from '../../utils/html' import { html, raw } from '.' describe('Tagged Template Literals', () => { diff --git a/src/helper/html/index.ts b/src/helper/html/index.ts index 7d4d20db0..13a77c618 100644 --- a/src/helper/html/index.ts +++ b/src/helper/html/index.ts @@ -1,5 +1,5 @@ -import { escapeToBuffer, stringBufferToString, raw } from '../../utils/html' -import type { StringBuffer, HtmlEscaped, HtmlEscapedString } from '../../utils/html' +import { escapeToBuffer, raw, stringBufferToString } from '../../utils/html' +import type { HtmlEscaped, HtmlEscapedString, StringBuffer } from '../../utils/html' export { raw } diff --git a/src/helper/ssg/ssg.test.tsx b/src/helper/ssg/ssg.test.tsx index 501d2f9c2..9b9886986 100644 --- a/src/helper/ssg/ssg.test.tsx +++ b/src/helper/ssg/ssg.test.tsx @@ -5,16 +5,16 @@ import { Hono } from '../../hono' import { poweredBy } from '../../middleware/powered-by' import { X_HONO_DISABLE_SSG_HEADER_KEY, - ssgParams, - isSSGContext, disableSSG, + isSSGContext, onlySSG, + ssgParams, } from './middleware' -import { fetchRoutesContent, saveContentToFile, toSSG, defaultExtensionMap } from './ssg' +import { defaultExtensionMap, fetchRoutesContent, saveContentToFile, toSSG } from './ssg' import type { - BeforeRequestHook, - AfterResponseHook, AfterGenerateHook, + AfterResponseHook, + BeforeRequestHook, FileSystemModule, ToSSGResult, } from './ssg' diff --git a/src/helper/ssg/ssg.ts b/src/helper/ssg/ssg.ts index aa98d9c82..5f98e05e5 100644 --- a/src/helper/ssg/ssg.ts +++ b/src/helper/ssg/ssg.ts @@ -4,8 +4,8 @@ import type { Env, Schema } from '../../types' import { createPool } from '../../utils/concurrent' import { getExtension } from '../../utils/mime' import type { AddedSSGDataRequest, SSGParams } from './middleware' -import { X_HONO_DISABLE_SSG_HEADER_KEY, SSG_CONTEXT } from './middleware' -import { joinPaths, dirname, filterStaticGenerateRoutes } from './utils' +import { SSG_CONTEXT, X_HONO_DISABLE_SSG_HEADER_KEY } from './middleware' +import { dirname, filterStaticGenerateRoutes, joinPaths } from './utils' const DEFAULT_CONCURRENCY = 2 // default concurrency for ssg diff --git a/src/helper/ssg/utils.test.ts b/src/helper/ssg/utils.test.ts index bfd2da707..1f3b6b09e 100644 --- a/src/helper/ssg/utils.test.ts +++ b/src/helper/ssg/utils.test.ts @@ -1,5 +1,5 @@ -import { describe, it, expect } from 'vitest' -import { joinPaths, dirname } from './utils' +import { describe, expect, it } from 'vitest' +import { dirname, joinPaths } from './utils' describe('joinPath', () => { it('Should joined path is valid.', () => { diff --git a/src/hono-base.ts b/src/hono-base.ts index 1b81d1ec4..443a07134 100644 --- a/src/hono-base.ts +++ b/src/hono-base.ts @@ -5,22 +5,22 @@ import type { ExecutionContext } from './context' import { HTTPException } from './http-exception' import { HonoRequest } from './request' import type { Router } from './router' -import { METHOD_NAME_ALL, METHOD_NAME_ALL_LOWERCASE, METHODS } from './router' +import { METHODS, METHOD_NAME_ALL, METHOD_NAME_ALL_LOWERCASE } from './router' import type { Env, ErrorHandler, + FetchEventLike, H, HandlerInterface, + MergePath, + MergeSchemaPath, MiddlewareHandler, MiddlewareHandlerInterface, Next, NotFoundHandler, OnHandlerInterface, - MergePath, - MergeSchemaPath, - FetchEventLike, - Schema, RouterRoute, + Schema, } from './types' import { getPath, getPathNoStrict, getQueryStrings, mergePath } from './utils/url' diff --git a/src/hono.test.ts b/src/hono.test.ts index ca7ff7513..685e7e59a 100644 --- a/src/hono.test.ts +++ b/src/hono.test.ts @@ -11,7 +11,7 @@ import { RegExpRouter } from './router/reg-exp-router' import { SmartRouter } from './router/smart-router' import { TrieRouter } from './router/trie-router' import type { Handler, MiddlewareHandler, Next } from './types' -import type { Expect, Equal } from './utils/types' +import type { Equal, Expect } from './utils/types' import { getPath } from './utils/url' // https://stackoverflow.com/a/65666402 diff --git a/src/jsx/base.ts b/src/jsx/base.ts index 02ec4387e..bf258d414 100644 --- a/src/jsx/base.ts +++ b/src/jsx/base.ts @@ -1,10 +1,9 @@ import { raw } from '../helper/html' import { escapeToBuffer, stringBufferToString } from '../utils/html' -import type { StringBuffer, HtmlEscaped, HtmlEscapedString } from '../utils/html' +import type { HtmlEscaped, HtmlEscapedString, StringBuffer } from '../utils/html' import type { Context } from './context' import { globalContexts } from './context' -import type { IntrinsicElements as IntrinsicElementsDefined } from './intrinsic-elements' -import type { Hono } from './intrinsic-elements' +import type { Hono , IntrinsicElements as IntrinsicElementsDefined } from './intrinsic-elements' import { normalizeIntrinsicElementProps, styleObjectForEach } from './utils' // eslint-disable-next-line @typescript-eslint/no-explicit-any diff --git a/src/jsx/components.ts b/src/jsx/components.ts index 4ed7b8f87..846b1fd49 100644 --- a/src/jsx/components.ts +++ b/src/jsx/components.ts @@ -1,10 +1,10 @@ import { raw } from '../helper/html' -import type { HtmlEscapedString, HtmlEscapedCallback } from '../utils/html' +import type { HtmlEscapedCallback, HtmlEscapedString } from '../utils/html' import { HtmlEscapedCallbackPhase, resolveCallback } from '../utils/html' import { DOM_RENDERER } from './constants' import { ErrorBoundary as ErrorBoundaryDomRenderer } from './dom/components' import type { HasRenderToDom } from './dom/render' -import type { FC, PropsWithChildren, Child } from './' +import type { Child, FC, PropsWithChildren } from './' let errorBoundaryCounter = 0 diff --git a/src/jsx/dom/components.test.tsx b/src/jsx/dom/components.test.tsx index de86cc10d..2895a12c7 100644 --- a/src/jsx/dom/components.test.tsx +++ b/src/jsx/dom/components.test.tsx @@ -1,11 +1,10 @@ /** @jsxImportSource ../ */ import { JSDOM } from 'jsdom' -import { Suspense as SuspenseCommon, ErrorBoundary as ErrorBoundaryCommon } from '..' // for common +import { ErrorBoundary as ErrorBoundaryCommon, Suspense as SuspenseCommon } from '..' // for common // run tests by old style jsx default // hono/jsx/jsx-runtime and hono/jsx/dom/jsx-runtime are tested in their respective settings import { use, useState } from '../hooks' -import { Suspense as SuspenseDom, ErrorBoundary as ErrorBoundaryDom } from '.' // for dom -import { render } from '.' +import { ErrorBoundary as ErrorBoundaryDom, Suspense as SuspenseDom, render } from '.' // for dom runner('Common', SuspenseCommon, ErrorBoundaryCommon) runner('DOM', SuspenseDom, ErrorBoundaryDom) diff --git a/src/jsx/dom/components.ts b/src/jsx/dom/components.ts index 57e4ba603..a46903dc9 100644 --- a/src/jsx/dom/components.ts +++ b/src/jsx/dom/components.ts @@ -1,5 +1,5 @@ -import type { FC, PropsWithChildren, Child } from '../' -import type { FallbackRender, ErrorHandler } from '../components' +import type { Child, FC, PropsWithChildren } from '../' +import type { ErrorHandler, FallbackRender } from '../components' import { DOM_ERROR_HANDLER } from '../constants' import { Fragment } from './jsx-runtime' diff --git a/src/jsx/dom/context.test.tsx b/src/jsx/dom/context.test.tsx index 60ccaf24b..c49d6b087 100644 --- a/src/jsx/dom/context.test.tsx +++ b/src/jsx/dom/context.test.tsx @@ -1,11 +1,14 @@ /** @jsxImportSource ../ */ import { JSDOM } from 'jsdom' -import { createContext as createContextCommon, useContext as useContextCommon } from '..' // for common -import { use, Suspense } from '..' +import { + Suspense, + createContext as createContextCommon, + use, + useContext as useContextCommon, +} from '..' // for common // run tests by old style jsx default // hono/jsx/jsx-runtime and hono/jsx/dom/jsx-runtime are tested in their respective settings -import { createContext as createContextDom, useContext as useContextDom } from '.' // for dom -import { render, useState } from '.' +import { createContext as createContextDom, render, useContext as useContextDom, useState } from '.' // for dom runner('Common', createContextCommon, useContextCommon) runner('DOM', createContextDom, useContextDom) diff --git a/src/jsx/dom/css.test.tsx b/src/jsx/dom/css.test.tsx index c254ca486..4227f6ce8 100644 --- a/src/jsx/dom/css.test.tsx +++ b/src/jsx/dom/css.test.tsx @@ -4,7 +4,7 @@ import { JSDOM } from 'jsdom' // hono/jsx/jsx-runtime and hono/jsx/dom/jsx-runtime are tested in their respective settings // eslint-disable-next-line @typescript-eslint/no-unused-vars import type { JSXNode } from '..' -import { Style, css, rawCssString, createCssContext } from '../../helper/css' +import { Style, createCssContext, css, rawCssString } from '../../helper/css' import { minify } from '../../helper/css/common' import { renderTest } from '../../helper/css/common.case.test' import { render } from '.' diff --git a/src/jsx/dom/css.ts b/src/jsx/dom/css.ts index 6e5ab84d8..99e098d64 100644 --- a/src/jsx/dom/css.ts +++ b/src/jsx/dom/css.ts @@ -1,12 +1,12 @@ import type { FC, PropsWithChildren } from '../' import type { CssClassName, CssVariableType } from '../../helper/css/common' import { - SELECTOR, CLASS_NAME, - STYLE_STRING, - SELECTORS, - PSEUDO_GLOBAL_SELECTOR, DEFAULT_STYLE_ID, + PSEUDO_GLOBAL_SELECTOR, + SELECTOR, + SELECTORS, + STYLE_STRING, cssCommon, cxCommon, keyframesCommon, diff --git a/src/jsx/dom/index.test.tsx b/src/jsx/dom/index.test.tsx index 979dc35fa..628f9b0fa 100644 --- a/src/jsx/dom/index.test.tsx +++ b/src/jsx/dom/index.test.tsx @@ -1,28 +1,26 @@ /** @jsxImportSource ../ */ import { JSDOM } from 'jsdom' -import type { FC, Child } from '..' +import type { Child, FC } from '..' // run tests by old style jsx default // hono/jsx/jsx-runtime and hono/jsx/dom/jsx-runtime are tested in their respective settings import { createElement, jsx } from '..' import type { RefObject } from '../hooks' import { - useState, + createRef, + useCallback, useEffect, - useLayoutEffect, useInsertionEffect, - useCallback, - useRef, + useLayoutEffect, useMemo, - createRef, + useRef, + useState, } from '../hooks' -import DefaultExport from '.' -import { memo, isValidElement, cloneElement } from '.' -import { - render, - flushSync, +import DefaultExport, { cloneElement, cloneElement as cloneElementForDom, createElement as createElementForDom , createPortal, - createElement as createElementForDom, - cloneElement as cloneElementForDom, + flushSync, + isValidElement, + memo, + render, } from '.' describe('Common', () => { diff --git a/src/jsx/dom/index.ts b/src/jsx/dom/index.ts index 8c4d287cb..c302d58e9 100644 --- a/src/jsx/dom/index.ts +++ b/src/jsx/dom/index.ts @@ -1,34 +1,33 @@ -import { memo, isValidElement } from '../base' -import type { Props, Child, DOMAttributes, JSXNode } from '../base' -import type { JSX } from '../base' +import { isValidElement, memo } from '../base' +import type { Child, DOMAttributes, JSX, JSXNode , Props } from '../base' import { Children } from '../children' import { useContext } from '../context' import { - useState, - useEffect, - useRef, - useCallback, - use, + createRef, + forwardRef, startTransition, - useTransition, - useDeferredValue, startViewTransition, - useViewTransition, - useMemo, - useLayoutEffect, - useInsertionEffect, - useReducer, - useId, + use, + useCallback, useDebugValue, - createRef, - forwardRef, + useDeferredValue, + useEffect, + useId, useImperativeHandle, + useInsertionEffect, + useLayoutEffect, + useMemo, + useReducer, + useRef, + useState, useSyncExternalStore, + useTransition, + useViewTransition, } from '../hooks' -import { Suspense, ErrorBoundary } from './components' +import { ErrorBoundary, Suspense } from './components' import { createContext } from './context' -import { jsx, Fragment } from './jsx-runtime' -import { flushSync, createPortal } from './render' +import { Fragment, jsx } from './jsx-runtime' +import { createPortal, flushSync } from './render' export { render } from './render' diff --git a/src/jsx/dom/jsx-dev-runtime.ts b/src/jsx/dom/jsx-dev-runtime.ts index d7a6ff29e..9a66c390f 100644 --- a/src/jsx/dom/jsx-dev-runtime.ts +++ b/src/jsx/dom/jsx-dev-runtime.ts @@ -1,4 +1,4 @@ -import type { Props, JSXNode } from '../base' +import type { JSXNode, Props } from '../base' import { normalizeIntrinsicElementProps } from '../utils' import { newJSXNode } from './utils' diff --git a/src/jsx/dom/render.ts b/src/jsx/dom/render.ts index 556867a83..b76c49362 100644 --- a/src/jsx/dom/render.ts +++ b/src/jsx/dom/render.ts @@ -1,7 +1,6 @@ -import type { JSXNode } from '../base' -import type { FC, Child, Props } from '../base' +import type { Child , FC, JSXNode, Props } from '../base' import { toArray } from '../children' -import { DOM_RENDERER, DOM_ERROR_HANDLER, DOM_STASH, DOM_INTERNAL_TAG } from '../constants' +import { DOM_ERROR_HANDLER, DOM_INTERNAL_TAG, DOM_RENDERER, DOM_STASH } from '../constants' import type { Context as JSXContext } from '../context' import { globalContexts as globalJSXContexts, useContext } from '../context' import type { EffectData } from '../hooks' diff --git a/src/jsx/dom/utils.ts b/src/jsx/dom/utils.ts index 77c6b5676..8cbc605d9 100644 --- a/src/jsx/dom/utils.ts +++ b/src/jsx/dom/utils.ts @@ -1,4 +1,4 @@ -import type { Props, JSXNode } from '../base' +import type { JSXNode, Props } from '../base' import { DOM_INTERNAL_TAG } from '../constants' export const setInternalTagFlag = (fn: Function): Function => { diff --git a/src/jsx/hooks/dom.test.tsx b/src/jsx/hooks/dom.test.tsx index 93e278313..6ad308feb 100644 --- a/src/jsx/hooks/dom.test.tsx +++ b/src/jsx/hooks/dom.test.tsx @@ -2,23 +2,22 @@ import { JSDOM } from 'jsdom' // run tests by old style jsx default // hono/jsx/jsx-runtime and hono/jsx/dom/jsx-runtime are tested in their respective settings -import { Suspense } from '../dom' -import { render } from '../dom' +import { Suspense, render } from '../dom' import { - useState, - useReducer, - use, + createRef, + forwardRef, startTransition, - useTransition, - useDeferredValue, startViewTransition, - useViewTransition, - useId, + use, useDebugValue, - createRef, - forwardRef, + useDeferredValue, + useId, useImperativeHandle, + useReducer, + useState, useSyncExternalStore, + useTransition, + useViewTransition, } from '.' describe('Hooks', () => { diff --git a/src/jsx/hooks/index.ts b/src/jsx/hooks/index.ts index aea3512d2..3e38378d6 100644 --- a/src/jsx/hooks/index.ts +++ b/src/jsx/hooks/index.ts @@ -1,7 +1,7 @@ import type { JSX } from '../base' import { DOM_STASH } from '../constants' -import { buildDataStack, update, build } from '../dom/render' -import type { Node, NodeObject, Context, PendingType, UpdateHook } from '../dom/render' +import { build, buildDataStack, update } from '../dom/render' +import type { Context, Node, NodeObject, PendingType, UpdateHook } from '../dom/render' type UpdateStateFunction = (newState: T | ((currentState: T) => T)) => void diff --git a/src/jsx/index.test.tsx b/src/jsx/index.test.tsx index d871695f0..59d6c5a6f 100644 --- a/src/jsx/index.test.tsx +++ b/src/jsx/index.test.tsx @@ -3,7 +3,7 @@ import { html } from '../helper/html' import { Hono } from '../hono' import { Suspense, renderToReadableStream } from './streaming' -import DefaultExport, { memo, Fragment, createContext, useContext } from '.' +import DefaultExport, { Fragment, createContext, memo, useContext } from '.' import type { Context, FC, PropsWithChildren } from '.' interface SiteData { diff --git a/src/jsx/index.ts b/src/jsx/index.ts index 682740129..6220824f0 100644 --- a/src/jsx/index.ts +++ b/src/jsx/index.ts @@ -1,29 +1,29 @@ -import { jsx, memo, Fragment, isValidElement, cloneElement } from './base' +import { Fragment, cloneElement, isValidElement, jsx, memo } from './base' import type { DOMAttributes } from './base' import { Children } from './children' import { ErrorBoundary } from './components' import { createContext, useContext } from './context' import { - useState, - useEffect, - useRef, - useCallback, - use, + createRef, + forwardRef, startTransition, - useTransition, - useDeferredValue, startViewTransition, - useViewTransition, - useMemo, - useLayoutEffect, - useInsertionEffect, - useReducer, - useId, + use, + useCallback, useDebugValue, - createRef, - forwardRef, + useDeferredValue, + useEffect, + useId, useImperativeHandle, + useInsertionEffect, + useLayoutEffect, + useMemo, + useReducer, + useRef, + useState, useSyncExternalStore, + useTransition, + useViewTransition, } from './hooks' import { Suspense } from './streaming' diff --git a/src/jsx/jsx-runtime.ts b/src/jsx/jsx-runtime.ts index 4633334e6..884ebcf07 100644 --- a/src/jsx/jsx-runtime.ts +++ b/src/jsx/jsx-runtime.ts @@ -2,7 +2,7 @@ export { jsxDEV as jsx, Fragment } from './jsx-dev-runtime' export { jsxDEV as jsxs } from './jsx-dev-runtime' export type { JSX } from './jsx-dev-runtime' -import { raw, html } from '../helper/html' +import { html, raw } from '../helper/html' import type { HtmlEscapedString } from '../utils/html' export { html as jsxTemplate } export const jsxAttr = ( diff --git a/src/jsx/streaming.ts b/src/jsx/streaming.ts index 6a037bb6b..e87332878 100644 --- a/src/jsx/streaming.ts +++ b/src/jsx/streaming.ts @@ -6,7 +6,7 @@ import { DOM_RENDERER, DOM_STASH } from './constants' import { Suspense as SuspenseDomRenderer } from './dom/components' import { buildDataStack } from './dom/render' import type { HasRenderToDom, NodeObject } from './dom/render' -import type { FC, PropsWithChildren, Child } from './' +import type { Child, FC, PropsWithChildren } from './' let suspenseCounter = 0 diff --git a/src/middleware/etag/index.test.ts b/src/middleware/etag/index.test.ts index d70ce2abc..1fb9c9901 100644 --- a/src/middleware/etag/index.test.ts +++ b/src/middleware/etag/index.test.ts @@ -1,5 +1,5 @@ import { Hono } from '../../hono' -import { etag, RETAINED_304_HEADERS } from '.' +import { RETAINED_304_HEADERS, etag } from '.' describe('Etag Middleware', () => { it('Should return etag header', async () => { diff --git a/src/middleware/jsx-renderer/index.ts b/src/middleware/jsx-renderer/index.ts index 34eb0223c..cbe1de528 100644 --- a/src/middleware/jsx-renderer/index.ts +++ b/src/middleware/jsx-renderer/index.ts @@ -1,9 +1,8 @@ /* eslint-disable @typescript-eslint/no-explicit-any */ import type { Context, PropsForRenderer } from '../../context' import { html, raw } from '../../helper/html' -import { jsx, createContext, useContext, Fragment } from '../../jsx' -import type { FC, PropsWithChildren, JSXNode } from '../../jsx' -import type { Context as JSXContext } from '../../jsx' +import { Fragment, createContext, jsx, useContext } from '../../jsx' +import type { FC, Context as JSXContext, JSXNode , PropsWithChildren } from '../../jsx' import { renderToReadableStream } from '../../jsx/streaming' import type { Env, Input, MiddlewareHandler } from '../../types' import type { HtmlEscapedString } from '../../utils/html' diff --git a/src/middleware/secure-headers/index.test.ts b/src/middleware/secure-headers/index.test.ts index 3e3e89f9c..7fbc77252 100644 --- a/src/middleware/secure-headers/index.test.ts +++ b/src/middleware/secure-headers/index.test.ts @@ -1,7 +1,7 @@ /* eslint-disable quotes */ import { Hono } from '../../hono' import { poweredBy } from '../powered-by' -import { secureHeaders, NONCE } from '.' +import { NONCE, secureHeaders } from '.' import type { ContentSecurityPolicyOptionHandler } from '.' declare module '../..' { diff --git a/src/middleware/trailing-slash/index.test.ts b/src/middleware/trailing-slash/index.test.ts index 8b74c3add..097aef3bd 100644 --- a/src/middleware/trailing-slash/index.test.ts +++ b/src/middleware/trailing-slash/index.test.ts @@ -1,5 +1,5 @@ import { Hono } from '../../hono' -import { trimTrailingSlash, appendTrailingSlash } from '.' +import { appendTrailingSlash, trimTrailingSlash } from '.' describe('Resolve trailing slash', () => { let app: Hono diff --git a/src/request.ts b/src/request.ts index 3a9ad36ab..a2e74ea8b 100644 --- a/src/request.ts +++ b/src/request.ts @@ -3,16 +3,16 @@ import type { Result } from './router' import type { Input, InputToDataByTarget, - ParamKeys, ParamKeyToRecord, + ParamKeys, RemoveQuestion, - ValidationTargets, RouterRoute, + ValidationTargets, } from './types' import { parseBody } from './utils/body' import type { BodyData, ParseBodyOptions } from './utils/body' import type { Simplify, UnionToIntersection } from './utils/types' -import { getQueryParam, getQueryParams, decodeURIComponent_ } from './utils/url' +import { decodeURIComponent_, getQueryParam, getQueryParams } from './utils/url' type Body = { json: any diff --git a/src/router/common.case.test.ts b/src/router/common.case.test.ts index d7be83e35..ae82f8520 100644 --- a/src/router/common.case.test.ts +++ b/src/router/common.case.test.ts @@ -1,5 +1,5 @@ import type { Suite } from 'vitest' -import type { Router, Params, ParamIndexMap } from '../router' +import type { ParamIndexMap, Params, Router } from '../router' const getSuiteHierarchy = (suite: Suite) => { const res: Suite[] = [] diff --git a/src/router/linear-router/router.ts b/src/router/linear-router/router.ts index e953fbcc9..c05451ead 100644 --- a/src/router/linear-router/router.ts +++ b/src/router/linear-router/router.ts @@ -1,4 +1,4 @@ -import type { Router, Result, Params } from '../../router' +import type { Params, Result, Router } from '../../router' import { METHOD_NAME_ALL, UnsupportedPathError } from '../../router' import { checkOptionalParameter } from '../../utils/url' diff --git a/src/router/pattern-router/router.ts b/src/router/pattern-router/router.ts index 5674a672e..770be7508 100644 --- a/src/router/pattern-router/router.ts +++ b/src/router/pattern-router/router.ts @@ -1,4 +1,4 @@ -import type { Result, Router, Params } from '../../router' +import type { Params, Result, Router } from '../../router' import { METHOD_NAME_ALL, UnsupportedPathError } from '../../router' type Route = [RegExp, string, T] // [pattern, method, handler, path] diff --git a/src/router/reg-exp-router/router.ts b/src/router/reg-exp-router/router.ts index 6ab369200..ce925f528 100644 --- a/src/router/reg-exp-router/router.ts +++ b/src/router/reg-exp-router/router.ts @@ -1,12 +1,13 @@ /* eslint-disable @typescript-eslint/ban-ts-comment */ -import type { Router, Result, ParamIndexMap } from '../../router' +import type { ParamIndexMap, Result, Router } from '../../router' import { + MESSAGE_MATCHER_IS_ALREADY_BUILT, METHOD_NAME_ALL, UnsupportedPathError, - MESSAGE_MATCHER_IS_ALREADY_BUILT, } from '../../router' import { checkOptionalParameter } from '../../utils/url' -import { PATH_ERROR, type ParamAssocArray } from './node' +import { PATH_ERROR } from './node' +import type {ParamAssocArray} from './node' import { Trie } from './trie' type HandlerData = [T, ParamIndexMap][] diff --git a/src/router/reg-exp-router/trie.ts b/src/router/reg-exp-router/trie.ts index 151a95323..d7b146cf4 100644 --- a/src/router/reg-exp-router/trie.ts +++ b/src/router/reg-exp-router/trie.ts @@ -1,4 +1,4 @@ -import type { ParamAssocArray, Context } from './node' +import type { Context, ParamAssocArray } from './node' import { Node } from './node' export type ReplacementMap = number[] diff --git a/src/router/smart-router/router.ts b/src/router/smart-router/router.ts index aa1201122..3c23ecb57 100644 --- a/src/router/smart-router/router.ts +++ b/src/router/smart-router/router.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/ban-ts-comment */ -import type { Router, Result } from '../../router' -import { UnsupportedPathError, MESSAGE_MATCHER_IS_ALREADY_BUILT } from '../../router' +import type { Result, Router } from '../../router' +import { MESSAGE_MATCHER_IS_ALREADY_BUILT, UnsupportedPathError } from '../../router' export class SmartRouter implements Router { name: string = 'SmartRouter' diff --git a/src/router/trie-router/node.ts b/src/router/trie-router/node.ts index 9280ecbb3..1b8c3fd4f 100644 --- a/src/router/trie-router/node.ts +++ b/src/router/trie-router/node.ts @@ -1,7 +1,7 @@ import type { Params } from '../../router' import { METHOD_NAME_ALL } from '../../router' import type { Pattern } from '../../utils/url' -import { splitPath, splitRoutingPath, getPattern } from '../../utils/url' +import { getPattern, splitPath, splitRoutingPath } from '../../utils/url' type HandlerSet = { handler: T diff --git a/src/types.test.ts b/src/types.test.ts index e8856c15f..8d24898e6 100644 --- a/src/types.test.ts +++ b/src/types.test.ts @@ -14,15 +14,15 @@ import type { MergePath, MergeSchemaPath, MiddlewareHandler, - ParamKeys, ParamKeyToRecord, + ParamKeys, RemoveQuestion, ResponseFormat, ToSchema, TypedResponse, } from './types' import type { StatusCode } from './utils/http-status' -import type { Expect, Equal } from './utils/types' +import type { Equal, Expect } from './utils/types' import { validator } from './validator' describe('Env', () => { diff --git a/src/utils/body.test.ts b/src/utils/body.test.ts index 6e049802d..04f6a4316 100644 --- a/src/utils/body.test.ts +++ b/src/utils/body.test.ts @@ -1,4 +1,5 @@ -import { parseBody, type BodyData } from './body' +import { parseBody } from './body' +import type {BodyData} from './body' type RecursiveRecord = { [key in K]: T | RecursiveRecord diff --git a/src/utils/buffer.test.ts b/src/utils/buffer.test.ts index 26a016414..248ec0762 100644 --- a/src/utils/buffer.test.ts +++ b/src/utils/buffer.test.ts @@ -1,5 +1,5 @@ import { SHA256 as sha256CryptoJS } from 'crypto-js' -import { timingSafeEqual, bufferToString, bufferToFormData } from './buffer' +import { bufferToFormData, bufferToString, timingSafeEqual } from './buffer' describe('buffer', () => { it('positive', async () => { diff --git a/src/utils/crypto.test.ts b/src/utils/crypto.test.ts index c927d5eb4..bd21160ae 100644 --- a/src/utils/crypto.test.ts +++ b/src/utils/crypto.test.ts @@ -1,5 +1,5 @@ import { createHash } from 'crypto' -import { sha256, sha1, md5 } from './crypto' +import { md5, sha1, sha256 } from './crypto' describe('crypto', () => { it('sha256', async () => { diff --git a/src/utils/jwt/index.ts b/src/utils/jwt/index.ts index 5f76e3e2e..68ce654bd 100644 --- a/src/utils/jwt/index.ts +++ b/src/utils/jwt/index.ts @@ -1,2 +1,2 @@ -import { sign, verify, decode } from './jwt' +import { decode, sign, verify } from './jwt' export const Jwt = { sign, verify, decode } diff --git a/src/utils/jwt/jws.ts b/src/utils/jwt/jws.ts index 2d130987a..21b2bf074 100644 --- a/src/utils/jwt/jws.ts +++ b/src/utils/jwt/jws.ts @@ -1,8 +1,7 @@ import { getRuntimeKey } from '../../helper/adapter' import { decodeBase64 } from '../encode' import type { SignatureAlgorithm } from './jwa' -import { JwtAlgorithmNotImplemented } from './types' -import { CryptoKeyUsage } from './types' +import { CryptoKeyUsage , JwtAlgorithmNotImplemented } from './types' import { utf8Encoder } from './utf8' // JSON Web Signature (JWS) diff --git a/src/utils/jwt/jwt.ts b/src/utils/jwt/jwt.ts index 43a87337b..ee87b74cc 100644 --- a/src/utils/jwt/jwt.ts +++ b/src/utils/jwt/jwt.ts @@ -1,14 +1,16 @@ -import { encodeBase64Url, decodeBase64Url } from '../../utils/encode' -import { AlgorithmTypes, type SignatureAlgorithm } from './jwa' -import { signing, verifying, type SignatureKey } from './jws' -import { JwtHeaderInvalid, type JWTPayload } from './types' -import { +import { decodeBase64Url, encodeBase64Url } from '../../utils/encode' +import { AlgorithmTypes } from './jwa' +import type {SignatureAlgorithm} from './jwa' +import { signing, verifying } from './jws' +import type {SignatureKey} from './jws' +import { JwtHeaderInvalid , + JwtTokenExpired, JwtTokenInvalid, + JwtTokenIssuedAt, JwtTokenNotBefore, - JwtTokenExpired, JwtTokenSignatureMismatched, - JwtTokenIssuedAt, } from './types' +import type {JWTPayload} from './types' import { utf8Decoder, utf8Encoder } from './utf8' const encodeJwtPart = (part: unknown): string => diff --git a/src/utils/mime.test.ts b/src/utils/mime.test.ts index d79a99a79..70961c813 100644 --- a/src/utils/mime.test.ts +++ b/src/utils/mime.test.ts @@ -1,4 +1,4 @@ -import { getMimeType, getExtension } from './mime' +import { getExtension, getMimeType } from './mime' const mime = { m3u8: 'application/vnd.apple.mpegurl', diff --git a/src/utils/url.test.ts b/src/utils/url.test.ts index 068886011..bae253b79 100644 --- a/src/utils/url.test.ts +++ b/src/utils/url.test.ts @@ -1,14 +1,14 @@ import { - splitPath, - splitRoutingPath, - getPattern, + checkOptionalParameter, getPath, getPathNoStrict, - mergePath, - checkOptionalParameter, + getPattern, getQueryParam, getQueryParams, getQueryStrings, + mergePath, + splitPath, + splitRoutingPath, } from './url' describe('url', () => { diff --git a/src/validator/validator.ts b/src/validator/validator.ts index cf66d0e35..366231d54 100644 --- a/src/validator/validator.ts +++ b/src/validator/validator.ts @@ -1,7 +1,7 @@ import type { Context } from '../context' import { getCookie } from '../helper/cookie' import { HTTPException } from '../http-exception' -import type { Env, ValidationTargets, MiddlewareHandler, TypedResponse } from '../types' +import type { Env, MiddlewareHandler, TypedResponse, ValidationTargets } from '../types' import type { BodyData } from '../utils/body' import { bufferToFormData } from '../utils/buffer' diff --git a/yarn.lock b/yarn.lock index 17b7cfcec..9aa29a1a9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1,6 +1,6 @@ # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. # yarn lockfile v1 -# bun ./bun.lockb --hash: 5CA1136C3F2F5DB7-1b68ff373acdefeb-7DBBBCD34BFD0EF1-d2b230862a4c1954 +# bun ./bun.lockb --hash: 04A508B956B9C9C7-eec0bebed52581c1-6DF08E37C7BE194F-e95bfde1bd859cfd "@aashutoshrathi/word-wrap@^1.2.3": @@ -457,10 +457,10 @@ magic-string "^0.30.0" regexpu-core "^5.3.2" -"@hono/eslint-config@^0.0.4": - version "0.0.4" - resolved "https://registry.npmjs.org/@hono/eslint-config/-/eslint-config-0.0.4.tgz" - integrity sha512-CaL3LBdI2tw7Luo4vGDhhrdntA02Nsts6P0FjAz3U5piy3UhWzgEvEN+L9M0fsG7Mm1cgd+kM3hF8CRJOH0aGA== +"@hono/eslint-config@latest": + version "0.0.6" + resolved "https://registry.npmjs.org/@hono/eslint-config/-/eslint-config-0.0.6.tgz" + integrity sha512-svFH026Vp5UHREJZzG6wx0SVHpX3O6yxeHjSYLXB4tXEzDEM2zK17tZ1XRFZRtx9NQH2yUGBEciwxdbx0LF7Jg== dependencies: "@typescript-eslint/eslint-plugin" "^6.14.0" "@typescript-eslint/parser" "^6.14.0" From ba269a980e258544c2ff0a324f907aaca361a970 Mon Sep 17 00:00:00 2001 From: Yusuke Wada Date: Sun, 26 May 2024 05:16:03 +0900 Subject: [PATCH 2/2] fix formats --- src/jsx/base.ts | 2 +- src/jsx/dom/index.test.tsx | 5 ++++- src/jsx/dom/index.ts | 2 +- src/jsx/dom/render.ts | 2 +- src/middleware/jsx-renderer/index.ts | 2 +- src/router/reg-exp-router/router.ts | 4 ++-- src/utils/body.test.ts | 4 ++-- src/utils/jwt/jws.ts | 2 +- src/utils/jwt/jwt.ts | 13 +++++++------ 9 files changed, 20 insertions(+), 16 deletions(-) diff --git a/src/jsx/base.ts b/src/jsx/base.ts index bf258d414..610a01e4f 100644 --- a/src/jsx/base.ts +++ b/src/jsx/base.ts @@ -3,7 +3,7 @@ import { escapeToBuffer, stringBufferToString } from '../utils/html' import type { HtmlEscaped, HtmlEscapedString, StringBuffer } from '../utils/html' import type { Context } from './context' import { globalContexts } from './context' -import type { Hono , IntrinsicElements as IntrinsicElementsDefined } from './intrinsic-elements' +import type { Hono, IntrinsicElements as IntrinsicElementsDefined } from './intrinsic-elements' import { normalizeIntrinsicElementProps, styleObjectForEach } from './utils' // eslint-disable-next-line @typescript-eslint/no-explicit-any diff --git a/src/jsx/dom/index.test.tsx b/src/jsx/dom/index.test.tsx index 628f9b0fa..d9f11a75e 100644 --- a/src/jsx/dom/index.test.tsx +++ b/src/jsx/dom/index.test.tsx @@ -15,7 +15,10 @@ import { useRef, useState, } from '../hooks' -import DefaultExport, { cloneElement, cloneElement as cloneElementForDom, createElement as createElementForDom , +import DefaultExport, { + cloneElement, + cloneElement as cloneElementForDom, + createElement as createElementForDom, createPortal, flushSync, isValidElement, diff --git a/src/jsx/dom/index.ts b/src/jsx/dom/index.ts index c302d58e9..bfc75f3d4 100644 --- a/src/jsx/dom/index.ts +++ b/src/jsx/dom/index.ts @@ -1,5 +1,5 @@ import { isValidElement, memo } from '../base' -import type { Child, DOMAttributes, JSX, JSXNode , Props } from '../base' +import type { Child, DOMAttributes, JSX, JSXNode, Props } from '../base' import { Children } from '../children' import { useContext } from '../context' import { diff --git a/src/jsx/dom/render.ts b/src/jsx/dom/render.ts index b76c49362..4ce2ea4d3 100644 --- a/src/jsx/dom/render.ts +++ b/src/jsx/dom/render.ts @@ -1,4 +1,4 @@ -import type { Child , FC, JSXNode, Props } from '../base' +import type { Child, FC, JSXNode, Props } from '../base' import { toArray } from '../children' import { DOM_ERROR_HANDLER, DOM_INTERNAL_TAG, DOM_RENDERER, DOM_STASH } from '../constants' import type { Context as JSXContext } from '../context' diff --git a/src/middleware/jsx-renderer/index.ts b/src/middleware/jsx-renderer/index.ts index cbe1de528..7538a92ba 100644 --- a/src/middleware/jsx-renderer/index.ts +++ b/src/middleware/jsx-renderer/index.ts @@ -2,7 +2,7 @@ import type { Context, PropsForRenderer } from '../../context' import { html, raw } from '../../helper/html' import { Fragment, createContext, jsx, useContext } from '../../jsx' -import type { FC, Context as JSXContext, JSXNode , PropsWithChildren } from '../../jsx' +import type { FC, Context as JSXContext, JSXNode, PropsWithChildren } from '../../jsx' import { renderToReadableStream } from '../../jsx/streaming' import type { Env, Input, MiddlewareHandler } from '../../types' import type { HtmlEscapedString } from '../../utils/html' diff --git a/src/router/reg-exp-router/router.ts b/src/router/reg-exp-router/router.ts index ce925f528..c0420be0e 100644 --- a/src/router/reg-exp-router/router.ts +++ b/src/router/reg-exp-router/router.ts @@ -6,8 +6,8 @@ import { UnsupportedPathError, } from '../../router' import { checkOptionalParameter } from '../../utils/url' -import { PATH_ERROR } from './node' -import type {ParamAssocArray} from './node' +import { PATH_ERROR } from './node' +import type { ParamAssocArray } from './node' import { Trie } from './trie' type HandlerData = [T, ParamIndexMap][] diff --git a/src/utils/body.test.ts b/src/utils/body.test.ts index 04f6a4316..0a10060b4 100644 --- a/src/utils/body.test.ts +++ b/src/utils/body.test.ts @@ -1,5 +1,5 @@ -import { parseBody } from './body' -import type {BodyData} from './body' +import { parseBody } from './body' +import type { BodyData } from './body' type RecursiveRecord = { [key in K]: T | RecursiveRecord diff --git a/src/utils/jwt/jws.ts b/src/utils/jwt/jws.ts index 21b2bf074..a2af58b30 100644 --- a/src/utils/jwt/jws.ts +++ b/src/utils/jwt/jws.ts @@ -1,7 +1,7 @@ import { getRuntimeKey } from '../../helper/adapter' import { decodeBase64 } from '../encode' import type { SignatureAlgorithm } from './jwa' -import { CryptoKeyUsage , JwtAlgorithmNotImplemented } from './types' +import { CryptoKeyUsage, JwtAlgorithmNotImplemented } from './types' import { utf8Encoder } from './utf8' // JSON Web Signature (JWS) diff --git a/src/utils/jwt/jwt.ts b/src/utils/jwt/jwt.ts index ee87b74cc..aa74164c0 100644 --- a/src/utils/jwt/jwt.ts +++ b/src/utils/jwt/jwt.ts @@ -1,16 +1,17 @@ import { decodeBase64Url, encodeBase64Url } from '../../utils/encode' -import { AlgorithmTypes } from './jwa' -import type {SignatureAlgorithm} from './jwa' -import { signing, verifying } from './jws' -import type {SignatureKey} from './jws' -import { JwtHeaderInvalid , +import { AlgorithmTypes } from './jwa' +import type { SignatureAlgorithm } from './jwa' +import { signing, verifying } from './jws' +import type { SignatureKey } from './jws' +import { + JwtHeaderInvalid, JwtTokenExpired, JwtTokenInvalid, JwtTokenIssuedAt, JwtTokenNotBefore, JwtTokenSignatureMismatched, } from './types' -import type {JWTPayload} from './types' +import type { JWTPayload } from './types' import { utf8Decoder, utf8Encoder } from './utf8' const encodeJwtPart = (part: unknown): string =>