Skip to content

Commit

Permalink
rm @typescript-eslint/no-floating-promises
Browse files Browse the repository at this point in the history
  • Loading branch information
bkendall committed Jan 2, 2024
1 parent a0c1e77 commit 96e4264
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 45 deletions.
3 changes: 0 additions & 3 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,6 @@ module.exports = {
env: {
mocha: true,
},
rules: {
"@typescript-eslint/no-floating-promises": "warn", // TODO(bkendall): remove allow to error.
},
},
],
settings: {
Expand Down
4 changes: 2 additions & 2 deletions test/unit/middleware/env.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe("env", () => {
}),
);

request(app)
void request(app)
.get("/__/env.json")
.expect(200)
.expect({
Expand All @@ -66,7 +66,7 @@ describe("env", () => {
}),
);

request(app)
void request(app)
.get("/__/env.js")
.expect(200)
.expect("content-type", "application/javascript; charset=utf-8")
Expand Down
10 changes: 5 additions & 5 deletions test/unit/middleware/headers.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ describe("cors middleware", () => {
.use(headers({ headers: defaultHeaders }))
.use(okay);

request(app)
void request(app)
.get("/test1")
.expect(200)
.expect("Content-Type", "mime/type")
Expand All @@ -61,7 +61,7 @@ describe("cors middleware", () => {
.use(headers({ headers: defaultHeaders }))
.use(okay);

request(app)
void request(app)
.get("/test3")
.expect(200)
.expect("Access-Control-Allow-Origin", "https://www.example.net")
Expand All @@ -73,7 +73,7 @@ describe("cors middleware", () => {
.use(headers({ headers: defaultHeaders }))
.use(okay);

request(app)
void request(app)
.get("/api/whatever/you/wish")
.expect(200)
.expect("Access-Control-Allow-Origin", "*")
Expand All @@ -94,7 +94,7 @@ describe("cors middleware", () => {
)
.use(okay);

request(app)
void request(app)
.get("/something")
.expect(200)
.expect("custom-header", "for testing")
Expand All @@ -115,7 +115,7 @@ describe("cors middleware", () => {
)
.use(okay);

request(app)
void request(app)
.get("/resources/281.jpg")
.expect(200)
.expect("custom-header", "for testing")
Expand Down
4 changes: 2 additions & 2 deletions test/unit/middleware/not-found.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ describe("not found", () => {
}),
);

request(app)
void request(app)
.get("/anything")
.expect(404)
.expect("not found file")
Expand All @@ -76,7 +76,7 @@ describe("not found", () => {
}),
);

request(app)
void request(app)
.get("/anything")
.expect(404)
.expect("Cache-Control", "public, max-age=3600")
Expand Down
60 changes: 34 additions & 26 deletions test/unit/middleware/redirects.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe("redirect middleware", () => {
it("skips the middleware if there are no redirects configured", (done) => {
const app = connect().use(redirect({ redirects: [] }));

request(app).get("/").expect(404).end(done);
void request(app).get("/").expect(404).end(done);
});

it("skips middleware when there are no matching redirects", (done) => {
Expand All @@ -54,7 +54,7 @@ describe("redirect middleware", () => {
}),
);

request(app).get("/none").expect(404).end(done);
void request(app).get("/none").expect(404).end(done);
});

it("redirects to a configured path", (done) => {
Expand All @@ -72,7 +72,7 @@ describe("redirect middleware", () => {
}),
);

request(app)
void request(app)
.get("/source")
.expect(301)
.expect("location", "/redirect")
Expand All @@ -94,7 +94,7 @@ describe("redirect middleware", () => {
}),
);

request(app)
void request(app)
.get("/source")
.expect(301)
.expect("location", "/redirect")
Expand All @@ -116,7 +116,7 @@ describe("redirect middleware", () => {
}),
);

request(app)
void request(app)
.get("/source")
.expect(301)
.expect("location", "/redirect")
Expand All @@ -138,7 +138,7 @@ describe("redirect middleware", () => {
}),
);

request(app)
void request(app)
.get("/source")
.expect(302)
.expect("location", "/redirect")
Expand All @@ -160,7 +160,7 @@ describe("redirect middleware", () => {
}),
);

request(app)
void request(app)
.get("/source")
.expect(301)
.expect("location", "/redirect")
Expand All @@ -182,7 +182,7 @@ describe("redirect middleware", () => {
}),
);

request(app)
void request(app)
.get("/anthing")
.expect(301)
.expect("location", "/redirect")
Expand All @@ -204,7 +204,7 @@ describe("redirect middleware", () => {
}),
);

request(app)
void request(app)
.get("/old/redirect/path/there")
.expect(301)
.expect("location", "/new/redirect/path/there")
Expand All @@ -226,7 +226,7 @@ describe("redirect middleware", () => {
}),
);

request(app)
void request(app)
.get("/old/capture/group/there")
.expect(301)
.expect("location", "/new/capture/path/there")
Expand All @@ -248,7 +248,11 @@ describe("redirect middleware", () => {
}),
);

request(app).get("/äöü").expect(301).expect("location", "/aou").end(done);
void request(app)
.get("/äöü")
.expect(301)
.expect("location", "/aou")
.end(done);
});

