Skip to content

Commit ac6964e

Browse files
committed
style: biome check --write --unsafe sweep
1 parent 9242e8c commit ac6964e

11 files changed

Lines changed: 17 additions & 63 deletions

File tree

biome.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@
3535
}
3636
},
3737
"root": false
38-
}
38+
}

packages/ids/src/sha1-uuid.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@ export async function sha1Uuid(content: string): Promise<string> {
1818
/**
1919
* Generate a SHA1 hash from raw bytes.
2020
*/
21-
export async function sha1Bytes(
22-
data: Uint8Array<ArrayBuffer>,
23-
): Promise<string> {
21+
export async function sha1Bytes(data: Uint8Array<ArrayBuffer>): Promise<string> {
2422
const hashBuffer = await crypto.subtle.digest("SHA-1", data);
2523
const hashArray = new Uint8Array(hashBuffer);
2624
return hexFromBytes(hashArray);

packages/ids/src/snowflake-id.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,7 @@ export class SnowflakeId {
5454
this.lastTimestamp = timestamp;
5555

5656
// 42-bit timestamp | 10-bit worker ID | 12-bit sequence
57-
const id =
58-
(BigInt(timestamp) << 22n) |
59-
(BigInt(this.workerId) << 12n) |
60-
BigInt(this.sequence);
57+
const id = (BigInt(timestamp) << 22n) | (BigInt(this.workerId) << 12n) | BigInt(this.sequence);
6158

6259
return crockfordEncode(id, SNOWFLAKE_BASE32_LENGTH);
6360
}

packages/ids/tests/crockford-base32.test.ts

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,8 @@ describe("crockfordDecode", () => {
5858
});
5959

6060
it("throws on invalid characters", () => {
61-
expect(() => crockfordDecode("U")).toThrow(
62-
"Invalid Crockford base32 character",
63-
);
64-
expect(() => crockfordDecode("!")).toThrow(
65-
"Invalid Crockford base32 character",
66-
);
61+
expect(() => crockfordDecode("U")).toThrow("Invalid Crockford base32 character");
62+
expect(() => crockfordDecode("!")).toThrow("Invalid Crockford base32 character");
6763
});
6864
});
6965

@@ -85,16 +81,7 @@ describe("round-trip", () => {
8581

8682
describe("lexicographic ordering", () => {
8783
it("lexicographic order matches numeric order", () => {
88-
const values = [
89-
0n,
90-
1n,
91-
31n,
92-
32n,
93-
1000n,
94-
100000n,
95-
1n << 32n,
96-
(1n << 64n) - 1n,
97-
];
84+
const values = [0n, 1n, 31n, 32n, 1000n, 100000n, 1n << 32n, (1n << 64n) - 1n];
9885
const encoded = values.map((v) => crockfordEncode(v, 13));
9986
const sorted = [...encoded].sort();
10087
expect(sorted).toEqual(encoded);

packages/shared-baseclass/src/wait-for-settled.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ export interface Settleable {
55
onUpdate: (callback: () => void) => () => void;
66
}
77

8-
export async function waitForSettled<T extends Settleable>(
9-
model: T,
10-
): Promise<T> {
8+
export async function waitForSettled<T extends Settleable>(model: T): Promise<T> {
119
await waitFor(model.onUpdate, () => model.isSettled());
1210
return model;
1311
}

packages/shared-intents/src/intents.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,7 @@ export function createIntents(): Intents {
4949
return promise;
5050
}
5151

52-
function addHandler<P, R>(
53-
key: string,
54-
handler: IntentHandler<P, R>,
55-
): () => void {
52+
function addHandler<P, R>(key: string, handler: IntentHandler<P, R>): () => void {
5653
let set = handlers.get(key);
5754
if (!set) {
5855
set = new Set();

packages/shared-intents/src/new-intent.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,9 @@ import type { IntentHandler, Intents } from "./types.js";
22

33
export type IntentRun<P, R> = (intents: Intents, payload: P) => Promise<R>;
44

5-
export type IntentHandle<P, R> = (
6-
intents: Intents,
7-
handler: IntentHandler<P, R>,
8-
) => () => void;
5+
export type IntentHandle<P, R> = (intents: Intents, handler: IntentHandler<P, R>) => () => void;
96

10-
export function newIntent<P, R>(
11-
key: string,
12-
): [run: IntentRun<P, R>, handle: IntentHandle<P, R>] {
7+
export function newIntent<P, R>(key: string): [run: IntentRun<P, R>, handle: IntentHandle<P, R>] {
138
function run(intents: Intents, payload: P): Promise<R> {
149
return intents.run<P, R>(key, payload);
1510
}

packages/shared-intents/src/types.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ export interface Intent<P, R> {
88
promise: Promise<R>;
99
}
1010

11-
export type IntentHandler<P = unknown, R = unknown> = (
12-
intent: Intent<P, R>,
13-
) => boolean;
11+
export type IntentHandler<P = unknown, R = unknown> = (intent: Intent<P, R>) => boolean;
1412

1513
export interface Intents {
1614
run<P, R>(key: string, payload: P): Promise<R>;

packages/shared-logger-pino/src/index.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@ import type { Logger, LoggerLevel } from "@statewalker/shared-logger";
22
import { getProcessId, setLogger } from "@statewalker/shared-logger";
33
import pino from "pino";
44

5-
function newPinoLogger(
6-
level: LoggerLevel,
7-
metadata: Record<string, unknown> = {},
8-
): Logger {
5+
function newPinoLogger(level: LoggerLevel, metadata: Record<string, unknown> = {}): Logger {
96
const pinoInstance = pino({
107
level,
118
...(process.env.NODE_ENV !== "production" && {
@@ -27,12 +24,8 @@ function newPinoLogger(
2724
return wrapPino(pinoInstance, metadata);
2825
}
2926

30-
function wrapPino(
31-
instance: pino.Logger,
32-
metadata: Record<string, unknown>,
33-
): Logger {
34-
const bound =
35-
Object.keys(metadata).length > 0 ? instance.child(metadata) : instance;
27+
function wrapPino(instance: pino.Logger, metadata: Record<string, unknown>): Logger {
28+
const bound = Object.keys(metadata).length > 0 ? instance.child(metadata) : instance;
3629
return {
3730
get level() {
3831
return bound.level as LoggerLevel;

packages/shared-logger/src/logger.adapter.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,7 @@ export function newConsoleLogger(
3939
if (Levels[logLevel] > Levels[level]) {
4040
return;
4141
}
42-
console[method](
43-
`[${String(rowCounter++).padStart(7, "0")}]${prefix}`,
44-
...args,
45-
metadata,
46-
);
42+
console[method](`[${String(rowCounter++).padStart(7, "0")}]${prefix}`, ...args, metadata);
4743
};
4844
};
4945
const logger: Logger = {
@@ -74,10 +70,7 @@ export function getProcessId(context: Record<string, unknown>): string {
7470
return context[key] as string;
7571
}
7672

77-
export const [getLogger, setLogger, removeLogger] = newAdapter<
78-
Logger,
79-
Record<string, unknown>
80-
>(
73+
export const [getLogger, setLogger, removeLogger] = newAdapter<Logger, Record<string, unknown>>(
8174
"app.logger",
8275
(context) => {
8376
const logger = newConsoleLogger("warn").child({

0 commit comments

Comments
 (0)