Skip to content

Commit 02a255b

Browse files
committed
chore(biome): apply autofixes and clear lint warnings
1 parent e7c8a5d commit 02a255b

File tree

15 files changed

+57
-53
lines changed

15 files changed

+57
-53
lines changed

packages/common/src/Resources.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,8 @@ export interface Resources<
6565
}
6666

6767
/** Error when trying to remove a consumer from a resource that doesn't exist. */
68-
export interface ResourceNotFoundError<
69-
TResourceKey extends string = string,
70-
> extends Typed<"ResourceNotFoundError"> {
68+
export interface ResourceNotFoundError<TResourceKey extends string = string>
69+
extends Typed<"ResourceNotFoundError"> {
7170
readonly resourceKey: TResourceKey;
7271
}
7372

packages/common/src/Sqlite.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ import { createRecord } from "./Object.js";
1212
import type { Result } from "./Result.js";
1313
import { ok } from "./Result.js";
1414
import type { Run, Task } from "./Task.js";
15-
import { testCreateRun, type TestDeps, testName } from "./Test.js";
15+
import { type TestDeps, testCreateRun, testName } from "./Test.js";
1616
import type { InferType, Name, Typed } from "./Type.js";
1717
import {
1818
array,
1919
Null,
2020
Number,
2121
object,
2222
record,
23-
set,
2423
String,
24+
set,
2525
Uint8Array,
2626
union,
2727
} from "./Type.js";
@@ -223,7 +223,7 @@ export const createSqlite =
223223
return result as SqliteExecResult<R>;
224224
},
225225

