diff --git a/.gitignore b/.gitignore index 3c0be6e..cae57e8 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,4 @@ dist .dev.vars # Change them to your taste: -package-lock.json -yarn.lock -pnpm-lock.yaml bun.lockb \ No newline at end of file diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..fe99c18 --- /dev/null +++ b/.prettierignore @@ -0,0 +1,7 @@ +# Ignore artifacts: +build +coverage +node_modules +bun.lockb +.prettierignore +.gitignore \ No newline at end of file diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..5479111 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,6 @@ +{ + "plugins": ["@trivago/prettier-plugin-sort-imports", "prettier-plugin-toml"], + "importOrder": ["^bun:.+$", "^node:.+$", "^~/.+$", "^[./]"], + "importOrderSeparation": true, + "importOrderSortSpecifiers": true +} diff --git a/README.md b/README.md index cc58e96..7dce3b3 100644 --- a/README.md +++ b/README.md @@ -6,3 +6,10 @@ npm run dev ``` npm run deploy ``` + +pre-commit hook for Sapling (`.sl/config`): + +``` +[hooks] +precommit = echo $HG_PARENT1 && bun prettier $(sl show -T "{file_adds} {file_mods}\n\n" $HG_PARENT1 --stat | head -n 1) --write +``` diff --git a/package.json b/package.json index 17fcf2a..38c97b5 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,9 @@ }, "devDependencies": { "@cloudflare/workers-types": "^4.20240403.0", + "@trivago/prettier-plugin-sort-imports": "^4.3.0", + "prettier": "^3.2.5", + "prettier-plugin-toml": "^2.0.1", "wrangler": "^3.47.0" } } diff --git a/src/index.ts b/src/index.ts index 3191383..9869eb8 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,9 +1,9 @@ -import { Hono } from 'hono' +import { Hono } from "hono"; -const app = new Hono() +const app = new Hono(); -app.get('/', (c) => { - return c.text('Hello Hono!') -}) +app.get("/", (c) => { + return c.text("Hello Hono!"); +}); -export default app +export default app; diff --git a/tsconfig.json b/tsconfig.json index c00e6fb..612fe2c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,13 +5,9 @@ "moduleResolution": "Bundler", "strict": true, "skipLibCheck": true, - "lib": [ - "ESNext" - ], - "types": [ - "@cloudflare/workers-types" - ], + "lib": ["ESNext"], + "types": ["@cloudflare/workers-types"], "jsx": "react-jsx", "jsxImportSource": "hono/jsx" - }, -} \ No newline at end of file + } +} diff --git a/wrangler.toml b/wrangler.toml index eaae390..f48f997 100644 --- a/wrangler.toml +++ b/wrangler.toml @@ -18,4 +18,4 @@ compatibility_date = "2023-12-01" # database_id = "" # [ai] -# binding = "AI" \ No newline at end of file +# binding = "AI"