From b3e3072b9b8796dbdc0151e6a80ed08257084b7b Mon Sep 17 00:00:00 2001 From: Eli <88557639+lishaduck@users.noreply.github.com> Date: Mon, 11 Nov 2024 10:04:53 -0600 Subject: [PATCH] chore: cleanup --- src/__tests__/type-syncer.test.ts | 2 +- src/type-syncer.ts | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/__tests__/type-syncer.test.ts b/src/__tests__/type-syncer.test.ts index 7217f58..ee9aebf 100644 --- a/src/__tests__/type-syncer.test.ts +++ b/src/__tests__/type-syncer.test.ts @@ -311,7 +311,7 @@ describe('type syncer', () => { result.syncedFiles[2].newTypings.map((x) => x.typingsName).sort(), ).toEqual(['package3']) expect(result.syncedFiles[3].package.devDependencies).toStrictEqual( - undefined, // Why does this work!? In practice, it's `{}`. + undefined, ) }) diff --git a/src/type-syncer.ts b/src/type-syncer.ts index 0ec2066..30fa4ca 100644 --- a/src/type-syncer.ts +++ b/src/type-syncer.ts @@ -122,10 +122,9 @@ export function createTypeSyncer( ): Promise { const { ignoreDeps, ignorePackages } = opts - const packageFile = file const allLocalPackages = Object.values(IDependencySection) .map((dep) => { - const section = getDependenciesBySection(packageFile, dep) + const section = getDependenciesBySection(file, dep) if (!section) return [] const ignoredSection = ignoreDeps?.includes(dep) @@ -187,9 +186,9 @@ export function createTypeSyncer( } }), ).then(mergeObjects) - const devDeps = packageFile.devDependencies + const devDeps = file.devDependencies if (!dryRun) { - const newPackageFile: IPackageFile = { ...packageFile } + const newPackageFile: IPackageFile = { ...file } if (Object.keys(devDepsToAdd).length > 0) { newPackageFile.devDependencies = orderObject({ @@ -204,7 +203,7 @@ export function createTypeSyncer( return { filePath, newTypings: used, - package: packageFile, + package: file, } } }