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

Projects
None yet
5 participants
@devversion
Copy link
Member

commented 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 requested a review from angular/fw-core as a code owner Mar 30, 2019

@ngbot ngbot bot added this to the needsTriage milestone Mar 30, 2019

@googlebot googlebot added the cla: yes label Mar 30, 2019

devversion added some commits Mar 28, 2019

feat(core): template-var-assignment update schematic
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 devversion:feat/core-template-local-vars-migration branch from 6f48759 to 9eb1e4e Mar 30, 2019

@AndrewKushnir
Copy link
Contributor

left a comment

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 👍

@AndrewKushnir
Copy link
Contributor

left a comment

LGTM!

@alexeagle
Copy link
Contributor

left a comment

only looked at the bazel/g3 bits

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

This comment has been minimized.

Copy link
@alexeagle

alexeagle Apr 2, 2019

Contributor

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

This comment has been minimized.

Copy link
@devversion

devversion Apr 2, 2019

Author Member

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);

This comment has been minimized.

Copy link
@alexeagle

alexeagle Apr 2, 2019

Contributor

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

This comment has been minimized.

Copy link
@devversion

devversion Apr 2, 2019

Author Member

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

This comment has been minimized.

Copy link
Contributor

commented Apr 2, 2019

@kara kara unassigned alexeagle and kara Apr 2, 2019

@jasonaden jasonaden closed this in 780081d Apr 2, 2019

jasonaden added a commit that referenced this pull request Apr 2, 2019

feat(core): template-var-assignment update schematic (#29608)
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 added a commit to DeveloperFromUkraine/angular that referenced this pull request Apr 11, 2019

DeveloperFromUkraine added a commit to DeveloperFromUkraine/angular that referenced this pull request Apr 11, 2019

DeveloperFromUkraine added a commit to DeveloperFromUkraine/angular that referenced this pull request Apr 11, 2019

feat(core): template-var-assignment update schematic (angular#29608)
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 added a commit to wKoza/angular that referenced this pull request Apr 17, 2019

wKoza added a commit to wKoza/angular that referenced this pull request Apr 17, 2019

feat(core): template-var-assignment update schematic (angular#29608)
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.