Skip to content

Commit 057f74f

Browse files
committed
chore: Migrated to biome and fixed formatter warnings
1 parent dc9cd67 commit 057f74f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+251
-253
lines changed

.github/workflows/build-artisan-binary.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

.github/workflows/lint.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

.vscode/settings.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22
"editor.tabSize": 2,
33
"editor.formatOnSave": true,
44
"editor.defaultFormatter": "biomejs.biome",
5+
"[javascript]": {
6+
"editor.defaultFormatter": "biomejs.biome"
7+
},
8+
"[typescript]": {
9+
"editor.defaultFormatter": "biomejs.biome"
10+
},
11+
"[typescriptreact]": {
12+
"editor.defaultFormatter": "biomejs.biome"
13+
},
514
"editor.codeActionsOnSave": {
615
"source.fixAll.biome": "explicit",
716
"source.organizeImports.biome": "explicit"

apps/api/client/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { hc } from "hono/client";
2+
import type { z } from "zod";
23
import type { AppType } from "../src";
34
import type { assetSchema, groupSchema } from "../src/schemas/assets";
45
import type { jobSchema } from "../src/schemas/jobs";
@@ -7,7 +8,6 @@ import type {
78
storageItemSchema,
89
} from "../src/schemas/storage";
910
import type { userSchema } from "../src/schemas/user";
10-
import type { z } from "zod";
1111

1212
export type Asset = z.infer<typeof assetSchema>;
1313

@@ -39,7 +39,7 @@ export function createClient(url: string, token: string | null = null) {
3939
headers: () => {
4040
const headers: Record<string, string> = {};
4141
if (token !== null) {
42-
headers["Authorization"] = `Bearer ${token}`;
42+
headers.Authorization = `Bearer ${token}`;
4343
}
4444
return headers;
4545
},

apps/api/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
},
1010
"scripts": {
1111
"dev": "bun --watch --inspect=ws://localhost:6499/sprs-api ./src/index.ts",
12-
"build": "bun build ./src/index.ts --target=bun --outdir=./dist && cp -r ./src/db/migrations ./dist"
12+
"build": "bun build ./src/index.ts --target=bun --outdir=./dist && cp -r ./src/db/migrations ./dist",
13+
"lint": "biome lint --write ./src ./client"
1314
},
1415
"devDependencies": {
1516
"@types/bun": "latest",

apps/api/src/db/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ export const db = new Kysely<KyselyDatabase>({
1010
});
1111

1212
types.setTypeParser(/* INT8_TYPE_ID= */ 20, (val) => {
13-
return parseInt(val, 10);
13+
return Number.parseInt(val, 10);
1414
});

apps/api/src/db/migrate.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,14 @@ async function migrateToLatest() {
2424

2525
const { error, results } = await migrator.migrateToLatest();
2626

27-
results?.forEach((it) => {
27+
const allResults = results ?? [];
28+
for (const it of allResults) {
2829
if (it.status === "Success") {
2930
console.log(`Migration "${it.migrationName}" was executed successfully`);
3031
} else if (it.status === "Error") {
3132
console.error(`Failed to execute migration "${it.migrationName}"`);
3233
}
33-
});
34+
};
3435

3536
if (error) {
3637
console.error("Failed to migrate");

apps/api/src/db/migrations/2024_10_26_init.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
/* eslint-disable @typescript-eslint/no-explicit-any */
2-
31
import { sql } from "kysely";
42
import type { Kysely } from "kysely";
53

4+
// biome-ignore lint/suspicious/noExplicitAny: Use any
65
export async function up(db: Kysely<any>) {
76
await db.schema
87
.createTable("users")
@@ -49,6 +48,7 @@ export async function up(db: Kysely<any>) {
4948
.execute();
5049
}
5150

51+
// biome-ignore lint/suspicious/noExplicitAny: Use any
5252
export async function down(db: Kysely<any>) {
5353
await db.schema.dropTable("users").execute();
5454
await db.schema.dropTable("groups").execute();
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
/* eslint-disable @typescript-eslint/no-explicit-any */
2-
31
import type { Kysely } from "kysely";
42

3+
// biome-ignore lint/suspicious/noExplicitAny: Use any
54
export async function up(db: Kysely<any>) {
65
await db.schema.alterTable("assets").addColumn("name", "text").execute();
76
}
87

8+
// biome-ignore lint/suspicious/noExplicitAny: Use any
99
export async function down(db: Kysely<any>) {
1010
await db.schema.alterTable("assets").dropColumn("name").execute();
1111
}

apps/api/src/repositories/jobs.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ import {
77
transcodeQueue,
88
} from "bolt";
99
import { FlowProducer, Job as RawJob } from "bullmq";
10+
import type { JobNode, JobState, Queue } from "bullmq";
1011
import { env } from "../env";
1112
import { isRecordWithNumbers } from "../utils/type-guard";
12-
import type { JobNode, JobState, Queue } from "bullmq";
1313

1414
const flowProducer = new FlowProducer({
1515
connection: {
@@ -36,7 +36,7 @@ function findQueueByName(name: string): Queue {
3636
if (!queue) {
3737
throw new Error("No queue found.");
3838
}
39-
return queue;
39+
return queue as unknown as Queue;
4040
}
4141

4242
/**
@@ -199,7 +199,8 @@ async function getJobNode(
199199
* @param job
200200
* @returns
201201
*/
202-
async function findRootJob(job?: RawJob): Promise<RawJob | null> {
202+
async function findRootJob(inputJob?: RawJob): Promise<RawJob | null> {
203+
let job = inputJob;
203204
if (!job) {
204205
return null;
205206
}

0 commit comments

Comments
 (0)