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(migrations): do not incorrectly add todo for @Injectable or @Pipe #37732

Conversation

@devversion
Copy link
Member

devversion commented Jun 25, 2020

As of v10, the undecorated-classes-with-decorated-fields migration
generally deals with undecorated classes using Angular features. We
intended to run this migation as part of v10 again as undecorated
classes with Angular features are no longer supported in planned v11.

The migration currently behaves incorrectly in some cases where an
@Injectable or @Pipe decorated classes uses the ngOnDestroy
lifecycle hook. We incorrectly add a TODO for those classes. This
commit fixes that.

Additionally, this change makes the migration more robust to
not migrate a class if it inherits from a component, pipe
injectable or non-abstract directive. We previously did not
need this as the undecorated-classes-with-di migration ran
before, but this is no longer the case.

Last, this commit fixes an issue where multiple TODO's could be
added. This happens when multiple Angular CLI build targets have
an overlap in source files. Multiple programs then capture the
same source file, causing the migration to detect an undecorated
class multiple times (i.e. adding a TODO twice).

Fixes #37726.

@googlebot googlebot added the cla: yes label Jun 25, 2020
@devversion devversion requested a review from crisbeto Jun 25, 2020
@ngbot ngbot bot modified the milestone: needsTriage Jun 25, 2020
@devversion devversion force-pushed the devversion:fix/undecorated-classes-features-migration-incorrectly-adding-todo branch 2 times, most recently from 93d5b19 to 9d234eb Jun 25, 2020
@devversion devversion marked this pull request as ready for review Jun 25, 2020
@pullapprove pullapprove bot requested a review from mhevery Jun 25, 2020
Copy link
Member

crisbeto left a comment

LGTM, aside from one comment.

packages/core/schematics/test/helpers.ts Outdated Show resolved Hide resolved
Copy link
Member

mhevery left a comment

LGTM for integration/**
CLENUP:

  • Please add comment explaining the tests. Not obvious that no comment is what we are asserting.
Copy link
Member

mhevery left a comment

Reviewed-for: integration-test
CLEANUP:

  • Please add comment explaining the tests. Not obvious that no comment is what we are asserting.
devversion added 3 commits Jun 25, 2020
As of v10, the `undecorated-classes-with-decorated-fields` migration
generally deals with undecorated classes using Angular features. We
intended to run this migation as part of v10 again as undecorated
classes with Angular features are no longer supported in planned v11.

The migration currently behaves incorrectly in some cases where an
`@Injectable` or `@Pipe` decorated classes uses the `ngOnDestroy`
lifecycle hook. We incorrectly add a TODO for those classes. This
commit fixes that.

Additionally, this change makes the migration more robust to
not migrate a class if it inherits from a component, pipe
injectable or non-abstract directive. We previously did not
need this as the undecorated-classes-with-di migration ran
before, but this is no longer the case.

Last, this commit fixes an issue where multiple TODO's could be
added. This happens when multiple Angular CLI build targets have
an overlap in source files. Multiple programs then capture the
same source file, causing the migration to detect an undecorated
class multiple times (i.e. adding a TODO twice).

Fixes #37726.
…@pipe

Fix regular expression for omitting empty line whitespace in tests
…@pipe

Add comment to integration test for clarity
@devversion devversion force-pushed the devversion:fix/undecorated-classes-features-migration-incorrectly-adding-todo branch from 179826c to 73b9455 Jun 25, 2020
Copy link
Member

mhevery left a comment

Reviewed-for: integration-tests

@mhevery
Copy link
Member

mhevery commented Jun 25, 2020

@AndrewKushnir
Copy link
Contributor

AndrewKushnir commented Jun 25, 2020

FYI, presubmit looks good (only unrelated failures), so I'm forcing "green" g3 status. Thank you.

AndrewKushnir added a commit that referenced this pull request Jun 25, 2020
…#37732)

As of v10, the `undecorated-classes-with-decorated-fields` migration
generally deals with undecorated classes using Angular features. We
intended to run this migation as part of v10 again as undecorated
classes with Angular features are no longer supported in planned v11.

The migration currently behaves incorrectly in some cases where an
`@Injectable` or `@Pipe` decorated classes uses the `ngOnDestroy`
lifecycle hook. We incorrectly add a TODO for those classes. This
commit fixes that.

Additionally, this change makes the migration more robust to
not migrate a class if it inherits from a component, pipe
injectable or non-abstract directive. We previously did not
need this as the undecorated-classes-with-di migration ran
before, but this is no longer the case.

Last, this commit fixes an issue where multiple TODO's could be
added. This happens when multiple Angular CLI build targets have
an overlap in source files. Multiple programs then capture the
same source file, causing the migration to detect an undecorated
class multiple times (i.e. adding a TODO twice).

Fixes #37726.

PR Close #37732
ngwattcos added a commit to ngwattcos/angular that referenced this pull request Jun 25, 2020
…angular#37732)

As of v10, the `undecorated-classes-with-decorated-fields` migration
generally deals with undecorated classes using Angular features. We
intended to run this migation as part of v10 again as undecorated
classes with Angular features are no longer supported in planned v11.

The migration currently behaves incorrectly in some cases where an
`@Injectable` or `@Pipe` decorated classes uses the `ngOnDestroy`
lifecycle hook. We incorrectly add a TODO for those classes. This
commit fixes that.

Additionally, this change makes the migration more robust to
not migrate a class if it inherits from a component, pipe
injectable or non-abstract directive. We previously did not
need this as the undecorated-classes-with-di migration ran
before, but this is no longer the case.

Last, this commit fixes an issue where multiple TODO's could be
added. This happens when multiple Angular CLI build targets have
an overlap in source files. Multiple programs then capture the
same source file, causing the migration to detect an undecorated
class multiple times (i.e. adding a TODO twice).

Fixes angular#37726.

PR Close angular#37732
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

5 participants
You can’t perform that action at this time.