chore: Enable "curly" rule to avoid single-statement if confusion/errors.

This commit is contained in:
cpojer
2026-01-31 16:19:20 +09:00
parent 009b16fab8
commit 5ceff756e1
1266 changed files with 27871 additions and 9393 deletions

View File

@@ -18,7 +18,9 @@ export const CDP_PORT_RANGE_END = 18899;
export const PROFILE_NAME_REGEX = /^[a-z0-9][a-z0-9-]*$/;
export function isValidProfileName(name: string): boolean {
if (!name || name.length > 64) return false;
if (!name || name.length > 64) {
return false;
}
return PROFILE_NAME_REGEX.test(name);
}
@@ -31,9 +33,13 @@ export function allocateCdpPort(
if (!Number.isFinite(start) || !Number.isFinite(end) || start <= 0 || end <= 0) {
return null;
}
if (start > end) return null;
if (start > end) {
return null;
}
for (let port = start; port <= end; port++) {
if (!usedPorts.has(port)) return port;
if (!usedPorts.has(port)) {
return port;
}
}
return null;
}
@@ -41,7 +47,9 @@ export function allocateCdpPort(
export function getUsedPorts(
profiles: Record<string, { cdpPort?: number; cdpUrl?: string }> | undefined,
): Set<number> {
if (!profiles) return new Set();
if (!profiles) {
return new Set();
}
const used = new Set<number>();
for (const profile of Object.values(profiles)) {
if (typeof profile.cdpPort === "number") {
@@ -49,7 +57,9 @@ export function getUsedPorts(
continue;
}
const rawUrl = profile.cdpUrl?.trim();
if (!rawUrl) continue;
if (!rawUrl) {
continue;
}
try {
const parsed = new URL(rawUrl);
const port =
@@ -97,6 +107,8 @@ export function allocateColor(usedColors: Set<string>): string {
export function getUsedColors(
profiles: Record<string, { color: string }> | undefined,
): Set<string> {
if (!profiles) return new Set();
if (!profiles) {
return new Set();
}
return new Set(Object.values(profiles).map((p) => p.color.toUpperCase()));
}