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
Extended template checks #42984
Extended template checks #42984
Conversation
1db63b9
to
915515b
packages/compiler-cli/src/ngtsc/extended_template_diagnostics/api/api.ts
Outdated
Show resolved
Hide resolved
packages/compiler-cli/src/ngtsc/extended_template_diagnostics/api/api.ts
Outdated
Show resolved
Hide resolved
packages/compiler-cli/src/ngtsc/extended_template_diagnostics/src/template_checker.ts
Outdated
Show resolved
Hide resolved
packages/compiler-cli/src/ngtsc/extended_template_diagnostics/src/template_checker.ts
Outdated
Show resolved
Hide resolved
...piler-cli/src/ngtsc/extended_template_diagnostics/src/template_checks/banana_in_box_check.ts
Outdated
Show resolved
Hide resolved
...piler-cli/src/ngtsc/extended_template_diagnostics/src/template_checks/banana_in_box_check.ts
Outdated
Show resolved
Hide resolved
...piler-cli/src/ngtsc/extended_template_diagnostics/src/template_checks/banana_in_box_check.ts
Outdated
Show resolved
Hide resolved
...piler-cli/src/ngtsc/extended_template_diagnostics/src/template_checks/banana_in_box_check.ts
Outdated
Show resolved
Hide resolved
packages/compiler-cli/src/ngtsc/extended_template_diagnostics/test/template_checks_spec.ts
Outdated
Show resolved
Hide resolved
Great work on an initial proposal here, looking really good!
Mostly just a bunch of nitpicks, a few stylistic comments, and a couple questions about edge cases. Nothing too concerning with this PR, hope we can land it soon!
packages/compiler-cli/src/ngtsc/extended_template_diagnostics/BUILD.bazel
Outdated
Show resolved
Hide resolved
packages/compiler-cli/src/ngtsc/extended_template_diagnostics/src/template_checker.ts
Outdated
Show resolved
Hide resolved
packages/compiler-cli/src/ngtsc/extended_template_diagnostics/src/template_checker.ts
Outdated
Show resolved
Hide resolved
packages/compiler-cli/src/ngtsc/extended_template_diagnostics/src/template_checker.ts
Outdated
Show resolved
Hide resolved
packages/compiler-cli/src/ngtsc/extended_template_diagnostics/src/template_checker.ts
Outdated
Show resolved
Hide resolved
...piler-cli/src/ngtsc/extended_template_diagnostics/src/template_checks/banana_in_box_check.ts
Outdated
Show resolved
Hide resolved
...piler-cli/src/ngtsc/extended_template_diagnostics/src/template_checks/banana_in_box_check.ts
Outdated
Show resolved
Hide resolved
...piler-cli/src/ngtsc/extended_template_diagnostics/src/template_checks/banana_in_box_check.ts
Outdated
Show resolved
Hide resolved
packages/compiler-cli/src/ngtsc/extended_template_diagnostics/test/template_checks_spec.ts
Outdated
Show resolved
Hide resolved
packages/compiler-cli/src/ngtsc/extended_template_diagnostics/test/template_checks_spec.ts
Outdated
Show resolved
Hide resolved
packages/compiler-cli/src/ngtsc/extended_template_diagnostics/api/api.ts
Outdated
Show resolved
Hide resolved
737eb07
to
9da58bc
packages/compiler-cli/src/ngtsc/extended_template_diagnostics/BUILD.bazel
Outdated
Show resolved
Hide resolved
packages/compiler-cli/src/ngtsc/extended_template_diagnostics/src/template_checker.ts
Outdated
Show resolved
Hide resolved
packages/compiler-cli/src/ngtsc/extended_template_diagnostics/api/api.ts
Outdated
Show resolved
Hide resolved
packages/compiler-cli/src/ngtsc/extended_template_diagnostics/src/template_checker.ts
Outdated
Show resolved
Hide resolved
packages/compiler-cli/src/ngtsc/typecheck/test/diagnostics_spec.ts
Outdated
Show resolved
Hide resolved
...piler-cli/src/ngtsc/extended_template_diagnostics/src/template_checks/banana_in_box_check.ts
Outdated
Show resolved
Hide resolved
...piler-cli/src/ngtsc/extended_template_diagnostics/src/template_checks/banana_in_box_check.ts
Outdated
Show resolved
Hide resolved
df24977
to
e12f69e
packages/compiler-cli/src/ngtsc/typecheck/extended/src/template_checker.ts
Outdated
Show resolved
Hide resolved
packages/compiler-cli/src/ngtsc/typecheck/extended/src/template_checker.ts
Outdated
Show resolved
Hide resolved
| @@ -203,11 +203,15 @@ export class NullVisitor implements Visitor<void> { | |||
| export class RecursiveVisitor implements Visitor<void> { | |||
| visitElement(element: Element): void { | |||
| visitAll(this, element.attributes); | |||
| visitAll(this, element.inputs); | |||
| visitAll(this, element.outputs); | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for making this fix and for keeping it in a separate commit, much easier to understand the context this way!
packages/compiler-cli/src/ngtsc/typecheck/extended/src/template_checks/banana_in_box/spec.ts
Outdated
Show resolved
Hide resolved
...compiler-cli/src/ngtsc/typecheck/extended/src/template_checks/invalid_banana_in_box/index.ts
Show resolved
Hide resolved
...compiler-cli/src/ngtsc/typecheck/extended/src/template_checks/invalid_banana_in_box/index.ts
Show resolved
Hide resolved
...compiler-cli/src/ngtsc/typecheck/extended/src/template_checks/invalid_banana_in_box/index.ts
Show resolved
Hide resolved
...compiler-cli/src/ngtsc/typecheck/extended/src/template_checks/invalid_banana_in_box/index.ts
Show resolved
Hide resolved
…it's API (angular#42984) This commit introduces //packages/compiler-cli/src/ngtsc/typecheck/extended as a container for a new phase of diagnostics generation. The API provides an interface for new template checks to implement and generate template diagnostics. Refs angular#42966 PR Close angular#42984
…ngular#42984) specific This commit makes the wrapper function `makeTemplateDiagnostic` take an ErrorCode as a type for the `ts.Diagnostic`s to be generated. Refs angular#42966 PR Close angular#42984
…omponent` function (angular#42984) Add function to get extended template diagnostics generated by all the template checks. Refs angular#42966 PR Close angular#42984
angular#42984) This commit moves the test utils used in the typechecking tests into its own package. This makes them available to be used in the tests of a different package. Refs angular#42966 PR Close angular#42984
…ngular#42984) Export `getSourceCodeForDiagnostic` from `ngtsc/testing` to make it available for other packages. This will help confirm that the source code is correct in other tests. Refs angular#42966 PR Close angular#42984
…plates (angular#42984) This commit adds to the exisiting `RecursiveVisitor` and visits inputs and outputs for elements and templates. Refs angular#42966 PR Close angular#42984
…angular#42984) Add the implementation of a Template Check that ensures the correct use of two-way binding syntax. Generates a warning when '([foo])="bar"' is found instead of '[(foo)]="bar"'. Refs angular#42966 PR Close angular#42984
Create the test package for extended_template_diagnostics and add a unit test for the `BananaInBoxCheck`. Refs angular#42966 PR Close angular#42984
…it's API (angular#42984) This commit introduces //packages/compiler-cli/src/ngtsc/typecheck/extended as a container for a new phase of diagnostics generation. The API provides an interface for new template checks to implement and generate template diagnostics. Refs angular#42966 PR Close angular#42984
…ngular#42984) specific This commit makes the wrapper function `makeTemplateDiagnostic` take an ErrorCode as a type for the `ts.Diagnostic`s to be generated. Refs angular#42966 PR Close angular#42984
…omponent` function (angular#42984) Add function to get extended template diagnostics generated by all the template checks. Refs angular#42966 PR Close angular#42984
angular#42984) This commit moves the test utils used in the typechecking tests into its own package. This makes them available to be used in the tests of a different package. Refs angular#42966 PR Close angular#42984
…ngular#42984) Export `getSourceCodeForDiagnostic` from `ngtsc/testing` to make it available for other packages. This will help confirm that the source code is correct in other tests. Refs angular#42966 PR Close angular#42984
…plates (angular#42984) This commit adds to the exisiting `RecursiveVisitor` and visits inputs and outputs for elements and templates. Refs angular#42966 PR Close angular#42984
…angular#42984) Add the implementation of a Template Check that ensures the correct use of two-way binding syntax. Generates a warning when '([foo])="bar"' is found instead of '[(foo)]="bar"'. Refs angular#42966 PR Close angular#42984
Create the test package for extended_template_diagnostics and add a unit test for the `BananaInBoxCheck`. Refs angular#42966 PR Close angular#42984
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |


PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
The compiler currently doesn't really generates warning.
Issue Number: #42966
What is the new behavior?
This PR introduces the
extendedpackage which should be able to generate diagnostics after type checking (integration with the compiler should come in a future PR). The API provides an interface forTemplateChecks to be authored, the package also has a function to generate the extended template diagnostics. The banana in a box check, that validates the two-way binding syntax is implemented with it's unit test.The
extendedpackage is private, the only modification to the public API is the newBANANA_IN_BOXErrorCode.Does this PR introduce a breaking change?
Other information