Skip to content

Commit

Permalink
Update dev dependencies.
Browse files Browse the repository at this point in the history
Includes fixes for the newer versions of Prettier, ESLint, and TypeScript.

Note that there are now 3 TypeScript errors due to this TypeScript v5.4.2 bug:

microsoft/TypeScript#57738
  • Loading branch information
jaydenseric committed Mar 12, 2024
1 parent bd59352 commit fd793c5
Show file tree
Hide file tree
Showing 48 changed files with 409 additions and 377 deletions.
2 changes: 1 addition & 1 deletion Cache.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe("Class `Cache`.", { concurrency: true }, () => {
throws(() => {
new Cache(
// @ts-expect-error Testing invalid.
null
null,
);
}, new TypeError("Constructor argument 1 `store` must be an object."));
});
Expand Down
2 changes: 1 addition & 1 deletion CacheContext.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import React from "react";
* @type {React.Context<Cache | undefined>}
*/
const CacheContext = React.createContext(
/** @type {Cache | undefined} */ (undefined)
/** @type {Cache | undefined} */ (undefined),
);

CacheContext.displayName = "CacheContext";
Expand Down
5 changes: 3 additions & 2 deletions CacheContext.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import { strictEqual } from "node:assert";
import { describe, it } from "node:test";

import React from "react";

import Cache from "./Cache.mjs";
Expand All @@ -28,8 +29,8 @@ describe("React context `CacheContext`.", { concurrency: true }, () => {
React.createElement(
CacheContext.Provider,
{ value },
React.createElement(TestComponent)
)
React.createElement(TestComponent),
),
);

