fix: use nullish coalescing in loadDotEnv for Sonar S6606
sonar / sonar (push) Skipped
sonar / sonar (pull_request) Successful in 1m8s
sonar / sonar (push) Skipped
sonar / sonar (pull_request) Successful in 1m8s
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+1
-1
@@ -12,7 +12,7 @@ export function loadDotEnv(cwd = process.cwd()): void {
|
|||||||
if (i <= 0) continue;
|
if (i <= 0) continue;
|
||||||
const key = trimmed.slice(0, i).trim();
|
const key = trimmed.slice(0, i).trim();
|
||||||
const value = trimmed.slice(i + 1).trim();
|
const value = trimmed.slice(i + 1).trim();
|
||||||
if (process.env[key] === undefined) process.env[key] = value;
|
process.env[key] ??= value;
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
// optional .env
|
// optional .env
|
||||||
|
|||||||
Reference in New Issue
Block a user