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

@@ -14,8 +14,12 @@ function withDuplex(
typeof Request !== "undefined" &&
input instanceof Request &&
input.body != null;
if (!hasInitBody && !hasRequestBody) return init;
if (init && "duplex" in (init as Record<string, unknown>)) return init;
if (!hasInitBody && !hasRequestBody) {
return init;
}
if (init && "duplex" in (init as Record<string, unknown>)) {
return init;
}
return init
? ({ ...init, duplex: "half" as const } as RequestInitWithDuplex)
: ({ duplex: "half" as const } as RequestInitWithDuplex);
@@ -25,7 +29,9 @@ export function wrapFetchWithAbortSignal(fetchImpl: typeof fetch): typeof fetch
const wrapped = ((input: RequestInfo | URL, init?: RequestInit) => {
const patchedInit = withDuplex(init, input);
const signal = patchedInit?.signal;
if (!signal) return fetchImpl(input, patchedInit);
if (!signal) {
return fetchImpl(input, patchedInit);
}
if (typeof AbortSignal !== "undefined" && signal instanceof AbortSignal) {
return fetchImpl(input, patchedInit);
}
@@ -62,6 +68,8 @@ export function wrapFetchWithAbortSignal(fetchImpl: typeof fetch): typeof fetch
export function resolveFetch(fetchImpl?: typeof fetch): typeof fetch | undefined {
const resolved = fetchImpl ?? globalThis.fetch;
if (!resolved) return undefined;
if (!resolved) {
return undefined;
}
return wrapFetchWithAbortSignal(resolved);
}