Skip to content

Commit 2cc3ab1

Browse files
committed
fix(config): use biome for all
1 parent b992d03 commit 2cc3ab1

File tree

9 files changed

+52
-72
lines changed

9 files changed

+52
-72
lines changed

.github/workflows/static.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,10 @@ jobs:
1717
with:
1818
bun-version: 1.2.2
1919
- uses: biomejs/setup-biome@v2
20-
- uses: denoland/setup-deno@v2
2120
- run: bun install --frozen-lockfile
2221
- run: bun check
2322
- run: biome lint .
24-
- run: deno fmt --check
23+
- run: biome format .
2524
nix-checks:
2625
name: Nix checks
2726
runs-on: ubuntu-latest

.helix/languages.toml

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
[language-server]
2-
deno = { command = "deno", args = ["lsp"] }
1+
# [language-server]
2+
# deno = { command = "deno", args = ["lsp"] }
33

44
[[language]]
55
name = "nix"
@@ -30,4 +30,8 @@ language-servers = ["tailwindcss-ls", "svelteserver"]
3030

3131
[[language]]
3232
name = "typescript"
33-
formatter = { command = "deno", args = ["fmt", "-"] }
33+
formatter = { command = "biome", args = [
34+
"format",
35+
"--stdin-file-path",
36+
"a.ts",
37+
] }

biome.jsonc

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"ignore": []
1111
},
1212
"formatter": {
13-
"enabled": false, // turned off until HTML + svelte full support
13+
"enabled": true, // HTML-ish support when?
14+
"lineWidth": 120,
1415
"indentStyle": "space",
1516
"indentWidth": 2
1617
},

deno.jsonc

-11
This file was deleted.

lefthook.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ pre-commit:
3030
run: cd service; bun run cf-typegen
3131
stage_fixed: true
3232
# JS
33-
deno-fmt:
33+
biome-fmt:
3434
tags: js style
3535
glob: "*.{js,ts,svelte,html,md}"
36-
run: deno fmt {staged_files}
36+
run: biome format {staged_files} --fix
3737
stage_fixed: true
3838
biome-lint:
3939
tags: js lint

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
":dev": "trap 'kill 0' EXIT; (cd web; bun run dev) & (cd service; bun run dev) & wait",
1616
"check": "bun check:style && bun check:type",
1717
"check:type": "(cd web && bun check:type) && (cd service && bun check:type) && (cd share && bun run check:type)",
18-
"check:style": "deno fmt --check . && biome lint .",
18+
"check:style": "biome check .",
1919
"fix": "bun fix:style",
20-
"fix:style": "deno fmt . && biome lint --fix .",
20+
"fix:style": "biome check --fix .",
2121
"db": "cd service; rm ../local.db; DATABASE_URL=file:../local.db bun db push --force",
2222
"build": "(cd service && bun run build) && (cd web && bun run build)",
2323
"test": "cd share; bun run test",

service/routes/projects/index.ts

+38-29
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,25 @@ import preferenceRoutes from "./preferences.ts";
1313