it("percent encodes the redirect location", (done) => {
Expand All @@ -266,7 +270,7 @@ describe("redirect middleware", () => {
}),
);

request(app)
void request(app)
.get("/aou")
.expect(301)
.expect("location", "/%C4%87")
Expand All @@ -288,7 +292,7 @@ describe("redirect middleware", () => {
}),
);

request(app)
void request(app)
.get("/foo/barbar/baz")
.expect(301)
.expect("location", "/bar")
Expand All @@ -310,7 +314,7 @@ describe("redirect middleware", () => {
}),
);

request(app)
void request(app)
.get("/foo/1/2/3/4/bar")
.expect(301)
.expect("location", "/1/2/3/4")
Expand All @@ -333,7 +337,7 @@ describe("redirect middleware", () => {
}),
);

request(app)
void request(app)
.get("/foo/bar")
.expect(301)
.expect("location", "/foo")
Expand All @@ -355,7 +359,7 @@ describe("redirect middleware", () => {
}),
);

request(app)
void request(app)
.get("/mixed/capture/types")
.expect(301)
.expect("location", "/mixed/capture/types")
Expand All @@ -378,7 +382,11 @@ describe("redirect middleware", () => {
}),
);

request(app).get("/old/").expect(301).expect("location", "/new").end(done);
void request(app)
.get("/old/")
.expect(301)
.expect("location", "/new")
.end(done);
});

it("redirects a present optional segment", (done) => {
Expand All @@ -396,7 +404,7 @@ describe("redirect middleware", () => {
}),
);

request(app)
void request(app)
.get("/old/derp")
.expect(301)
.expect("location", "/new/derp")
Expand All @@ -418,7 +426,7 @@ describe("redirect middleware", () => {
}),
);

request(app)
void request(app)
.get("/blog/this/old/post")
.expect(301)
.expect("location", "/new/this/old/post")
Expand All @@ -440,7 +448,7 @@ describe("redirect middleware", () => {
}),
);

request(app)
void request(app)
.get("/old/redirect/path/there")
.expect(302)
.expect("location", "/new/redirect/path/there")
Expand All @@ -462,7 +470,7 @@ describe("redirect middleware", () => {
}),
);

request(app)
void request(app)
.get("/source")
.expect(301)
.expect("Location", "http://redirectedto.com")
Expand All @@ -484,7 +492,7 @@ describe("redirect middleware", () => {
}),
);

request(app)
void request(app)
.get("/source")
.expect(301)
.expect("Location", "https://redirectedto.com")
Expand All @@ -506,7 +514,7 @@ describe("redirect middleware", () => {
}),
);

request(app)
void request(app)
.get("/source?foo=bar&baz=qux")
.expect(301)
.expect("Location", "/destination?foo=bar&baz=qux")
Expand All @@ -528,7 +536,7 @@ describe("redirect middleware", () => {
}),
);

request(app)
void request(app)
.get("/source?foo=bar&baz=qux")
.expect(301)
.expect("Location", "/destination?hello=world&foo=bar&baz=qux")
Expand All @@ -550,7 +558,7 @@ describe("redirect middleware", () => {
}),
);

request(app)
void request(app)
.get("/source?foo=bar&baz=qux")
.expect(301)
.expect("Location", "http://example.com/destination?foo=bar&baz=qux")
Expand All @@ -572,7 +580,7 @@ describe("redirect middleware", () => {
}),
);

request(app)
void request(app)
.get("/source/wat?foo=bar&baz=qux")
.expect(301)
.expect("Location", "/wat/bar?foo=bar&baz=qux")
Expand Down
14 changes: 7 additions & 7 deletions test/unit/server.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe.skip("server", () => {
it("starts a server", (done) => {
const app = server();

request(app).get("/").end(done);
void request(app).get("/").end(done);
});

it("with config", (done) => {
Expand All @@ -58,7 +58,7 @@ describe.skip("server", () => {
},
});

request(app).get("/").expect("index file content").end(done);
void request(app).get("/").expect("index file content").end(done);
});

it("with port", (done) => {
Expand Down Expand Up @@ -105,7 +105,7 @@ describe.skip("server", () => {

stdMocks.use();

request(app)
void request(app)
.get("/")
.end(() => {
stdMocks.restore();
Expand All @@ -126,7 +126,7 @@ describe.skip("server", () => {
},
});

request(app)
void request(app)
.get("/__/env.json")
.expect({
key: "value",
Expand All @@ -144,7 +144,7 @@ describe.skip("server", () => {
},
});

request(app)
void request(app)
.get("/__/env.json")
.expect({
type: "object",
Expand All @@ -158,7 +158,7 @@ describe.skip("server", () => {

const app = server();

return request(app).get("/nope").expect(404).expect(notFoundContent);
return void request(app).get("/nope").expect(404).expect(notFoundContent);
});

it("overriden default error page", async () => {
Expand All @@ -171,6 +171,6 @@ describe.skip("server", () => {
},
});

return request(app).get("/nope").expect(404).expect("error page");
return void request(app).get("/nope").expect(404).expect("error page");
});
});

0 comments on commit 96e4264

Please sign in to comment.