Commit a3856c7
fix(ng-update): do not always use double quotes for generated imports (#16131)
Currently when someone uses single quote import declarations in
their project and the `ng update` migration for Material runs, the
Material imports are rewritten into multiple imports referring to
individual secondary entry-points, but the actual existing quote
style is ignored. This means that the linter can sometimes complain
after the migration has been performed.
Ideally we'd run the tslint fix task after the migration ran in order to
fix all lint rule failures which are specific to the given project, but this
is not a best-practice yet and we need to decide on the CLI-side whether
the CLI should automatically run the fixers after generator/migration
schematics ran. See: angular/angular-cli#14532
Unfortunately we can't do the same thing for the whitespace within
the `NamedImports` declaration because the whitespace for object
literal expressions is hard-coded. See:
https://github.com/microsoft/TypeScript/blob/6a559e37ee0d660fcc94f086a34370e79e94b17a/src/compiler/emitter.ts#L3796-L3797
(`emitObjectLiteralExpression` does not allow configuring the format flags)
Fixes #145321 parent eef132b commit a3856c7
File tree
3 files changed
+27
-12
lines changed- src/material/schematics/ng-update
- test-cases/misc
- upgrade-rules/package-imports-v8
3 files changed
+27
-12
lines changedLines changed: 10 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | | - | |
4 | | - | |
5 | | - | |
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | | - | |
10 | | - | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
Lines changed: 16 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
91 | 94 | | |
92 | 95 | | |
93 | 96 | | |
| |||
144 | 147 | | |
145 | 148 | | |
146 | 149 | | |
147 | | - | |
| 150 | + | |
148 | 151 | | |
149 | 152 | | |
150 | 153 | | |
| |||
166 | 169 | | |
167 | 170 | | |
168 | 171 | | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
169 | 184 | | |
170 | 185 | | |
171 | 186 | | |
| |||
0 commit comments