Skip to content

Commit d1cda29

Browse files
committed
Fix small sonar issues
1 parent 0b4e1a4 commit d1cda29

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

src/api/coderApi.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,9 @@ export class CoderApi extends Api {
110110
options?: ClientOptions,
111111
) => {
112112
const searchParams = new URLSearchParams({ follow: "true" });
113-
if (logs.length) {
114-
searchParams.append("after", logs[logs.length - 1].id.toString());
113+
const lastLog = logs.at(-1);
114+
if (lastLog) {
115+
searchParams.append("after", lastLog.id.toString());
115116
}
116117

117118
return this.createWebSocket<ProvisionerJobLog>({
@@ -311,9 +312,9 @@ function setupInterceptors(
311312
output,
312313
);
313314
// Add headers from the header command.
314-
Object.entries(headers).forEach(([key, value]) => {
315+
for (const [key, value] of Object.entries(headers)) {
315316
config.headers[key] = value;
316-
});
317+
}
317318

318319
// Configure proxy and TLS.
319320
// Note that by default VS Code overrides the agent. To prevent this, set
@@ -425,7 +426,7 @@ function wrapResponseTransform(
425426
function getSize(headers: AxiosHeaders, data: unknown): number | undefined {
426427
const contentLength = headers["content-length"];
427428
if (contentLength !== undefined) {
428-
return parseInt(contentLength, 10);
429+
return Number.parseInt(contentLength, 10);
429430
}
430431

431432
return sizeOf(data);

src/api/streamingFetchAdapter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { type AxiosInstance } from "axios";
22
import { type FetchLikeInit, type FetchLikeResponse } from "eventsource";
3-
import { type IncomingMessage } from "http";
3+
import { type IncomingMessage } from "node:http";
44

55
/**
66
* Creates a fetch adapter using an Axios instance that returns streaming responses.

vitest.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import path from "path";
1+
import path from "node:path";
22
import { defineConfig } from "vitest/config";
33

44
export default defineConfig({

0 commit comments

Comments
 (0)