Skip to content

Commit

Permalink
refactor: apply biome import sorting to all files
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthewWid committed Dec 9, 2024
1 parent d6d99d5 commit 610e874
Show file tree
Hide file tree
Showing 26 changed files with 55 additions and 55 deletions.
2 changes: 1 addition & 1 deletion docs/astro.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {defineConfig} from "astro/config";
import starlight from "@astrojs/starlight";
import {defineConfig} from "astro/config";

export default defineConfig({
site: "https://matthewwid.github.io",
Expand Down
6 changes: 3 additions & 3 deletions examples/benchmarks/suites/channel-push-many-sessions.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */

import {createSession, createChannel} from "better-sse";
// @ts-ignore
import SseChannel from "sse-channel";
import {createChannel, createSession} from "better-sse";
// @ts-ignore
import EasySse from "easy-server-sent-events";
// @ts-ignore
import SseChannel from "sse-channel";
import {createClientPool} from "../lib/createClientPool";
import {Suite} from "./Suite";

Expand Down
2 changes: 1 addition & 1 deletion examples/channels/server.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import path from "node:path";
import express from "express";
import {createSession} from "better-sse";
import express from "express";
import {ticker} from "./channels/ticker";

const app = express();
Expand Down
2 changes: 1 addition & 1 deletion examples/getting-started/server.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import path from "node:path";
import {type Session, createSession} from "better-sse";
import express from "express";
import {createSession, type Session} from "better-sse";

const app = express();

Expand Down
4 changes: 2 additions & 2 deletions examples/http2/server.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {createSecureServer} from "node:http2";
import {resolve} from "node:path";
import {promisify} from "node:util";
import {createSecureServer} from "node:http2";
import {createSession} from "better-sse";
import {
type CertificateCreationOptions,
type CertificateCreationResult,
createCertificate as createCertificateCallback,
} from "pem";
import {createSession} from "better-sse";

(async () => {
const createCertificate = promisify<
Expand Down
2 changes: 1 addition & 1 deletion examples/resource-monitor/channels/resource.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import osu, {type NetStatMetrics} from "node-os-utils";
import {createChannel} from "better-sse";
import osu, {type NetStatMetrics} from "node-os-utils";

const resource = createChannel();

Expand Down
2 changes: 1 addition & 1 deletion examples/resource-monitor/server.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import path from "node:path";
import express from "express";
import {createSession} from "better-sse";
import express from "express";
import {resource} from "./channels/resource";

const app = express();
Expand Down
4 changes: 2 additions & 2 deletions examples/streams/server.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import path from "node:path";
import express from "express";
import {createSession} from "better-sse";
import {Readable} from "node:stream";
import {createSession} from "better-sse";
import express from "express";

const app = express();

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"scripts": {
"build": "tsup",
"test": "vitest",
"format": "biome format --write",
"format": "biome check --linter-enabled=false --write",
"lint": "biome lint --write",
"ci": "biome ci",
"prepublishOnly": "npm-run-all ci build"
Expand Down
20 changes: 10 additions & 10 deletions src/Channel.test.ts
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import type http from "node:http";
import EventSource from "eventsource";
import {
vi,
type SpyInstance,
afterEach,
beforeEach,
describe,
it,
expect,
beforeEach,
afterEach,
type SpyInstance,
it,
vi,
} from "vitest";
import type http from "node:http";
import EventSource from "eventsource";
import {Channel} from "./Channel";
import {Session} from "./Session";
import {
createHttpServer,
closeServer,
createHttpServer,
getUrl,
waitForConnect,
} from "./lib/testUtils";
import {Session} from "./Session";
import {Channel} from "./Channel";

let server: http.Server;
let url: string;
Expand Down
6 changes: 3 additions & 3 deletions src/Channel.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type {Session, DefaultSessionState} from "./Session";
import {TypedEmitter, type EventMap} from "./lib/TypedEmitter";
import {generateId} from "./lib/generateId";
import type {DefaultSessionState, Session} from "./Session";
import {SseError} from "./lib/SseError";
import {type EventMap, TypedEmitter} from "./lib/TypedEmitter";
import {generateId} from "./lib/generateId";

interface ChannelOptions<State = DefaultChannelState> {
/**
Expand Down
2 changes: 1 addition & 1 deletion src/EventBuffer.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {vi, describe, it, expect} from "vitest";
import {describe, expect, it, vi} from "vitest";
import {EventBuffer} from "./EventBuffer";

describe("serializer", () => {
Expand Down
8 changes: 4 additions & 4 deletions src/EventBuffer.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {serialize, type SerializerFunction} from "./lib/serialize";
import {sanitize, type SanitizerFunction} from "./lib/sanitize";
import {generateId} from "./lib/generateId";
import {createPushFromStream} from "./lib/createPushFromStream";
import {createPushFromIterable} from "./lib/createPushFromIterable";
import {createPushFromStream} from "./lib/createPushFromStream";
import {generateId} from "./lib/generateId";
import {type SanitizerFunction, sanitize} from "./lib/sanitize";
import {type SerializerFunction, serialize} from "./lib/serialize";

interface EventBufferOptions {
/**
Expand Down
12 changes: 6 additions & 6 deletions src/Session.test.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import {vi, describe, it, expect, beforeEach, afterEach} from "vitest";
import type http from "node:http";
import http2 from "node:http2";
import type {AddressInfo} from "node:net";
import EventSource from "eventsource";
import {afterEach, beforeEach, describe, expect, it, vi} from "vitest";
import {EventBuffer} from "./EventBuffer";
import {Session} from "./Session";
import {
createHttpServer,
createHttp2Server,
closeServer,
createHttp2Server,
createHttpServer,
getBuffer,
getUrl,
waitForConnect,
getBuffer,
} from "./lib/testUtils";
import {Session} from "./Session";
import {EventBuffer} from "./EventBuffer";

let server: http.Server;
let url: string;
Expand Down
12 changes: 6 additions & 6 deletions src/Session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import {
} from "node:http";
import type {Http2ServerRequest, Http2ServerResponse} from "node:http2";
import {EventBuffer, type EventBufferOptions} from "./EventBuffer";
import {TypedEmitter, type EventMap} from "./lib/TypedEmitter";
import {generateId} from "./lib/generateId";
import {createPushFromStream} from "./lib/createPushFromStream";
import {createPushFromIterable} from "./lib/createPushFromIterable";
import {serialize, type SerializerFunction} from "./lib/serialize";
import {sanitize, type SanitizerFunction} from "./lib/sanitize";
import {SseError} from "./lib/SseError";
import {type EventMap, TypedEmitter} from "./lib/TypedEmitter";
import {createPushFromIterable} from "./lib/createPushFromIterable";
import {createPushFromStream} from "./lib/createPushFromStream";
import {generateId} from "./lib/generateId";
import {type SanitizerFunction, sanitize} from "./lib/sanitize";
import {type SerializerFunction, serialize} from "./lib/serialize";

interface SessionOptions<State = DefaultSessionState>
extends Pick<EventBufferOptions, "serializer" | "sanitizer"> {
Expand Down
2 changes: 1 addition & 1 deletion src/createChannel.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {it, expect} from "vitest";
import {expect, it} from "vitest";
import {Channel} from "./Channel";
import {createChannel} from "./createChannel";

Expand Down
2 changes: 1 addition & 1 deletion src/createEventBuffer.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {it, expect} from "vitest";
import {expect, it} from "vitest";
import {EventBuffer} from "./EventBuffer";
import {createEventBuffer} from "./createEventBuffer";

Expand Down
4 changes: 2 additions & 2 deletions src/createSession.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {it, expect, beforeEach, afterEach} from "vitest";
import type http from "node:http";
import EventSource from "eventsource";
import {createHttpServer, closeServer, getUrl} from "./lib/testUtils";
import {afterEach, beforeEach, expect, it} from "vitest";
import {Session} from "./Session";
import {createSession} from "./createSession";
import {closeServer, createHttpServer, getUrl} from "./lib/testUtils";

let server: http.Server;
let url: string;
Expand Down
2 changes: 1 addition & 1 deletion src/createSession.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Session, type DefaultSessionState} from "./Session";
import {type DefaultSessionState, Session} from "./Session";

/**
* Create a new session and return the session instance once it has connected.
Expand Down
2 changes: 1 addition & 1 deletion src/lib/createPushFromIterable.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {vi, it, expect, beforeEach, type Mock} from "vitest";
import {type Mock, beforeEach, expect, it, vi} from "vitest";
import {createPushFromIterable} from "./createPushFromIterable";

const data = [1, 2, 3];
Expand Down
2 changes: 1 addition & 1 deletion src/lib/createPushFromStream.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Readable} from "node:stream";
import {vi, it, expect, beforeEach, type Mock} from "vitest";
import {type Mock, beforeEach, expect, it, vi} from "vitest";
import {createPushFromStream} from "./createPushFromStream";

const data = [1, 2, 3];
Expand Down
2 changes: 1 addition & 1 deletion src/lib/generateId.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {it, expect} from "vitest";
import {expect, it} from "vitest";
import {generateId} from "./generateId";

it("returns a string", () => {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/generateId.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {randomUUID, randomBytes} from "node:crypto";
import {randomBytes, randomUUID} from "node:crypto";

let generateId: () => string;

Expand Down
2 changes: 1 addition & 1 deletion src/lib/sanitize.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {describe, it, expect} from "vitest";
import {describe, expect, it} from "vitest";
import {sanitize} from "./sanitize";

describe("newline standarization", () => {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/serialize.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {it, expect} from "vitest";
import {expect, it} from "vitest";
import {serialize} from "./serialize";

it("JSON-stringifies input", () => {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/testUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import http from "node:http";
import http2 from "node:http2";
import type net from "node:net";
import type {AddressInfo} from "node:net";
import type {Session} from "../Session";
import type {EventBuffer} from "../EventBuffer";
import type {Session} from "../Session";

const createHttpServer = (): Promise<http.Server> =>
new Promise<http.Server>((resolve, reject) => {
Expand Down

0 comments on commit 610e874

Please sign in to comment.