1414
const route = new Hono<HonoOptions>()
1515
.route("/:projectId/preferences", preferenceRoutes)
16+
1617
.get("/mine", async (c) => {
1718
const browser_id = await getBrowserID(c);
1819
const project_resp = await db(c)
1920
.select()
2021
.from(projects)
2122
.innerJoin(participants, eq(projects.id, participants.project_id))
2223
.where(eq(participants.browser_id, browser_id));
23-
return c.json(project_resp.map(
24-
(p) => ({
24+
return c.json(
25+
project_resp.map((p) => ({
2526
id: p.projects.id,
2627
name: p.projects.name,
2728
description: p.projects.description,
2829
closed_at: p.projects.closed_at,
2930
is_admin: p.participants.is_admin,
30-
}),
31-
));
31+
})),
32+
);
3233
})
34+
3335
.get(
3436
"/:projectId",
3537
param({
@@ -47,16 +49,21 @@ const route = new Hono<HonoOptions>()
4749
return project;
4850
});
4951

50-
const prev_participant_data = (await db(c).select({
51-
id: participants.id,
52-
name: participants.name,
53-
}).from(participants).where(
54-
and(
55-
eq(participants.project_id, projectId),
56-
eq(participants.browser_id, browser_id),
57-
eq(participants.is_admin, 0),
58-
),
59-
))[0];
52+
const prev_participant_data = (
53+
await db(c)
54+
.select({
55+
id: participants.id,
56+
name: participants.name,
57+
})
58+
.from(participants)
59+
.where(
60+
and(
61+
eq(participants.project_id, projectId),
62+
eq(participants.browser_id, browser_id),
63+
eq(participants.is_admin, 0),
64+
),
65+
)
66+
)[0];
6067
// エンティティの roles と被るため role_resp
6168
const role_resp = db(c)
6269
.select({
@@ -67,17 +74,15 @@ const route = new Hono<HonoOptions>()
6774
prev: ratings.score,
6875
})
6976
.from(roles)
70-
.where(eq(
71-
roles.project_id,
72-
projectId,
73-
))
77+
.where(eq(roles.project_id, projectId))
7478
.leftJoin(
7579
ratings,
7680
and(
7781
eq(ratings.role_id, roles.id),
7882
eq(ratings.participant_id, prev_participant_data?.id ?? "never"), // omit if prev_userdata doesn't exist
7983
),
80-
).execute();
84+
)
85+
.execute();
8186
return c.json({
8287
project: await project,
8388
roles: await role_resp,
@@ -89,15 +94,18 @@ const route = new Hono<HonoOptions>()
8994
const browser_id = await getBrowserID(c);
9095
const project_id = crypto.randomUUID();
9196
const body = c.req.valid("json");
92-
const project_resp = (await db(c)
93-
.insert(projects)
94-
.values([
95-
{
96-
id: project_id,
97-
name: body.name,
98-
description: body.description,
99-
},
100-
]).returning())[0];
97+
const project_resp = (
98+
await db(c)
99+
.insert(projects)
100+
.values([
101+
{
102+
id: project_id,
103+
name: body.name,
104+
description: body.description,
105+
},
106+
])
107+
.returning()
108+
)[0];
101109
if (!project_resp) throw new HTTPException(500, { message: "failed to create project" });
102110
await db(c)
103111
.insert(participants)
@@ -121,7 +129,8 @@ const route = new Hono<HonoOptions>()
121129
max: r.max,
122130
project_id: project_id,
123131
})),
124-
).returning();
132+
)
133+
.returning();
125134
return c.json({
126135
...project_resp,
127136
roles: roles_resp,

shell.nix

-2
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ pkgs.mkShell {
99

1010
# JS
1111
bun # runner / tester
12-
biome # style checker / linter ... replaced by deno because biome doesn't support HTML and svelte
1312
nodejs-slim # required by drizzle?
14-
deno # used to format svelte
1513

1614
wrangler
1715

treefmt.nix

-20
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,4 @@
11
let
2-
deno-includes = [
3-
"*.css"
4-
"*.html"
5-
"*.js"
6-
"*.json"
7-
"*.jsonc"
8-
"*.jsx"
9-
"*.less"
10-
"*.markdown"
11-
"*.md"
12-
"*.sass"
13-
"*.scss"
14-
"*.ts"
15-
"*.tsx"
16-
"*.yaml"
17-
"*.yml"
18-
"*.svelte"
19-
];
202
global-excludes = [
213
"node_modules"
224
".gitignore"
@@ -41,8 +23,6 @@ in {
4123
mdformat.enable = true;
4224

4325
# JS
44-
deno.enable = true;
45-
deno.includes = deno-includes;
4626
biome.enable = true;
4727

4828
# Nix

0 commit comments

Comments
 (0)