fix: add return types of void function (#2870)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
* fix * chore: format
authored by Ame_x · committed by GitHub · parent c8beddb · Browse files · 6 files·+20 added−16 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
6 files+20 added−16 removed
- other:+20 added−16 removed
Provenance
- Commit
a852327- Tree
1a9aebb- Author
Ame_x <121654029+EdamAme-x@users.noreply.github.com>- Committer
GitHub <noreply@github.com>- Parent
c8beddb
6 files changed+20 added−16 removed
modified:src/adapter/aws-lambda/handler.ts+1 added-1 removed
93 unmodified lines94 95 const streamToNodeStream = async (96 reader: ReadableStreamDefaultReader<Uint8Array>,97 writer: NodeJS.WritableStream98-) => {98+): Promise<void> => {99 let readResult = await reader.read()100 while (!readResult.done) {101 writer.write(readResult.value)102 readResult = await reader.read()373 unmodified linesmodified:src/helper/dev/index.ts+1 added-1 removed
34 unmodified lines3536373839394041424336 unmodified lines34 unmodified lines } })}
export const showRoutes = <E extends Env>(hono: Hono<E>, opts?: ShowRoutesOptions) => {export const showRoutes = <E extends Env>(hono: Hono<E>, opts?: ShowRoutesOptions): void => { const colorEnabled = opts?.colorize ?? getColorEnabled() const routeData: Record<string, RouteData[]> = {} let maxMethodLength = 0 let maxPathLength = 036 unmodified linesmodified:src/helper/streaming/sse.ts+1 added-1 removed
37 unmodified lines3839404142424344454631 unmodified lines37 unmodified linesconst run = async ( stream: SSEStreamingApi, cb: (stream: SSEStreamingApi) => Promise<void>, onError?: (e: Error, stream: SSEStreamingApi) => Promise<void>) => {): Promise<void> => { try { await cb(stream) } catch (e) { if (e instanceof Error && onError) {31 unmodified linesmodified:src/jsx/dom/render.ts+15 added-11 removed
112 unmodified lines113 key.match(/^(?:o|pai|str|u|ve)/)) // Other un-deprecated kebab-case attributes. "overline-position", "paint-order", "strikethrough-position", etc.114 ? key.replace(/([A-Z])/g, '-$1').toLowerCase()115 : key116 117-const applyProps = (container: SupportedElement, attributes: Props, oldAttributes?: Props) => {117+const applyProps = (118+ container: SupportedElement,119+ attributes: Props,120+ oldAttributes?: Props121+): void => {122 attributes ||= {}123 for (const [key, value] of Object.entries(attributes)) {124 if (!skipProps.has(key) && (!oldAttributes || oldAttributes[key] !== value)) {125 const eventSpec = getEventSpec(key)112 unmodified lines238 container: Container,239 nextChildren: Node[],240 childrenToRemove: Node[],241 callbacks: EffectData[]238-) => {242+): void => {243 childrenToRemove.push(...node.vR)244 if (typeof node.tag === 'function') {245 node[DOM_STASH][1][STASH_EFFECT]?.forEach((data: EffectData) => callbacks.push(data))246 }32 unmodified lines279 280 return findInsertBefore(node.nN)281 }282 279-const removeNode = (node: Node) => {283+const removeNode = (node: Node): void => {284 if (!isNodeString(node)) {285 node[DOM_STASH]?.[1][STASH_EFFECT]?.forEach((data: EffectData) => data[2]?.())286 287 if (node.e && node.props?.ref) {13 unmodified lines301 fallbackUpdateFnArrayMap.delete(node)302 }303 }304 301-const apply = (node: NodeObject, container: Container) => {305+const apply = (node: NodeObject, container: Container): void => {306 node.c = container307 applyNodeObject(node, container)308 }309 306-const applyNode = (node: Node, container: Container) => {310+const applyNode = (node: Node, container: Container): void => {311 if (isNodeString(node)) {312 container.textContent = node.t313 } else {314 applyNodeObject(node, container)16 unmodified lines331 332 return333 }334 331-const applyNodeObject = (node: NodeObject, container: Container) => {335+const applyNodeObject = (node: NodeObject, container: Container): void => {336 const next: Node[] = []337 const remove: Node[] = []338 const callbacks: EffectData[] = []339 getNextChildren(node, container, next, remove, callbacks)186 unmodified lines526 return node as NodeObject527 }528 }529 526-const replaceContainer = (node: NodeObject, from: DocumentFragment, to: Container) => {530+const replaceContainer = (node: NodeObject, from: DocumentFragment, to: Container): void => {531 if (node.c === from) {532 node.c = to533 node.vC.forEach((child) => replaceContainer(child as NodeObject, from, to))534 }535 }536 533-const updateSync = (context: Context, node: NodeObject) => {537+const updateSync = (context: Context, node: NodeObject): void => {538 node[DOM_STASH][2]?.forEach(([c, v]) => {539 c.values.push(v)540 })541 build(context, node, undefined)51 unmodified lines593 594 return promise595 }596 593-export const renderNode = (node: NodeObject, container: Container) => {597+export const renderNode = (node: NodeObject, container: Container): void => {598 const context: Context = []599 ;(context as Context)[4] = true // start top level render600 build(context, node, undefined)601 ;(context as Context)[4] = false // finish top level render3 unmodified lines605 replaceContainer(node, fragment, container)606 container.replaceChildren(fragment)607 }608 605-export const render = (jsxNode: Child, container: Container) => {609+export const render = (jsxNode: Child, container: Container): void => {610 // eslint-disable-next-line @typescript-eslint/no-explicit-any611 renderNode(buildNode({ tag: '', props: { children: jsxNode } } as any) as NodeObject, container)612 }613 610-export const flushSync = (callback: () => void) => {614+export const flushSync = (callback: () => void): void => {615 const set = new Set<NodeObject>()616 currentUpdateSets.push(set)617 callback()618 set.forEach((node) => {19 unmodified linesmodified:src/context.ts+1 added-1 removed
393 unmodified lines394 * })395 * ```396 * @see https://hono.dev/api/context#render-setrenderer397 */398- setRenderer = (renderer: Renderer) => {398+ setRenderer = (renderer: Renderer): void => {399 this.renderer = renderer400 }401 402 /**316 unmodified linesmodified:src/hono-base.ts+1 added-1 removed
424 unmodified lines425 * @see https://hono.dev/api/hono#fire426 * @see https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API427 * @see https://developers.cloudflare.com/workers/reference/migrate-to-module-workers/428 */429- fire = () => {429+ fire = (): void => {430 // eslint-disable-next-line @typescript-eslint/ban-ts-comment431 // @ts-ignore432 addEventListener('fetch', (event: FetchEventLike): void => {433 event.respondWith(this.dispatch(event.request, event, undefined, event.request.method))5 unmodified lines