strictEqual(contextValue, value);
Expand Down
2 changes: 1 addition & 1 deletion HYDRATION_TIME_MS.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe("Constant `HYDRATION_TIME_MS`.", { concurrency: true }, () => {
it("Bundle size.", async () => {
await assertBundleSize(
new URL("./HYDRATION_TIME_MS.mjs", import.meta.url),
65
65,
);
});

Expand Down
2 changes: 1 addition & 1 deletion HydrationTimeStampContext.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import React from "react";
* @type {React.Context<DOMHighResTimeStamp | undefined>}
*/
const HydrationTimeStampContext = React.createContext(
/** @type {DOMHighResTimeStamp | undefined} */ (undefined)
/** @type {DOMHighResTimeStamp | undefined} */ (undefined),
);

HydrationTimeStampContext.displayName = "HydrationTimeStampContext";
Expand Down
9 changes: 5 additions & 4 deletions HydrationTimeStampContext.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import { strictEqual } from "node:assert";
import { describe, it } from "node:test";

import React from "react";

import HydrationTimeStampContext from "./HydrationTimeStampContext.mjs";
Expand All @@ -15,7 +16,7 @@ describe(
it("Bundle size.", async () => {
await assertBundleSize(
new URL("./HydrationTimeStampContext.mjs", import.meta.url),
150
150,
);
});

Expand All @@ -33,11 +34,11 @@ describe(
React.createElement(
HydrationTimeStampContext.Provider,
{ value },
React.createElement(TestComponent)
)
React.createElement(TestComponent),
),
);

strictEqual(contextValue, value);
});
}
},
);
8 changes: 4 additions & 4 deletions LoadingCacheValue.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ export default class LoadingCacheValue {

if (!(loadingResult instanceof Promise))
throw new TypeError(
"Argument 4 `loadingResult` must be a `Promise` instance."
"Argument 4 `loadingResult` must be a `Promise` instance.",
);

if (!(abortController instanceof AbortController))
throw new TypeError(
"Argument 5 `abortController` must be an `AbortController` instance."
"Argument 5 `abortController` must be an `AbortController` instance.",
);

/**
Expand Down Expand Up @@ -118,7 +118,7 @@ export default class LoadingCacheValue {
detail: {
loadingCacheValue: this,
},
})
}),
);

return result;
Expand All @@ -133,7 +133,7 @@ export default class LoadingCacheValue {
detail: {
loadingCacheValue: this,
},
})
}),
);
}
}
42 changes: 21 additions & 21 deletions LoadingCacheValue.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ describe("Class `LoadingCacheValue`.", { concurrency: true }, () => {
it("Bundle size.", async () => {
await assertBundleSize(
new URL("./LoadingCacheValue.mjs", import.meta.url),
650
650,
);
});

Expand All @@ -29,7 +29,7 @@ describe("Class `LoadingCacheValue`.", { concurrency: true }, () => {
new Cache(),
"a",
Promise.resolve(),
new AbortController()
new AbortController(),
);
}, new TypeError("Argument 1 `loading` must be a `Loading` instance."));
});
Expand All @@ -42,7 +42,7 @@ describe("Class `LoadingCacheValue`.", { concurrency: true }, () => {
true,
"a",
Promise.resolve(),
new AbortController()
new AbortController(),
);
}, new TypeError("Argument 2 `cache` must be a `Cache` instance."));
});
Expand All @@ -55,7 +55,7 @@ describe("Class `LoadingCacheValue`.", { concurrency: true }, () => {
// @ts-expect-error Testing invalid.
true,
Promise.resolve(),
new AbortController()
new AbortController(),
);
}, new TypeError("Argument 3 `cacheKey` must be a string."));
});
Expand All @@ -68,7 +68,7 @@ describe("Class `LoadingCacheValue`.", { concurrency: true }, () => {
"a",
// @ts-expect-error Testing invalid.
true,
new AbortController()
new AbortController(),
);
}, new TypeError("Argument 4 `loadingResult` must be a `Promise` instance."));
});
Expand All @@ -81,7 +81,7 @@ describe("Class `LoadingCacheValue`.", { concurrency: true }, () => {
"a",
Promise.resolve(),
// @ts-expect-error Testing invalid.
true
true,
);
}, new TypeError("Argument 5 `abortController` must be an `AbortController` instance."));
});
Expand Down Expand Up @@ -115,7 +115,7 @@ describe("Class `LoadingCacheValue`.", { concurrency: true }, () => {
cache,
cacheKey,
loadingResult,
abortController
abortController,
);

strictEqual(events.length, 1);
Expand Down Expand Up @@ -193,7 +193,7 @@ describe("Class `LoadingCacheValue`.", { concurrency: true }, () => {
cache,
cacheKey,
firstLoadingResult,
firstAbortController
firstAbortController,
);

strictEqual(events.length, 1);
Expand All @@ -214,7 +214,7 @@ describe("Class `LoadingCacheValue`.", { concurrency: true }, () => {
assertTypeOf(firstLoadingCacheValue.timeStamp, "number");
strictEqual(
performance.now() - firstLoadingCacheValue.timeStamp < 50,
true
true,
);
strictEqual(firstLoadingCacheValue.abortController, firstAbortController);
assertInstanceOf(firstLoadingCacheValue.promise, Promise);
Expand All @@ -233,7 +233,7 @@ describe("Class `LoadingCacheValue`.", { concurrency: true }, () => {
cache,
cacheKey,
secondLoadingResult,
secondAbortController
secondAbortController,
);

strictEqual(events.length, 1);
Expand All @@ -254,11 +254,11 @@ describe("Class `LoadingCacheValue`.", { concurrency: true }, () => {
assertTypeOf(secondLoadingCacheValue.timeStamp, "number");
strictEqual(
performance.now() - secondLoadingCacheValue.timeStamp < 50,
true
true,
);
strictEqual(
secondLoadingCacheValue.timeStamp >= firstLoadingCacheValue.timeStamp,
true
true,
);
strictEqual(secondLoadingCacheValue.abortController, secondAbortController);
assertInstanceOf(secondLoadingCacheValue.promise, Promise);
Expand Down Expand Up @@ -353,7 +353,7 @@ describe("Class `LoadingCacheValue`.", { concurrency: true }, () => {
cache,
cacheKey,
firstLoadingResult,
firstAbortController
firstAbortController,
);

strictEqual(events.length, 1);
Expand All @@ -374,7 +374,7 @@ describe("Class `LoadingCacheValue`.", { concurrency: true }, () => {
assertTypeOf(firstLoadingCacheValue.timeStamp, "number");
strictEqual(
performance.now() - firstLoadingCacheValue.timeStamp < 50,
true
true,
);
strictEqual(firstLoadingCacheValue.abortController, firstAbortController);
assertInstanceOf(firstLoadingCacheValue.promise, Promise);
Expand All @@ -393,7 +393,7 @@ describe("Class `LoadingCacheValue`.", { concurrency: true }, () => {
cache,
cacheKey,
secondLoadingResult,
secondAbortController
secondAbortController,
);

strictEqual(events.length, 1);
Expand All @@ -414,11 +414,11 @@ describe("Class `LoadingCacheValue`.", { concurrency: true }, () => {
assertTypeOf(secondLoadingCacheValue.timeStamp, "number");
strictEqual(
performance.now() - secondLoadingCacheValue.timeStamp < 50,
true
true,
);
strictEqual(
secondLoadingCacheValue.timeStamp >= firstLoadingCacheValue.timeStamp,
true
true,
);
strictEqual(secondLoadingCacheValue.abortController, secondAbortController);
assertInstanceOf(secondLoadingCacheValue.promise, Promise);
Expand All @@ -440,7 +440,7 @@ describe("Class `LoadingCacheValue`.", { concurrency: true }, () => {
});
deepStrictEqual(cache.store, { [cacheKey]: firstCacheValue });
strictEqual(firstResult, firstCacheValue);
}
},
);

const secondLoadingCheck = secondLoadingCacheValue.promise.then(
Expand All @@ -450,7 +450,7 @@ describe("Class `LoadingCacheValue`.", { concurrency: true }, () => {
deepStrictEqual(loading.store, {});
deepStrictEqual(cache.store, { [cacheKey]: secondCacheValue });
strictEqual(secondResult, secondCacheValue);
}
},
);

secondLoadingResultResolve(secondCacheValue);
Expand Down Expand Up @@ -519,7 +519,7 @@ describe("Class `LoadingCacheValue`.", { concurrency: true }, () => {
() => {
resolve(cacheValue);
},
{ once: true }
{ once: true },
);
});

Expand All @@ -528,7 +528,7 @@ describe("Class `LoadingCacheValue`.", { concurrency: true }, () => {
cache,
cacheKey,
loadingResult,
abortController
abortController,
);

strictEqual(events.length, 1);
Expand Down
2 changes: 1 addition & 1 deletion LoadingContext.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import React from "react";
* @type {React.Context<Loading | undefined>}
*/
const LoadingContext = React.createContext(
/** @type {Loading | undefined} */ (undefined)
/** @type {Loading | undefined} */ (undefined),
);

LoadingContext.displayName = "LoadingContext";
Expand Down
7 changes: 4 additions & 3 deletions LoadingContext.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import { strictEqual } from "node:assert";
import { describe, it } from "node:test";

import React from "react";

import Loading from "./Loading.mjs";
Expand All @@ -13,7 +14,7 @@ describe("React context `LoadingContext`.", { concurrency: true }, () => {
it("Bundle size.", async () => {
await assertBundleSize(
new URL("./LoadingContext.mjs", import.meta.url),
120
120,
);
});

Expand All @@ -31,8 +32,8 @@ describe("React context `LoadingContext`.", { concurrency: true }, () => {
React.createElement(
LoadingContext.Provider,
{ value },
React.createElement(TestComponent)
)
React.createElement(TestComponent),
),
);

strictEqual(contextValue, value);
Expand Down
10 changes: 5 additions & 5 deletions Provider.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ import LoadingContext from "./LoadingContext.mjs";
*/
export default function Provider({ cache, children }) {
const hydrationTimeStampRef = React.useRef(
/** @type {DOMHighResTimeStamp | undefined} */ (undefined)
/** @type {DOMHighResTimeStamp | undefined} */ (undefined),
);

if (!hydrationTimeStampRef.current)
hydrationTimeStampRef.current = performance.now();

const loadingRef = React.useRef(
/** @type {Loading | undefined} */ (undefined)
/** @type {Loading | undefined} */ (undefined),
);

if (!loadingRef.current) loadingRef.current = new Loading();
Expand All @@ -57,9 +57,9 @@ export default function Provider({ cache, children }) {
React.createElement(
LoadingContext.Provider,
{ value: loadingRef.current },
children
)
)
children,
),
),
);
}

Expand Down
Loading

0 comments on commit fd793c5

Please sign in to comment.