Skip to content

Commit e6860cc

Browse files
committed
fix(core): do not remove empty objects
Closes #223 Refs #117
1 parent 5c80af7 commit e6860cc

File tree

1 file changed

+0
-24
lines changed

1 file changed

+0
-24
lines changed

src/bin-fix-mismatches/fix-mismatches.ts

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
import chalk from 'chalk-template';
22
import { Context, Effect, flow, pipe } from 'effect';
3-
import { isObject } from 'tightrope/guard/is-object.js';
4-
import { isUndefined } from 'tightrope/guard/is-undefined.js';
53
import { logIgnoredSize } from '../bin-lint-semver-ranges/lint-semver-ranges.js';
64
import {
75
logMissingLocalVersion,
@@ -14,7 +12,6 @@ import type { CliConfig } from '../config/types.js';
1412
import { ICON } from '../constants.js';
1513
import type { ErrorHandlers } from '../error-handlers/default-error-handlers.js';
1614
import { defaultErrorHandlers } from '../error-handlers/default-error-handlers.js';
17-
import type { Ctx } from '../get-context/index.js';
1815
import { getContext } from '../get-context/index.js';
1916
import { getInstances } from '../get-instances/index.js';
2017
import { exitIfInvalid } from '../io/exit-if-invalid.js';
@@ -103,8 +100,6 @@ export function fixMismatches({
103100
index++;
104101
}
105102

106-
yield* $(removeEmptyObjects(ctx));
107-
108103
return ctx;
109104
}),
110105
Effect.flatMap(writeIfChanged),
@@ -137,25 +132,6 @@ export function fixMismatch(report: Report.Version.Fixable.Any) {
137132
);
138133
}
139134

140-
/** Remove empty objects such as `{"dependencies": {}}` left after deleting */
141-
function removeEmptyObjects(ctx: Ctx) {
142-
return Effect.sync(() => {
143-
ctx.packageJsonFiles.forEach(file => {
144-
const contents = file.jsonFile.contents;
145-
Object.keys(contents).forEach(key => {
146-
const value = contents[key];
147-
if (
148-
isObject(value) &&
149-
value &&
150-
Object.values(value).every(isUndefined)
151-
) {
152-
delete contents[key];
153-
}
154-
});
155-
});
156-
});
157-
}
158-
159135
export function logAlreadyValidSize(amount: number) {
160136
const msg = chalk`${padStart(amount)} {green ${ICON.tick}} already valid`;
161137
return Effect.logInfo(msg);

0 commit comments

Comments
 (0)