Skip to content

Commit

Permalink
mk: upgrade to TypeScript 5.6 and xo 0.59
Browse files Browse the repository at this point in the history
  • Loading branch information
yoursunny committed Oct 18, 2024
1 parent bccad75 commit 55ed4e5
Show file tree
Hide file tree
Showing 13 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion integ/browser-tests/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const config = {
},
};

module.exports = async () => {
module.exports = async () => { // eslint-disable-line unicorn/no-anonymous-default-export
const list = fsWalk.walkSync(path.resolve(__dirname, "tests"), {
entryFilter: ({ name }) => name === "browser.ts",
});
Expand Down
1 change: 1 addition & 0 deletions mk/tsconfig-base.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"noImplicitOverride": true,
"noImplicitReturns": true,
"noUncheckedIndexedAccess": true,
"noUncheckedSideEffectImports": true,
"noUnusedLocals": true,
"strict": true,
"target": "ES2023",
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
"@types/wtfnode": "^0.7.3",
"@typescript/lib-dom": "npm:@types/web@0.0.173",
"@vitest/coverage-v8": "^2.1.3",
"@yoursunny/xo-config": "0.58.0",
"@yoursunny/xo-config": "0.59.0",
"codedown": "^3.2.1",
"tslib": "^2.8.0",
"typedoc": "^0.26.10",
"typescript": "~5.5.4",
"typescript": "~5.6.3",
"vitest": "^2.1.3"
},
"engines": {
Expand Down
1 change: 1 addition & 0 deletions pkg/endpoint/src/producer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ class ProducerImpl implements Producer {
if (!(interest instanceof Interest)) {
return;
}

const data = await this.processInterest(interest).catch(() => undefined);
if (data) {
yield FwPacket.create(data, token);
Expand Down
2 changes: 1 addition & 1 deletion pkg/endpoint/tests/fw.t.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ test("tracer", async () => {
tracer.disable();
faceC.close();

await new Promise((r) => output.end(r));
await new Promise((resolve) => output.end(resolve));
expect(fromUtf8(output.flatData).split("\n")).toEqual([
"+Face consume(/8=A)",
"consume(/8=A) >I /8=A",
Expand Down
1 change: 1 addition & 0 deletions pkg/ndncert/tests/basic.t.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ test("packets", async () => {
expect(profile.maxValidityPeriod).toBe(86400000);
expect(profile.cert.name).toEqualName(rootCert.name);

// eslint-disable-next-line unicorn/prefer-structured-clone
const profileJSON: CaProfile.ToJSON = JSON.parse(JSON.stringify(profile));
expect(Name.from(profileJSON.prefix)).toEqualName("/root");
expect(profileJSON.info).toBe("root CA");
Expand Down
2 changes: 1 addition & 1 deletion pkg/quic-transport/src/h3-transport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class H3Transport extends Transport {
public static async connect(uri: string, opts: H3Transport.Options = {}): Promise<H3Transport> {
const { connectTimeout = 10000, ...wtOpts } = opts;
const tr = new WebTransport(uri, wtOpts);
void tr.closed.catch(() => undefined);
void tr.closed.catch(() => undefined); // eslint-disable-line promise/prefer-await-to-then
const isTimeout = await Promise.race([
tr.ready,
delay(connectTimeout, true),
Expand Down
3 changes: 2 additions & 1 deletion pkg/repo-api/src/bulk-insert-initiator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ export class BulkInsertInitiator extends TypedEventTarget<EventMap> implements S
constructor(tr: Pick<Transport, "tx">) {
super();
if (tr instanceof Transport) {
consume(tr.rx).catch(() => undefined);
consume(tr.rx).catch(() => undefined); // eslint-disable-line promise/prefer-await-to-then
this.mtu = tr.mtu;
}
// eslint-disable-next-line promise/prefer-await-to-then
this.transportTx = tr.tx(this.tx()).catch((err: unknown) => {
this.dispatchTypedEvent("error", new CustomEvent("error", {
detail: err instanceof Error ? err : new Error(`${err}`),
Expand Down
1 change: 1 addition & 0 deletions pkg/segmented-object/src/fetch/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class FetchResult implements fetch.Result {
onrejected?: ((reason: any) => Promisable<J>) | null,
) {
this.promise ??= this.startPromise();
// eslint-disable-next-line promise/prefer-await-to-then
return this.promise.then(onfulfilled, onrejected);
}

Expand Down
1 change: 0 additions & 1 deletion pkg/segmented-object/src/serve/chunk-source/blob.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// eslint-disable-next-line n/no-unsupported-features/node-builtins
import type { Blob as NodeBlob } from "node:buffer";

import { type ChunkOptions, type ChunkSource, getMaxChunkSize, KnownSizeChunkSource } from "./common";
Expand Down
3 changes: 1 addition & 2 deletions pkg/segmented-object/tests/serve-fetch.t.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import "@ndn/util/test-fixture/expect";

// eslint-disable-next-line n/no-unsupported-features/node-builtins
import { Blob } from "node:buffer";
import path from "node:path";

Expand Down Expand Up @@ -82,7 +81,7 @@ test("stream to stream", async () => {
const dst = new BufferWritableMock();
await fetch("/R").pipe(dst);

await new Promise((r) => dst.end(r));
await new Promise((resolve) => dst.end(resolve));
expect(objectBody.compare(dst.flatData)).toEqual(0);
});

Expand Down
1 change: 1 addition & 0 deletions pkg/svs/tests/sync.t.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ test("initialize", async () => {
expect(v0.get(new Name("/C"))).toBe(13);
expect(v0.get(new Name("/D"))).toBe(0);

// eslint-disable-next-line unicorn/prefer-structured-clone
const v1 = new StateVector(JSON.parse(JSON.stringify(v0)));
const p1 = await SvSync.create({
...opts,
Expand Down
2 changes: 1 addition & 1 deletion pkg/util/tests/closers.t.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ test("closers", async () => {
expect(c1.close).toHaveBeenCalledOnce();

const waitFulfilled = vi.fn<() => void>();
void closers.wait().then(waitFulfilled);
void closers.wait().then(waitFulfilled); // eslint-disable-line promise/prefer-await-to-then
expect(closers).toHaveLength(1);

closers.close();
Expand Down

0 comments on commit 55ed4e5

Please sign in to comment.