226-
transaction: ((callback: () => Result<unknown, unknown> | void) => {
226+
transaction: ((callback: () => Result<unknown, unknown> | undefined) => {
227227
console.debug("begin");
228228
driver.exec(sql`begin;`);
229229

packages/common/src/local-first/Db.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import type {
1818
RandomBytesDep,
1919
} from "../Crypto.js";
2020
import { getProperty, objectToEntries } from "../Object.js";
21-
import type { LeaderLockDep } from "../Task.js";
2221
import type { RandomDep } from "../Random.js";
2322
import { getOk, ok, type Result } from "../Result.js";
2423
import { spaced } from "../Schedule.js";
@@ -34,6 +33,7 @@ import {
3433
type SqliteValue,
3534
sql,
3635
} from "../Sqlite.js";
36+
import type { LeaderLockDep } from "../Task.js";
3737
import { type AsyncDisposableStack, repeat, type Task } from "../Task.js";
3838
import { type Millis, millisToDateIso, type TimeDep } from "../Time.js";
3939
import type { Name } from "../Type.js";

packages/common/src/local-first/Evolu.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { isNonEmptySet } from "../Set.js";
2020
import { SqliteBoolean, sqliteBooleanToBoolean } from "../Sqlite.js";
2121
import type { ReadonlyStore } from "../Store.js";
2222
import { createStore } from "../Store.js";
23-
import { type createRun, type Task } from "../Task.js";
23+
import type { createRun, Task } from "../Task.js";
2424
import type { Id, TypeError } from "../Type.js";
2525
import {
2626
brand,

packages/common/src/local-first/Schema.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,20 @@ import {
1111
eqSqliteIndex,
1212
getSqliteSchema,
1313
type SafeSql,
14-
sql,
1514
SqliteBoolean,
1615
type SqliteDep,
1716
type SqliteIndex,
1817
type SqliteQuery,
1918
type SqliteQueryOptions,
2019
type SqliteSchema,
21-
SqliteValue,
20+
type SqliteValue,
21+
sql,
2222
} from "../Sqlite.js";
2323
import type { InferType } from "../Type.js";
2424
import {
2525
DateIso,
2626
type Id,
27-
IdBytes,
27+
type IdBytes,
2828
nullOr,
2929
object,
3030
type StandardSchemaV1,
@@ -35,7 +35,7 @@ import { OwnerId } from "./Owner.js";
3535
import type { Query, Row } from "./Query.js";
3636
import { serializeQuery } from "./Query.js";
3737
import type { CrdtMessage, DbChange } from "./Storage.js";
38-
import { TimestampBytes } from "./Timestamp.js";
38+
import type { TimestampBytes } from "./Timestamp.js";
3939

4040
/** Any {@link StandardSchemaV1}. */
4141
export type AnyStandardSchemaV1 = StandardSchemaV1<any, any>;

packages/common/src/local-first/Storage.ts

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import type { RandomDep } from "../Random.js";
1515
import type { Result } from "../Result.js";
1616
import { err, ok } from "../Result.js";
1717
import type { SqliteDep } from "../Sqlite.js";
18-
import { sql, SqliteValue } from "../Sqlite.js";
18+
import { SqliteValue, sql } from "../Sqlite.js";
1919
import type { Task } from "../Task.js";
2020
import { Millis } from "../Time.js";
2121
import type { InferType, Int64String, Typed, TypeError } from "../Type.js";
@@ -31,14 +31,19 @@ import {
3131
String,
3232
} from "../Type.js";
3333
import type { Awaitable } from "../Types.js";
34-
import type { Owner, OwnerError, OwnerIdBytes } from "./Owner.js";
35-
import { OwnerId, OwnerWriteKey } from "./Owner.js";
34+
import type {
35+
Owner,
36+
OwnerError,
37+
OwnerId,
38+
OwnerIdBytes,
39+
OwnerWriteKey,
40+
} from "./Owner.js";
3641
import { systemColumnsWithId } from "./Schema.js";
3742
import {
3843
createTimestamp,
3944
orderTimestampBytes,
40-
Timestamp,
41-
TimestampBytes,
45+
type Timestamp,
46+
type TimestampBytes,
4247
} from "./Timestamp.js";
4348

4449
export interface StorageConfig {
@@ -1490,14 +1495,19 @@ const fingerprintRanges =
14901495
`);
14911496

14921497
const fingerprintRanges = result.rows.map(
1493-
(row, i, arr): FingerprintRange => ({
1494-
type: RangeType.Fingerprint,
1495-
upperBound: i === arr.length - 1 ? upperBound : row.b!,
1496-
fingerprint: sqliteFingerprintToFingerprint([
1497-
row.h1,
1498-
row.h2,
1499-
] as SqliteFingerprint),
1500-
}),
1498+
(row, i, arr): FingerprintRange => {
1499+
const nextUpperBound = i === arr.length - 1 ? upperBound : row.b;
1500+
assert(nextUpperBound, "Expected fingerprint upper bound.");
1501+
1502+
return {
1503+
type: RangeType.Fingerprint,
1504+
upperBound: nextUpperBound,
1505+
fingerprint: sqliteFingerprintToFingerprint([
1506+
row.h1,
1507+
row.h2,
1508+
] as SqliteFingerprint),
1509+
};
1510+
},
15011511
);
15021512

15031513
return fingerprintRanges;

packages/common/test/Resources.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { expect, test } from "vitest";
22
import type { Brand } from "../src/Brand.js";
33
import { createResources } from "../src/Resources.js";
44
import { err } from "../src/Result.js";
5-
import { testCreateTime, type Duration } from "../src/Time.js";
5+
import { type Duration, testCreateTime } from "../src/Time.js";
66

77
interface Resource extends Disposable {
88
readonly id: ResourceKey;

packages/common/test/Sqlite.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,21 @@ import { lazyVoid } from "../src/Function.js";
33
import { err, ok } from "../src/Result.js";
44
import {
55
booleanToSqliteBoolean,
6+
type CreateSqliteDriver,
67
createPreparedStatementsCache,
78
createSqlite,
89
eqSqliteIndex,
910
eqSqliteValue,
1011
getSqliteSchema,
1112
getSqliteSnapshot,
13+
type SafeSql,
14+
type SqliteDriver,
15+
type SqliteValue,
1216
sql,
1317
sqliteBooleanToBoolean,
1418
sqliteFalse,
1519
sqliteTrue,
1620
testCreateRunWithSqlite,
17-
type CreateSqliteDriver,
18-
type SafeSql,
19-
type SqliteDriver,
20-
type SqliteValue,
2121
} from "../src/Sqlite.js";
2222
import { sleep } from "../src/Task.js";
2323
import { testCreateRun } from "../src/Test.js";
@@ -374,7 +374,7 @@ describe("logExplainQueryPlan", () => {
374374
);
375375
expect(planEntry).toBeDefined();
376376
// Nested rows produce leading spaces
377-
const planOutput = planEntry!.args.find(
377+
const planOutput = planEntry?.args.find(
378378
(arg) => typeof arg === "string" && arg.includes("SCAN"),
379379
) as string;
380380
expect(planOutput).toMatch(/^ {2}/m);

packages/common/test/_deps.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ const sqliteDeps = {
4242
createSqliteDriver: testCreateSqliteDriver,
4343
} satisfies CreateSqliteDriverDep;
4444

45-
type TestCreateSqliteDeps = CreateSqliteDriverDep & (() => CreateSqliteDriverDep);
45+
type TestCreateSqliteDeps = CreateSqliteDriverDep &
46+
(() => CreateSqliteDriverDep);
4647

4748
// Keep backward compatibility for both call styles:
4849
// - testCreateSqliteDeps()

packages/common/test/local-first/Evolu.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ import {
2222
import { testQuery, testQuery2 } from "../../src/local-first/Query.js";
2323
import { createQueryBuilder } from "../../src/local-first/Schema.js";
2424
import {
25-
initSharedWorker,
2625
type EvoluInput,
2726
type EvoluOutput,
2827
type EvoluTabOutput,
28+
initSharedWorker,
2929
type SharedWorker,
3030
type SharedWorkerInput,
3131
} from "../../src/local-first/Shared.js";
@@ -50,17 +50,16 @@ import {
5050
createMessagePort,
5151
createSharedWorker,
5252
createWorker,
53-
testWaitForWorkerMessage,
5453
testCreateMessageChannel,
5554
testCreateMessagePort,
5655
testCreateSharedWorker,
5756
testCreateWorker,
57+
testWaitForWorkerMessage,
5858
} from "../../src/Worker.js";
5959
import { testCreateSqliteDeps } from "../_deps.js";
6060
import { testAppOwner } from "./_fixtures.js";
6161

6262
const TodoId = id("Todo");
63-
type TodoId = typeof TodoId.Type;
6463

6564
const Schema = {
6665
todo: {

0 commit comments

Comments
 (0)