Skip to content
Snippets Groups Projects
Unverified Commit 866cedd3 authored by Rhys Arkins's avatar Rhys Arkins Committed by GitHub
Browse files

refactor: fetchDepUpdates no-param-reassign (#5957)

parent 19b789ab
No related branches found
No related tags found
No related merge requests found
...@@ -16,15 +16,16 @@ import { ...@@ -16,15 +16,16 @@ import {
PackageUpdateResult, PackageUpdateResult,
} from '../../../manager/common'; } from '../../../manager/common';
import { SkipReason } from '../../../types'; import { SkipReason } from '../../../types';
import { clone } from '../../../util/clone';
async function fetchDepUpdates( async function fetchDepUpdates(
packageFileConfig: ManagerConfig & PackageFile, packageFileConfig: ManagerConfig & PackageFile,
dep: PackageDependency indep: PackageDependency
): Promise<void> { ): Promise<PackageDependency> {
/* eslint-disable no-param-reassign */ const dep = clone(indep);
dep.updates = []; dep.updates = [];
if (dep.skipReason) { if (dep.skipReason) {
return; return dep;
} }
const { manager, packageFile } = packageFileConfig; const { manager, packageFile } = packageFileConfig;
const { depName, currentValue } = dep; const { depName, currentValue } = dep;
...@@ -76,7 +77,7 @@ async function fetchDepUpdates( ...@@ -76,7 +77,7 @@ async function fetchDepUpdates(
updates: dep.updates, updates: dep.updates,
}); });
} }
/* eslint-enable no-param-reassign */ return dep;
} }
async function fetchManagerPackagerFileUpdates( async function fetchManagerPackagerFileUpdates(
...@@ -87,14 +88,15 @@ async function fetchManagerPackagerFileUpdates( ...@@ -87,14 +88,15 @@ async function fetchManagerPackagerFileUpdates(
const { packageFile } = pFile; const { packageFile } = pFile;
const packageFileConfig = mergeChildConfig(managerConfig, pFile); const packageFileConfig = mergeChildConfig(managerConfig, pFile);
const { manager } = packageFileConfig; const { manager } = packageFileConfig;
const queue = pFile.deps.map((dep) => (): Promise<void> => const queue = pFile.deps.map((dep) => (): Promise<PackageDependency> =>
fetchDepUpdates(packageFileConfig, dep) fetchDepUpdates(packageFileConfig, dep)
); );
logger.trace( logger.trace(
{ manager, packageFile, queueLength: queue.length }, { manager, packageFile, queueLength: queue.length },
'fetchManagerPackagerFileUpdates starting with concurrency' 'fetchManagerPackagerFileUpdates starting with concurrency'
); );
await pAll(queue, { concurrency: 5 }); // eslint-disable-next-line no-param-reassign
pFile.deps = await pAll(queue, { concurrency: 5 });
logger.trace({ packageFile }, 'fetchManagerPackagerFileUpdates finished'); logger.trace({ packageFile }, 'fetchManagerPackagerFileUpdates finished');
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment