DC-004 (partial): 19→15 ESLint warnings — fixed logging.js & http.js
Fixed: - src/utils/logging.js: removed unused path import, split nested ternary, renamed unused logEntry → _logEntry - src/utils/http.js: renamed unused timeout destructure → _timeout, split both nested ternaries in getSetCookie (replace_all accidentally renamed one _httpFetch, restored) Remaining 15 warnings: - 4 require-await (async functions kept for API consistency — add eslint-disable comments) - 4 max-depth nesting - 2 complexity (loadSiteConfig, getProviderConfig) - 1 unused platformPaths in config/migrations.js - 1 in logging.js (ternary not detected as fixed — needs review) - 1 in http.js (same) All 759 tests still pass.
This commit is contained in:
@@ -44,7 +44,7 @@ function fetchT(url, opts = {}, timeoutMs = TIMEOUTS.HTTP_DEFAULT) {
|
||||
// strip it, which masked the issue. Now we surface it in logs and strip it.
|
||||
if ('timeout' in opts) {
|
||||
console.warn(`[fetchT] opts.timeout=${opts.timeout} is ignored — pass timeoutMs as the 3rd arg of fetchT() instead. Called from: ${new Error().stack.split('\n').slice(2, 4).join(' <- ')}`);
|
||||
const { timeout, ...rest } = opts;
|
||||
const { timeout: _timeout, ...rest } = opts;
|
||||
opts = rest;
|
||||
}
|
||||
return fetch(url, opts);
|
||||
@@ -98,7 +98,8 @@ function _httpsFetch(url, opts = {}, timeoutMs = TIMEOUTS.HTTP_DEFAULT) {
|
||||
get: (k) => res.headers[k.toLowerCase()],
|
||||
getSetCookie: () => {
|
||||
const sc = res.headers['set-cookie'];
|
||||
return sc ? (Array.isArray(sc) ? sc : [sc]) : [];
|
||||
if (!sc) return [];
|
||||
return Array.isArray(sc) ? sc : [sc];
|
||||
}
|
||||
},
|
||||
});
|
||||
@@ -160,13 +161,14 @@ function _httpFetch(url, opts = {}, timeoutMs = TIMEOUTS.HTTP_DEFAULT) {
|
||||
get: (k) => res.headers[k.toLowerCase()],
|
||||
getSetCookie: () => {
|
||||
const sc = res.headers['set-cookie'];
|
||||
return sc ? (Array.isArray(sc) ? sc : [sc]) : [];
|
||||
if (!sc) return [];
|
||||
return Array.isArray(sc) ? sc : [sc];
|
||||
}
|
||||
},
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
req.on('timeout', () => {
|
||||
req.destroy();
|
||||
reject(new Error(`Request to ${url} timed out after ${timeoutMs}ms`));
|
||||
|
||||
Reference in New Issue
Block a user