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

feat(core): create template-var-assignment update schematic #29608

Conversation

devversion
Copy link
Member

Introduces a new update schematic called "template-var-assignment"
that is responsible for analyzing template files in order to warn
developers if template variables are assigned to values.

The schematic also comes with a driver for tslint so that the
check can be used wtihin Google.

@devversion devversion added action: review The PR is still awaiting reviews from at least one requested reviewer area: core Issues related to the framework runtime target: major This PR is targeted for the next major release labels Mar 30, 2019
@devversion devversion requested a review from a team as a code owner March 30, 2019 11:49
@ngbot ngbot bot added this to the needsTriage milestone Mar 30, 2019
Introduces a new update schematic called "template-var-assignment"
that is responsible for analyzing template files in order to warn
developers if template variables are assigned to values.

The schematic also comes with a driver for `tslint` so that the
check can be used wtihin Google.
@devversion devversion force-pushed the feat/core-template-local-vars-migration branch from 6f48759 to 9eb1e4e Compare March 30, 2019 11:57
Copy link
Contributor

@AndrewKushnir AndrewKushnir left a comment

Choose a reason for hiding this comment

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

Thanks @devversion. Everything looks great, you've covered the most frequently used patterns and also thanks for the ts rule - it'd be super helpful to avoid these patterns in the future 👍

Copy link
Contributor

@AndrewKushnir AndrewKushnir left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@alexeagle alexeagle left a comment

Choose a reason for hiding this comment

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

only looked at the bazel/g3 bits

srcs = glob(["**/*.ts"]),
tsconfig = "//packages/core/schematics:tsconfig.json",
visibility = [
"//packages/core/schematics:__pkg__",
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: maybe you just want //packages/core/schematics:__subpackages__

Copy link
Member Author

Choose a reason for hiding this comment

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

I'd prefer being explicit as this means that we always need to make sure which packages us another Bazel package.

export class Rule extends Rules.TypedRule {
applyWithProgram(sourceFile: ts.SourceFile, program: ts.Program): RuleFailure[] {
const typeChecker = program.getTypeChecker();
const templateVisitor = new NgComponentTemplateVisitor(typeChecker);
Copy link
Contributor

Choose a reason for hiding this comment

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

we've never run a codelyzer rule in google3. I suspect it won't work because tsunami operates over a TS compilation capture and the angular templates are probably not available. If we need to do this cleanup in google3 someone will probably have to fix that, might be a big design change but I'm not sure

Copy link
Member Author

Choose a reason for hiding this comment

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

That sounds reasonable. I'm not sure I can do much about it from that side, but there is no other way to create that schematic without checking the templates 😁

@kara kara added action: merge The PR is ready for merge by the caretaker action: presubmit The PR is in need of a google3 presubmit and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Apr 2, 2019
@kara
Copy link
Contributor

kara commented Apr 2, 2019

presubmit

@kara kara removed the action: presubmit The PR is in need of a google3 presubmit label Apr 2, 2019
@kara kara unassigned alexeagle and kara Apr 2, 2019
@jasonaden jasonaden closed this in 780081d Apr 2, 2019
jasonaden pushed a commit that referenced this pull request Apr 2, 2019
Introduces a new update schematic called "template-var-assignment"
that is responsible for analyzing template files in order to warn
developers if template variables are assigned to values.

The schematic also comes with a driver for `tslint` so that the
check can be used wtihin Google.

PR Close #29608
DeveloperFromUkraine pushed a commit to DeveloperFromUkraine/angular that referenced this pull request Apr 11, 2019
DeveloperFromUkraine pushed a commit to DeveloperFromUkraine/angular that referenced this pull request Apr 11, 2019
DeveloperFromUkraine pushed a commit to DeveloperFromUkraine/angular that referenced this pull request Apr 11, 2019
Introduces a new update schematic called "template-var-assignment"
that is responsible for analyzing template files in order to warn
developers if template variables are assigned to values.

The schematic also comes with a driver for `tslint` so that the
check can be used wtihin Google.

PR Close angular#29608
wKoza pushed a commit to wKoza/angular that referenced this pull request Apr 17, 2019
wKoza pushed a commit to wKoza/angular that referenced this pull request Apr 17, 2019
Introduces a new update schematic called "template-var-assignment"
that is responsible for analyzing template files in order to warn
developers if template variables are assigned to values.

The schematic also comes with a driver for `tslint` so that the
check can be used wtihin Google.

PR Close angular#29608
@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 14, 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 area: core Issues related to the framework runtime cla: yes target: major This PR is targeted for the next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants