Skip to content

Commit 9164d90

Browse files
committed
Fix lint: use nullish coalescing
1 parent fbc4398 commit 9164d90

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/utils/chatCommands.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ describe("parseRuntimeString", () => {
4848
test("accepts SSH with hostname only (user will be inferred)", () => {
4949
const result = parseRuntimeString("ssh hostname", workspaceName);
5050
// When no user is specified, uses current user (process.env.USER)
51-
const expectedUser = process.env.USER || "user";
51+
const expectedUser = process.env.USER ?? "user";
5252
expect(result).toEqual({
5353
type: "ssh",
5454
host: "hostname",
@@ -59,7 +59,7 @@ describe("parseRuntimeString", () => {
5959
test("accepts SSH with hostname.domain only", () => {
6060
const result = parseRuntimeString("ssh dev.example.com", workspaceName);
6161
// When no user is specified, uses current user (process.env.USER)
62-
const expectedUser = process.env.USER || "user";
62+
const expectedUser = process.env.USER ?? "user";
6363
expect(result).toEqual({
6464
type: "ssh",
6565
host: "dev.example.com",

src/utils/chatCommands.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export function parseRuntimeString(
5353

5454
// Extract username from user@host format, or default to current user
5555
const atIndex = hostPart.indexOf("@");
56-
const user = atIndex > 0 ? hostPart.substring(0, atIndex) : process.env.USER || "user";
56+
const user = atIndex > 0 ? hostPart.substring(0, atIndex) : process.env.USER ?? "user";
5757

5858
// Accept both "hostname" and "user@hostname" formats
5959
// SSH will use current user or ~/.ssh/config if user not specified

0 commit comments

Comments
 (0)