Skip to content

Commit d1f595f

Browse files
committed
Clean up replaceEmberObjectExpressions
1 parent 54d9935 commit d1f595f

1 file changed

Lines changed: 10 additions & 15 deletions

File tree

transforms/helpers/parse-helper.ts

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -301,20 +301,13 @@ export function replaceEmberObjectExpressions(
301301
);
302302
return;
303303
}
304-
// Parse the import statements
305-
const importedDecoratedProps = getImportedDecoratedProps(j, root);
306-
let transformed = false;
307-
let decoratorsToImportMap: Partial<DecoratorsToImportMap> = {};
308304

309-
({ transformed, decoratorsToImportMap } = transform(
305+
const { transformed, decoratorsToImportMap } = _replaceEmberObjectExpressions(
310306
j,
311307
root,
312-
importedDecoratedProps,
313-
options,
314308
filePath,
315-
transformed,
316-
decoratorsToImportMap
317-
));
309+
options
310+
);
318311

319312
// Need to find another way, as there might be a case where
320313
// one object from a file is transformed and other is not
@@ -328,18 +321,20 @@ export function replaceEmberObjectExpressions(
328321
return transformed;
329322
}
330323

331-
function transform(
324+
function _replaceEmberObjectExpressions(
332325
j: JSCodeshift,
333326
root: Collection<unknown>,
334-
importedDecoratedProps: ImportPropDecoratorMap,
335-
options: Options,
336327
filePath: string,
337-
transformed: boolean,
338-
decoratorsToImportMap: Partial<DecoratorsToImportMap>
328+
options: Options
339329
): {
340330
transformed: boolean;
341331
decoratorsToImportMap: Partial<DecoratorsToImportMap>;
342332
} {
333+
// Parse the import statements
334+
const importedDecoratedProps = getImportedDecoratedProps(j, root);
335+
let transformed = false;
336+
let decoratorsToImportMap: Partial<DecoratorsToImportMap> = {};
337+
343338
// eslint-disable-next-line unicorn/no-array-for-each
344339
getEmberObjectCallExpressions(j, root).forEach((eoCallExpression) => {
345340
const { eoExpression, mixins } =

0 commit comments

Comments
 (0)