Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upNg update forces double quotemark #14532
Comments
|
This is somewhat related to the convo I had with @devversion last week over here angular/components#16086 |
|
Yeah. Linking to the related Material issue as well: angular/components#16035 (comment) |
|
As an aside, |
|
Thanks @clydin for mentioning this. We actually had a conversation about this in the components channel but we never got to the point of double-checking if the printer actually respects these. I will spend some time looking into this now. |
|
Something we also had to look into was the additional whitespace that is added to the |
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 angular#14532
|
I'm actually thinking a post-generate/add/update schematic hook may be the ultimate solution with the hook passing a list of the modified/created files. Similar to a lint-staged/husky setup for git. This would allow the project to use whatever formatter desired (e.g., tslint, eslint, prettier, etc.). |
…#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 #14532
|
The Angular Material part of this was fixed for |
…angular#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 angular#14532
|
I think we should update this issue to be more generic. i.e. talk about lint failures generally caused by arbitrary schematics. The proposal should be that lint fix runs automatically after any generate schematic. That would also simplify the |
|
It would be good to triage this issue as well (priority, etc) so that it gets some attention. While not super-severe, this seems to be a frequent problem. |


Command (mark with an
x)Is this a regression?
Probably, I used ng update several times already and this never happened
Description
After running
ng updateto update from 7.3 to 8.0.0-rc.5 I get a big amount of tslint errors because it used double quotes (") on the modified imports. IE:All the changed imports are from material, so I can't say if it's only an issue with material
run
ng update --nextin any angular project using material