From d59701b453ece0061e2893dfbb5029844a6c119d Mon Sep 17 00:00:00 2001 From: gonzaloriestra <14979109+gonzaloriestra@users.noreply.github.com> Date: Sun, 19 Jul 2026 00:37:16 +0000 Subject: [PATCH] [Refactor] Use early returns in commonParentDirectory Replace a ternary operator return with a cleaner early-return pattern if there are one or fewer common components, simplifying readability. --- packages/cli-kit/src/public/node/path.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/cli-kit/src/public/node/path.ts b/packages/cli-kit/src/public/node/path.ts index f3721780110..3d526260ba7 100644 --- a/packages/cli-kit/src/public/node/path.ts +++ b/packages/cli-kit/src/public/node/path.ts @@ -119,7 +119,10 @@ export function commonParentDirectory(first: string, second: string): string { while (i < firstParts.length && i < secondParts.length && firstParts[i] === secondParts[i]) { i++ } - return i > 1 ? firstParts.slice(0, i).join('/') : '/' + if (i <= 1) { + return '/' + } + return firstParts.slice(0, i).join('/') } /**