From e9de50d7c38bf0cf51c02e451a420715e773d91f Mon Sep 17 00:00:00 2001 From: mattn Date: Wed, 30 Oct 2024 09:44:06 +0900 Subject: [PATCH] refactor: fix typos (#3583) --- runtime-tests/deno/stream.test.ts | 8 ++++---- src/helper/cookie/index.test.ts | 2 +- src/helper/ssg/ssg.ts | 4 ++-- src/helper/ssg/utils.ts | 4 ++-- src/hono-base.ts | 2 +- src/jsx/index.test.tsx | 2 +- src/middleware/ip-restriction/index.ts | 6 +++--- src/router/trie-router/node.test.ts | 2 +- src/utils/ipaddr.test.ts | 2 +- 9 files changed, 16 insertions(+), 16 deletions(-) diff --git a/runtime-tests/deno/stream.test.ts b/runtime-tests/deno/stream.test.ts index baff1486..64a5969c 100644 --- a/runtime-tests/deno/stream.test.ts +++ b/runtime-tests/deno/stream.test.ts @@ -2,7 +2,7 @@ import { assertEquals } from '@std/assert' import { stream, streamSSE } from '../../src/helper/streaming/index.ts' import { Hono } from '../../src/hono.ts' -Deno.test('Shuld call onAbort via stream', async () => { +Deno.test('Should call onAbort via stream', async () => { const app = new Hono() let aborted = false app.get('/stream', (c) => { @@ -34,7 +34,7 @@ Deno.test('Shuld call onAbort via stream', async () => { await server.shutdown() }) -Deno.test('Shuld not call onAbort via stream if already closed', async () => { +Deno.test('Should not call onAbort via stream if already closed', async () => { const app = new Hono() let aborted = false app.get('/stream', (c) => { @@ -54,7 +54,7 @@ Deno.test('Shuld not call onAbort via stream if already closed', async () => { await server.shutdown() }) -Deno.test('Shuld call onAbort via streamSSE', async () => { +Deno.test('Should call onAbort via streamSSE', async () => { const app = new Hono() let aborted = false app.get('/stream', (c) => { @@ -87,7 +87,7 @@ Deno.test('Shuld call onAbort via streamSSE', async () => { await server.shutdown() }) -Deno.test('Shuld not call onAbort via streamSSE if already closed', async () => { +Deno.test('Should not call onAbort via streamSSE if already closed', async () => { const app = new Hono() let aborted = false app.get('/stream', (c) => { diff --git a/src/helper/cookie/index.test.ts b/src/helper/cookie/index.test.ts index 406c6988..2a70cbb0 100644 --- a/src/helper/cookie/index.test.ts +++ b/src/helper/cookie/index.test.ts @@ -106,7 +106,7 @@ describe('Cookie Middleware', () => { expect(res.headers.get('Fortune-Cookie')).toBe('lots-of-money') }) - it('Get signed cookie witn invalid signature', async () => { + it('Get signed cookie with invalid signature', async () => { const req = new Request('http://localhost/cookie-signed-get-one') // fortune_cookie has invalid signature const cookieString = diff --git a/src/helper/ssg/ssg.ts b/src/helper/ssg/ssg.ts index 5f98e05e..3e3fd283 100644 --- a/src/helper/ssg/ssg.ts +++ b/src/helper/ssg/ssg.ts @@ -381,8 +381,8 @@ export const toSSG: ToSSGInterface = async (app, fs, options) => { result = { success: false, files: [], error: errorObj } } if (options?.afterGenerateHook) { - const conbinedAfterGenerateHooks = combineAfterGenerateHooks(options?.afterGenerateHook) - await conbinedAfterGenerateHooks(result) + const combinedAfterGenerateHooks = combineAfterGenerateHooks(options?.afterGenerateHook) + await combinedAfterGenerateHooks(result) } return result } diff --git a/src/helper/ssg/utils.ts b/src/helper/ssg/utils.ts index 56289dfd..afc6c4aa 100644 --- a/src/helper/ssg/utils.ts +++ b/src/helper/ssg/utils.ts @@ -9,8 +9,8 @@ import { findTargetHandler, isMiddleware } from '../../utils/handler' * @returns Parent dir path */ export const dirname = (path: string): string => { - const splittedPath = path.split(/[\/\\]/) - return splittedPath.slice(0, -1).join('/') // Windows supports slash path + const separatedPath = path.split(/[\/\\]/) + return separatedPath.slice(0, -1).join('/') // Windows supports slash path } const normalizePath = (path: string): string => { diff --git a/src/hono-base.ts b/src/hono-base.ts index a10f28b6..365ad096 100644 --- a/src/hono-base.ts +++ b/src/hono-base.ts @@ -57,7 +57,7 @@ export type HonoOptions = { */ strict?: boolean /** - * `router` option specifices which router to use. + * `router` option specifies which router to use. * * @see {@link https://hono.dev/docs/api/hono#router-option} * diff --git a/src/jsx/index.test.tsx b/src/jsx/index.test.tsx index 78112d2c..aac11bc8 100644 --- a/src/jsx/index.test.tsx +++ b/src/jsx/index.test.tsx @@ -159,7 +159,7 @@ describe('render to string', () => { expect(template.toString()).toBe('

ab

') }) - it('Empty elements are rended withtout closing tag', () => { + it('Empty elements are rended without closing tag', () => { const template = expect(template.toString()).toBe('') }) diff --git a/src/middleware/ip-restriction/index.ts b/src/middleware/ip-restriction/index.ts index b17b2f41..5f741c7e 100644 --- a/src/middleware/ip-restriction/index.ts +++ b/src/middleware/ip-restriction/index.ts @@ -48,16 +48,16 @@ const buildMatcher = ( functionRules.push(rule) } else { if (IS_CIDR_NOTATION_REGEX.test(rule)) { - const splittedRule = rule.split('/') + const separatedRule = rule.split('/') - const addrStr = splittedRule[0] + const addrStr = separatedRule[0] const type = distinctRemoteAddr(addrStr) if (type === undefined) { throw new TypeError(`Invalid rule: ${rule}`) } const isIPv4 = type === 'IPv4' - const prefix = parseInt(splittedRule[1]) + const prefix = parseInt(separatedRule[1]) if (isIPv4 ? prefix === 32 : prefix === 128) { // this rule is a static rule diff --git a/src/router/trie-router/node.test.ts b/src/router/trie-router/node.test.ts index 1962a333..c4692c15 100644 --- a/src/router/trie-router/node.test.ts +++ b/src/router/trie-router/node.test.ts @@ -28,7 +28,7 @@ describe('Get with *', () => { }) }) -describe('Get with * inclusing JS reserved words', () => { +describe('Get with * including JS reserved words', () => { const node = new Node() node.insert('get', '*', 'get all') it('get /', () => { diff --git a/src/utils/ipaddr.test.ts b/src/utils/ipaddr.test.ts index d4cff8e1..b8598793 100644 --- a/src/utils/ipaddr.test.ts +++ b/src/utils/ipaddr.test.ts @@ -16,7 +16,7 @@ describe('expandIPv6', () => { }) }) describe('distinctRemoteAddr', () => { - it('Should result be valud', () => { + it('Should result be valid', () => { expect(distinctRemoteAddr('1::1')).toBe('IPv6') expect(distinctRemoteAddr('::1')).toBe('IPv6')