style: add prettier

Summary:

Test Plan:
This commit is contained in:
2024-05-14 21:59:38 -04:00
parent f78ad2d2dd
commit 29345a7bd1
8 changed files with 34 additions and 18 deletions

3
.gitignore vendored
View File

@@ -4,7 +4,4 @@ dist
.dev.vars
# Change them to your taste:
package-lock.json
yarn.lock
pnpm-lock.yaml
bun.lockb

7
.prettierignore Normal file
View File

@@ -0,0 +1,7 @@
# Ignore artifacts:
build
coverage
node_modules
bun.lockb
.prettierignore
.gitignore

6
.prettierrc Normal file
View File

@@ -0,0 +1,6 @@
{
"plugins": ["@trivago/prettier-plugin-sort-imports", "prettier-plugin-toml"],
"importOrder": ["^bun:.+$", "^node:.+$", "^~/.+$", "^[./]"],
"importOrderSeparation": true,
"importOrderSortSpecifiers": true
}

View File

@@ -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
```

View File

@@ -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"
}
}

View File

@@ -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;

View File

@@ -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"
},
}
}
}

View File

@@ -18,4 +18,4 @@ compatibility_date = "2023-12-01"
# database_id = ""
# [ai]
# binding = "AI"
# binding = "AI"