Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ng-update): do not always use double quotes for generated imports #16131

Merged
merged 1 commit into from
May 28, 2019

Conversation

devversion
Copy link
Member

@devversion devversion commented May 28, 2019

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)

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
@devversion devversion added pr: merge safe target: patch This PR is targeted for the next patch release labels May 28, 2019
@devversion devversion requested a review from jelbourn as a code owner May 28, 2019 16:30
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label May 28, 2019
Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jelbourn jelbourn added pr: lgtm action: merge The PR is ready for merge by the caretaker labels May 28, 2019
@jelbourn jelbourn merged commit a3856c7 into angular:master May 28, 2019
RudolfFrederiksen pushed a commit to RudolfFrederiksen/material2 that referenced this pull request Jun 21, 2019
…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
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants