Skip to content

Commit d6cf1ad

Browse files
authored
fix: linting issues breaking ci (#514)
fixes linting issues
1 parent 6c9c5be commit d6cf1ad

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

src/parse.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ export function parse(options: EndpointDefaults): RequestOptions {
5959
if (url.endsWith("/graphql")) {
6060
if (options.mediaType.previews?.length) {
6161
const previewsFromAcceptHeader =
62-
headers.accept.match(/(?<![\w-])[\w-]+(?=-preview)/g) || ([] as string[]);
62+
headers.accept.match(/(?<![\w-])[\w-]+(?=-preview)/g) ||
63+
([] as string[]);
6364
headers.accept = previewsFromAcceptHeader
6465
.concat(options.mediaType.previews!)
6566
.map((preview) => {

test/parse.test.ts

+13-7
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,13 @@ describe("endpoint.parse()", () => {
7575
}
7676
const endTime = performance.now();
7777
const elapsedTime = endTime - startTime;
78-
const reDosThreshold = 2000;
78+
const reDosThreshold = 2000;
7979

8080
expect(elapsedTime).toBeLessThanOrEqual(reDosThreshold);
8181
if (elapsedTime > reDosThreshold) {
82-
console.warn(`🚨 Potential ReDoS Attack! getDuration method took ${elapsedTime.toFixed(2)} ms, exceeding threshold of ${reDosThreshold} ms.`);
82+
console.warn(
83+
`🚨 Potential ReDoS Attack! getDuration method took ${elapsedTime.toFixed(2)} ms, exceeding threshold of ${reDosThreshold} ms.`,
84+
);
8385
}
8486
});
8587

@@ -105,11 +107,13 @@ describe("endpoint.parse()", () => {
105107
}
106108
const endTime = performance.now();
107109
const elapsedTime = endTime - startTime;
108-
const reDosThreshold = 2000;
110+
const reDosThreshold = 2000;
109111

110112
expect(elapsedTime).toBeLessThanOrEqual(reDosThreshold);
111113
if (elapsedTime > reDosThreshold) {
112-
console.warn(`🚨 Potential ReDoS Attack! getDuration method took ${elapsedTime.toFixed(2)} ms, exceeding threshold of ${reDosThreshold} ms.`);
114+
console.warn(
115+
`🚨 Potential ReDoS Attack! getDuration method took ${elapsedTime.toFixed(2)} ms, exceeding threshold of ${reDosThreshold} ms.`,
116+
);
113117
}
114118
});
115119

@@ -118,7 +122,7 @@ describe("endpoint.parse()", () => {
118122
try {
119123
endpoint.parse({
120124
method: "POST",
121-
url: "{"+"00"+"\u0000".repeat(100000)+"a!a"+"}", // Pass in the attack string
125+
url: "{" + "00" + "\u0000".repeat(100000) + "a!a" + "}", // Pass in the attack string
122126
headers: {
123127
accept: "application/vnd.github.v3+json",
124128
"content-type": "text/plain",
@@ -135,11 +139,13 @@ describe("endpoint.parse()", () => {
135139
}
136140
const endTime = performance.now();
137141
const elapsedTime = endTime - startTime;
138-
const reDosThreshold = 2000;
142+
const reDosThreshold = 2000;
139143

140144
expect(elapsedTime).toBeLessThanOrEqual(reDosThreshold);
141145
if (elapsedTime > reDosThreshold) {
142-
console.warn(`🚨 Potential ReDoS Attack! getDuration method took ${elapsedTime.toFixed(2)} ms, exceeding threshold of ${reDosThreshold} ms.`);
146+
console.warn(
147+
`🚨 Potential ReDoS Attack! getDuration method took ${elapsedTime.toFixed(2)} ms, exceeding threshold of ${reDosThreshold} ms.`,
148+
);
143149
}
144150
});
145151
});

0 commit comments

Comments
 (0)