diff --git a/eslint.config.mjs b/eslint.config.mjs
index cc1cb831..763a0a56 100644
--- a/eslint.config.mjs
+++ b/eslint.config.mjs
@@ -50,6 +50,7 @@ export default defineConfig([
"array-callback-return": "error",
"no-constructor-return": "error",
"no-duplicate-imports": "error",
+ "no-promise-executor-return": ["error", { allowVoid: true }],
// unsure what the defaults are here, but we want them to error
"for-direction": "error",
"constructor-super": "error",
diff --git a/src/apply-migrations.ts b/src/apply-migrations.ts
index 7d3ac90a..d074c704 100644
--- a/src/apply-migrations.ts
+++ b/src/apply-migrations.ts
@@ -22,7 +22,7 @@ async function main() {
});
} catch (e) {
console.error("Failed to apply migrations, retrying in 2s...", e);
- await new Promise((res) => setTimeout(res, 2000));
+ await new Promise((res) => void setTimeout(res, 2000));
await main();
}
}
diff --git a/src/bundle/Server.ts b/src/bundle/Server.ts
index bc36e90a..91c3dcf4 100644
--- a/src/bundle/Server.ts
+++ b/src/bundle/Server.ts
@@ -74,7 +74,7 @@ async function main() {
);
}
- await new Promise((resolve) => server.listen({ port }, () => resolve(undefined)));
+ await new Promise((resolve) => void server.listen({ port }, () => resolve(undefined)));
await Promise.all([api.start(), cdn.start(), gateway.start(), webrtc.start()]);
if (fs.existsSync("/proc/self/comm")) fs.writeFileSync("/proc/self/comm", `spacebar-bundle-${cluster.worker ? cluster.worker.id : port}`);
diff --git a/src/util/util/Database.ts b/src/util/util/Database.ts
index 9622bfb1..004fd3f5 100644
--- a/src/util/util/Database.ts
+++ b/src/util/util/Database.ts
@@ -123,7 +123,7 @@ export async function initDatabase(): Promise<DataSource> {
console.log("[Database] Skipping migrations as per config.");
while (!(await dbExists())) {
console.log("[Database] Database does not exist, and we are not running migrations... Waiting 1 seconds...");
- await new Promise((r) => setTimeout(r, 5000));
+ await new Promise((r) => void setTimeout(r, 5000));
}
}
diff --git a/src/util/util/KittyLogo.ts b/src/util/util/KittyLogo.ts
index 56fb502d..8ecd1e67 100644
--- a/src/util/util/KittyLogo.ts
+++ b/src/util/util/KittyLogo.ts
@@ -76,7 +76,7 @@ export class KittyLogo {
});
process.stdout.write("\x1b_Gi=31,s=1,v=1,a=q,t=d,f=24;AAAA\x1b\\\x1b[c");
- await new Promise((res) => setTimeout(res, 5000));
+ await new Promise((res) => void setTimeout(res, 5000));
resolve(false);
})();
});
diff --git a/src/util/util/RabbitMQ.ts b/src/util/util/RabbitMQ.ts
index 44bcf2a6..328a2df7 100644
--- a/src/util/util/RabbitMQ.ts
+++ b/src/util/util/RabbitMQ.ts
@@ -117,7 +117,7 @@ export class RabbitMQ {
console.log(`[RabbitMQ] Scheduling reconnection attempt ${this.reconnectAttempts} in ${this.BASE_RECONNECT_DELAY_MS}ms`);
- await new Promise((resolve) => setTimeout(resolve, this.BASE_RECONNECT_DELAY_MS));
+ await new Promise((resolve) => void setTimeout(resolve, this.BASE_RECONNECT_DELAY_MS));
try {
await this.connect(host);
diff --git a/src/util/util/Stopwatch.test.ts b/src/util/util/Stopwatch.test.ts
index f2eb13d5..35618314 100644
--- a/src/util/util/Stopwatch.test.ts
+++ b/src/util/util/Stopwatch.test.ts
@@ -10,7 +10,7 @@ describe("Stopwatch", () => {
test("should measure elapsed time", async () => {
const sw = Stopwatch.startNew();
- await new Promise((resolve) => setTimeout(resolve, 101));
+ await new Promise((resolve) => void setTimeout(resolve, 101));
sw.stop();
const elapsed = sw.elapsed();
assert(elapsed.totalMilliseconds >= 100, `Elapsed time was ${elapsed.totalMilliseconds} ms`);
@@ -18,13 +18,13 @@ describe("Stopwatch", () => {
test("should reset correctly", async () => {
const sw = Stopwatch.startNew();
- await new Promise((resolve) => setTimeout(resolve, 101));
+ await new Promise((resolve) => void setTimeout(resolve, 101));
sw.stop();
let elapsed = sw.elapsed();
assert(elapsed.totalMilliseconds >= 100, `Elapsed time was ${elapsed.totalMilliseconds} ms`);
sw.reset();
- await new Promise((resolve) => setTimeout(resolve, 50));
+ await new Promise((resolve) => void setTimeout(resolve, 50));
sw.stop();
elapsed = sw.elapsed();
assert(elapsed.totalMilliseconds >= 49 && elapsed.totalMilliseconds < 100, `Elapsed time after reset was ${elapsed.totalMilliseconds} ms`);
@@ -32,12 +32,12 @@ describe("Stopwatch", () => {
test("getElapsedAndReset should work correctly", async () => {
const sw = Stopwatch.startNew();
- await new Promise((resolve) => setTimeout(resolve, 101));
+ await new Promise((resolve) => void setTimeout(resolve, 101));
sw.stop();
let elapsed = sw.getElapsedAndReset();
assert(elapsed.totalMilliseconds >= 100, `Elapsed time was ${elapsed.totalMilliseconds} ms`);
- await new Promise((resolve) => setTimeout(resolve, 50));
+ await new Promise((resolve) => void setTimeout(resolve, 50));
sw.stop();
elapsed = sw.elapsed();
assert(elapsed.totalMilliseconds >= 50 && elapsed.totalMilliseconds < 100, `Elapsed time after getElapsedAndReset was ${elapsed.totalMilliseconds} ms`);
@@ -45,7 +45,7 @@ describe("Stopwatch", () => {
test("timePromise should measure promise execution time", async () => {
const { result, elapsed } = await timePromise(async () => {
- await new Promise((resolve) => setTimeout(resolve, 101));
+ await new Promise((resolve) => void setTimeout(resolve, 101));
return 42;
});
assert.equal(result, 42);
diff --git a/src/util/util/Token.ts b/src/util/util/Token.ts
index 83459144..466c6ce1 100644
--- a/src/util/util/Token.ts
+++ b/src/util/util/Token.ts
@@ -143,7 +143,7 @@ export const checkToken = (
};
const dec = jwt.decode(token, { complete: true });
- if (!dec) return rejectAndLog(reject, 500, "Failed to decode token");
+ if (!dec) return void rejectAndLog(reject, 500, "Failed to decode token");
logAuth("Decoded token: " + JSON.stringify(dec));
if (dec.header.alg == "HS256" && Config.get().security.jwtSecret !== null) {
@@ -153,7 +153,7 @@ export const checkToken = (
loadOrGenerateKeypair().then((keyPair) => {
jwt.verify(token, keyPair.publicKey, { algorithms: ["ES512"] }, validateUser);
});
- } else return rejectAndLog(reject, 400, "Unsupported token algorithm: " + dec.header.alg);
+ } else return void rejectAndLog(reject, 400, "Unsupported token algorithm: " + dec.header.alg);
});
};
diff --git a/src/util/util/extensions/index.ts b/src/util/util/extensions/index.ts
index 0ec969f4..f9760da3 100644
--- a/src/util/util/extensions/index.ts
+++ b/src/util/util/extensions/index.ts
@@ -2,5 +2,5 @@ export * from "./Array";
// TODO: move to a separate file
export async function sleep(ms: number) {
- return new Promise((resolve) => setTimeout(resolve, ms));
+ return new Promise((resolve) => void setTimeout(resolve, ms));
}
diff --git a/src/util/util/lambert-server/Server.ts b/src/util/util/lambert-server/Server.ts
index 0d345815..617b2794 100644
--- a/src/util/util/lambert-server/Server.ts
+++ b/src/util/util/lambert-server/Server.ts
@@ -65,6 +65,6 @@ export class Server {
}
stop() {
- return new Promise<void>((res) => this.http.close(() => res()));
+ return new Promise<void>((res) => void this.http.close(() => res()));
}
}
|