Skip to content
Myr

refactor: automate `import` sorting (#157)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Yusuke Wada · committed by GitHub · parent ac713c0 · Browse files · 15 files+35 added−19 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

15 files+35 added−19 removed

  • tests:+5 added−5 removed
  • other:+30 added−14 removed

15 files+35 added−19 removed

added:.vscode/settings.json+11 added
modified:src/middleware/basic-auth/index.test.ts+1 added-1 removed
modified:src/middleware/body-parse/index.ts+2 added-2 removed
modified:src/middleware/etag/index.ts+2 added-2 removed
modified:src/middleware/graphql-server/index.test.ts+2 added-2 removed
1import { Hono } from '@/hono'2import { errorMessages, graphqlServer } from '@/middleware/graphql-server'1import {2 buildSchema,3 GraphQLSchema,4 GraphQLString,5 GraphQLObjectType,6 GraphQLNonNull,7} from 'graphql'8import { Hono } from '@/hono'9import { errorMessages, graphqlServer } from '@/middleware/graphql-server'1011describe('errorMessages', () => {12 const messages = errorMessages(['message a', 'message b'])13 expect(messages).toEqual({
550 unmodified lines
modified:src/middleware/graphql-server/index.ts+2 added-2 removed
1// Based on the code in the `express-graphql` package.2// https://github.com/graphql/express-graphql/blob/main/src/index.ts34import { parseBody } from '@/middleware/graphql-server/parse-body'5import type { Context } from '@/context'45import {6 Source,7 parse,
11 unmodified lines
19 ValidationRule,20 FormattedExecutionResult,21 GraphQLFormattedError,22} from 'graphql'23import type { Context } from '@/context'24import { parseBody } from '@/middleware/graphql-server/parse-body'2526type Options = {27 schema: GraphQLSchema28 rootValue?: unknown
211 unmodified lines
modified:src/middleware/logger/index.ts+1 added-1 removed
1import { getPathFromURL } from '@/utils/url'1import type { Context } from '@/context'2import { getPathFromURL } from '@/utils/url'34const humanize = (n: string[], opts?: { delimiter?: string; separator?: string }) => {5 const options = opts || {}6 const d = options.delimiter || ','
64 unmodified lines
modified:src/middleware/mustache/index.ts+1 added-1 removed
1import type { Context } from '@/context'1import { getContentFromKVAsset, getKVFilePath } from '../../utils/cloudflare'2import type { Context } from '@/context'34const EXTENSION = '.mustache'5const DEFAULT_DOCUMENT = 'index.mustache'6
67 unmodified lines
modified:src/router/reg-exp-router/router.test.ts+1 added-1 removed
1import { RegExpRouter } from '@/router/reg-exp-router/router'1import { METHOD_NAME_OF_ALL } from '@/router'2import { RegExpRouter } from '@/router/reg-exp-router/router'34describe('Basic Usage', () => {5 const router = new RegExpRouter<string>()6
91 unmodified lines
modified:src/router/trie-router/node.ts+1 added-1 removed
1import { Result, METHOD_NAME_OF_ALL } from '@/router'2import type { Pattern } from '@/utils/url'3import { splitPath, getPattern } from '@/utils/url'3import { Result, METHOD_NAME_OF_ALL } from '@/router'45const noRoute = (): null => {6 return null7}
113 unmodified lines
modified:src/utils/buffer.test.ts+1 added-1 removed
1import { timingSafeEqual } from '@/utils/buffer'1import { SHA256 as sha256CryptoJS } from 'crypto-js'2import { timingSafeEqual } from '@/utils/buffer'34describe('buffer', () => {5 it('positive', async () => {6 expect(
37 unmodified lines
modified:src/context.ts+1 added-1 removed
1import { isAbsoluteURL } from '@/utils/url'1import { getStatusText } from '@/utils/http-status'2import { isAbsoluteURL } from '@/utils/url'34type Headers = Record<string, string>5type Data = string | ArrayBuffer | ReadableStream6
129 unmodified lines
modified:src/hono.ts+3 added-3 removed
1import { compose } from '@/compose'2import { getPathFromURL, mergePath } from '@/utils/url'2import { Context } from '@/context'4import { METHOD_NAME_OF_ALL } from '@/router'5import { TrieRouter } from '@/router/trie-router' // Default Router3import type { Env } from '@/context'4import { METHOD_NAME_OF_ALL } from '@/router'5import type { Result, Router } from '@/router'6import { TrieRouter } from '@/router/trie-router' // Default Router7import { getPathFromURL, mergePath } from '@/utils/url'89declare global {10 interface Request<ParamKeyType = string> {11 param: (key: ParamKeyType) => string
214 unmodified lines
modified:.eslintrc.js+4 added
11 unmodified lines
12 parserOptions: {13 sourceType: 'module',14 ecmaVersion: 2021,15 },16 plugins: ['@typescript-eslint', 'import'],17 globals: {18 fetch: false,19 Response: false,20 Request: false,
19 unmodified lines
40 Function: false,41 },42 },43 ],44 'sort-imports': 0,45 'import/order': [2, { alphabetize: { order: 'asc' } }],4647 'node/no-missing-import': 'off',48 'node/no-missing-require': 'off',49 'node/no-deprecated-api': 'off',50 'node/no-unpublished-import': 'off',
10 unmodified lines
modified:package.json+2 added-1 removed
7 unmodified lines
8 "dist"9 ],10 "scripts": {11 "test": "jest",12 "lint": "eslint --ext js,ts src .eslintrc.js && prettier --check src",12 "lint": "eslint --ext js,ts src .eslintrc.js",13 "lint:fix": "eslint --ext js,ts src .eslintrc.js --fix",14 "build": "rimraf dist && tsc --project tsconfig.build.json && tsc-alias -p tsconfig.build.json",15 "watch": "tsc -w --project tsconfig.build.json & tsc-alias -w -p tsconfig.build.json",16 "prepublishOnly": "yarn build"17 },
115 unmodified lines