Skip to content

Commit 0db75ab

Browse files
thePunderWomandylhunn
authored andcommitted
fix(migrations): remove setting that removes comments in CF migration (#53350)
This setting was added to prevent comment duplication, since the TS AST printer includes prior line comments as part of a given line with no way to really avoid that. However in component imports, it is not safe to remove comments as they could be load bearing for some. PR Close #53350
1 parent 0a53f96 commit 0db75ab

File tree

1 file changed

+1
-7
lines changed
  • packages/core/schematics/ng-generate/control-flow-migration

1 file changed

+1
-7
lines changed

packages/core/schematics/ng-generate/control-flow-migration/util.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,7 @@ function updateImportClause(clause: ts.ImportClause, removeCommonModule: boolean
7878

7979
function updateClassImports(
8080
propAssignment: ts.PropertyAssignment, removeCommonModule: boolean): string|null {
81-
// removeComments is set to true to prevent duplication of comments
82-
// when the import declaration is at the top of the file, but right after a comment
83-
// without this, the comment gets duplicated when the declaration is updated.
84-
// the typescript AST includes that preceding comment as part of the import declaration full text.
85-
const printer = ts.createPrinter({
86-
removeComments: true,
87-
});
81+
const printer = ts.createPrinter();
8882
const importList = propAssignment.initializer as ts.ArrayLiteralExpression;
8983
const removals = removeCommonModule ? importWithCommonRemovals : importRemovals;
9084
const elements = importList.elements.filter(el => !removals.includes(el.getText()));

0 commit comments

Comments
 (0)