chore: add editorconfig-checker (#4312)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
* chore(deps): add editorconfig-checker to devDependencies * style: apply editorconfig-checker suggestions * chore: unset charset and newline settings in `.editorconfig` for `.lockb` and `.pxm` files * chore: add editorconfig-checker script to `package.json` * test: update static response assertions to match optional newline
authored by 3w36zj6 · committed by GitHub · parent f91ec14 · Browse files · 19 files·+38 added−28 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
19 files+38 added−28 removed
- tests:+8 added−8 removed
- other:+30 added−20 removed
Provenance
- Commit
d02366f- Tree
69099c5- Author
3w36zj6 <52315048+3w36zj6@users.noreply.github.com>- Committer
GitHub <noreply@github.com>- Parent
f91ec14
19 files changed+38 added−28 removed
modified:benchmarks/deno/.gitignore+1 added-1 removed
1-*.sqlite1+*.sqlitemodified:benchmarks/http-server/.gitignore+1 added-1 removed
1 .benchmark-temp/2-benchmark-results.md2+benchmark-results.mdmodified:benchmarks/utils/.gitignore+1 added-1 removed
1 yarn.lock2-bun.lockb2+bun.lockbmodified:benchmarks/webapp/.gitignore+1 added-1 removed
1-yarn.lock1+yarn.lockmodified:docs/MIGRATION.md+4 added-4 removed
266 unmodified lines267 You do not have to use Body parse middleware to parse request body. Use `c.req.parseBody()` method instead.268 269 ```ts270 // Parse Request body271- app.post('', (c) => {272- const body = c.req.parseBody()273- ...274- })271+app.post('', (c) => {272+ const body = c.req.parseBody()273+ ...274+})275 ```276 277 ### GraphQL Server middleware is obsolete278 17 unmodified linesmodified:runtime-tests/bun/.static/plain.txt+1 added-1 removed
1-Bun!!1+Bun!!modified:runtime-tests/bun/static/download+1 added-1 removed
1-download1+downloadmodified:runtime-tests/bun/static/plain.txt+1 added-1 removed
1-Bun!1+Bun!modified:runtime-tests/bun/static-absolute-root/plain.txt+1 added-1 removed
1-Bun!1+Bun!modified:runtime-tests/bun/index.test.tsx+4 added-4 removed
130 unmodified lines131 132 it('Should return 200 response - /static/plain.txt', async () => {133 const res = await app.request(new Request('http://localhost/static/plain.txt'))134 expect(res.status).toBe(200)135- expect(await res.text()).toBe('Bun!')135+ expect(await res.text()).toMatch(/^Bun!(\r?\n)?$/)136 expect(onNotFound).not.toHaveBeenCalled()137 })138 139 it('Should return 200 response - /static/download', async () => {140 const res = await app.request(new Request('http://localhost/static/download'))141 expect(res.status).toBe(200)142- expect(await res.text()).toBe('download')142+ expect(await res.text()).toMatch(/^download(\r?\n)?$/)143 expect(onNotFound).not.toHaveBeenCalled()144 })145 146 it('Should return 200 response - /dot-static/plain.txt', async () => {147 const res = await app.request(new Request('http://localhost/dot-static/plain.txt'))148 expect(res.status).toBe(200)149- expect(await res.text()).toBe('Bun!!')149+ expect(await res.text()).toMatch(/^Bun!!(\r?\n)?$/)150 })151 152 it('Should return 200 response - /static/helloworld', async () => {153 const res = await app.request('http://localhost/static/helloworld')9 unmodified lines163 164 it('Should return 200 response - /static-absolute-root/plain.txt', async () => {165 const res = await app.request('http://localhost/static-absolute-root/plain.txt')166 expect(res.status).toBe(200)167- expect(await res.text()).toBe('Bun!')167+ expect(await res.text()).toMatch(/^Bun!(\r?\n)?$/)168 expect(onNotFound).not.toHaveBeenCalled()169 })170 })171 281 unmodified linesmodified:runtime-tests/deno/.static/plain.txt+1 added-1 removed
1-Deno!!1+Deno!!modified:runtime-tests/deno/static/download+1 added-1 removed
1-download1+downloadmodified:runtime-tests/deno/static/plain.txt+1 added-1 removed
1-Deno!1+Deno!modified:runtime-tests/deno/static-absolute-root/plain.txt+1 added-1 removed
1-Deno!1+Deno!modified:runtime-tests/deno/middleware.test.tsx+4 added-4 removed
108 unmodified lines109 assertSpyCall(onNotFound, 0)110 111 res = await app.request('http://localhost/static/plain.txt')112 assertEquals(res.status, 200)113- assertEquals(await res.text(), 'Deno!')113+ assertMatch(await res.text(), /^Deno!(\r?\n)?$/)114 115 res = await app.request('http://localhost/static/download')116 assertEquals(res.status, 200)117- assertEquals(await res.text(), 'download')117+ assertMatch(await res.text(), /^download(\r?\n)?$/)118 119 res = await app.request('http://localhost/dot-static/plain.txt')120 assertEquals(res.status, 200)121- assertEquals(await res.text(), 'Deno!!')121+ assertMatch(await res.text(), /^Deno!!(\r?\n)?$/)122 assertSpyCalls(onNotFound, 1)123 124 res = await app.fetch({125 method: 'GET',11 unmodified lines137 assertEquals(await res.text(), 'Hi\n')138 139 res = await app.request('http://localhost/static-absolute-root/plain.txt')140 assertEquals(res.status, 200)141- assertEquals(await res.text(), 'Deno!')141+ assertMatch(await res.text(), /^Deno!(\r?\n)?$/)142 143 res = await app.request('http://localhost/static')144 assertEquals(res.status, 404)145 assertEquals(await res.text(), '404 Not Found')41 unmodified linesmodified:src/utils/url.ts+3 added-3 removed
164 unmodified lines165 }166 167 export const checkOptionalParameter = (path: string): string[] | null => {168 /*169- If path is `/api/animals/:type?` it will return:170- [`/api/animals`, `/api/animals/:type`]171- in other cases it will return null169+ If path is `/api/animals/:type?` it will return:170+ [`/api/animals`, `/api/animals/:type`]171+ in other cases it will return null172 */173 174 if (path.charCodeAt(path.length - 1) !== 63 || !path.includes(':')) {175 return null137 unmodified linesmodified:.editorconfig+5 added
12 unmodified lines13 [*.{md,yaml,yml}]14 indent_style = space15 indent_size = 216 trim_trailing_whitespace = false17+18+[*.{lockb,pxm}]19+charset = unset20+insert_final_newline = unset21+end_of_line = unsetmodified:bun.lock+3 added
12 unmodified lines13 "@typescript/native-preview": "7.0.0-dev.20250523.1",14 "@vitest/coverage-v8": "^3.0.5",15 "arg": "^5.0.2",16 "bun-types": "^1.1.39",17+ "editorconfig-checker": "^6.1.0",18 "esbuild": "^0.15.18",19 "eslint": "^9.10.0",20 "glob": "^11.0.0",21 "jsdom": "^22.1.0",638 unmodified lines660 "dot-prop": ["dot-prop@9.0.0", "", { "dependencies": { "type-fest": "^4.18.2" } }, "sha512-1gxPBJpI/pcjQhKgIU91II6Wkay+dLcN3M6rf2uwP8hRur3HtQXjVrdAK3sjC0piaEuxzMwjXChcETiJl47lAQ=="],661 662 "eastasianwidth": ["eastasianwidth@0.2.0", "", {}, "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA=="],663 664+ "editorconfig-checker": ["editorconfig-checker@6.1.0", "", { "bin": { "ec": "dist/index.js", "editorconfig-checker": "dist/index.js" } }, "sha512-i25NwXlcWhadiO62AFUauucFPi9LwasoMRqoM8KkG3rJp6bx09mL/fDQpNMz2f6Nx/7EPVIZHK5/tIdztWzflA=="],665+666 "elegant-spinner": ["elegant-spinner@1.0.1", "", {}, "sha512-B+ZM+RXvRqQaAmkMlO/oSe5nMUOaUnyfGYCEHoR8wrXsZR2mA0XVibsxV1bvTwxdRWah1PkQqso2EzhILGHtEQ=="],667 668 "emoji-regex": ["emoji-regex@8.0.0", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="],669 1519 unmodified linesmodified:package.json+3 added-1 removed
22 unmodified lines23 "lint": "eslint src runtime-tests build perf-measures benchmarks",24 "lint:fix": "eslint src runtime-tests build perf-measures benchmarks --fix",25 "format": "prettier --check --cache \"src/**/*.{js,ts,tsx}\" \"runtime-tests/**/*.{js,ts,tsx}\" \"build/**/*.{js,ts,tsx}\" \"perf-measures/**/*.{js,ts,tsx}\" \"benchmarks/**/*.{js,ts,tsx}\"",26 "format:fix": "prettier --write --cache --cache-strategy metadata \"src/**/*.{js,ts,tsx}\" \"runtime-tests/**/*.{js,ts,tsx}\" \"build/**/*.{js,ts,tsx}\" \"perf-measures/**/*.{js,ts,tsx}\" \"benchmarks/**/*.{js,ts,tsx}\"",27+ "editorconfig-checker": "editorconfig-checker",28 "copy:package.cjs.json": "cp ./package.cjs.json ./dist/cjs/package.json && cp ./package.cjs.json ./dist/types/package.json",29 "build": "bun run --shell bun remove-dist && bun ./build/build.ts && bun run copy:package.cjs.json",30 "postbuild": "publint",31 "watch": "bun run --shell bun remove-dist && bun ./build/build.ts --watch && bun run copy:package.cjs.json",633 unmodified lines665 "@typescript/native-preview": "7.0.0-dev.20250523.1",666 "@vitest/coverage-v8": "^3.0.5",667 "arg": "^5.0.2",668 "bun-types": "^1.1.39",669+ "editorconfig-checker": "^6.1.0",670 "esbuild": "^0.15.18",671 "eslint": "^9.10.0",672 "glob": "^11.0.0",673 "jsdom": "^22.1.0",12 unmodified lines686 },687 "engines": {688 "node": ">=16.9.0"689 }688-}690+}