Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Extended template checks #42984

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

Closed
wants to merge 8 commits into from
Closed

Conversation

danieltre23
Copy link
Contributor

@danieltre23 danieltre23 commented Jul 28, 2021

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.io application / infrastructure changes
  • Other... Please describe:

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 extended package 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 for TemplateChecks 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 extended package is private, the only modification to the public API is the new BANANA_IN_BOX ErrorCode.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@danieltre23 danieltre23 added the target: patch This PR is targeted for the next patch release label Jul 28, 2021
@google-cla google-cla bot added the cla: yes label Jul 28, 2021
@danieltre23 danieltre23 force-pushed the template-checks branch 2 times, most recently from 1db63b9 to 915515b Compare July 28, 2021 19:38
@dylhunn dylhunn added the area: compiler Issues related to `ngc`, Angular's template compiler label Jul 28, 2021
@ngbot ngbot bot added this to the Backlog milestone Jul 28, 2021
Copy link
Contributor

@dgp1130 dgp1130 left a comment

Choose a reason for hiding this comment

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

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!

@danieltre23 danieltre23 force-pushed the template-checks branch 2 times, most recently from 737eb07 to 9da58bc Compare August 2, 2021 18:46
alxhub
alxhub previously requested changes Aug 3, 2021
@danieltre23 danieltre23 force-pushed the template-checks branch 2 times, most recently from df24977 to e12f69e Compare August 4, 2021 17:05
packages/compiler-cli/src/ngtsc/typecheck/testing/index.ts Outdated Show resolved Hide resolved
packages/compiler-cli/src/ngtsc/testing/src/utils.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);
Copy link
Contributor

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!

AndrewKushnir pushed a commit that referenced this pull request Aug 10, 2021
Create the test package for extended_template_diagnostics and add a unit
test for the `BananaInBoxCheck`.

Refs #42966

PR Close #42984
AndrewKushnir pushed a commit that referenced this pull request Aug 10, 2021
…it's API (#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 #42966

PR Close #42984
AndrewKushnir pushed a commit that referenced this pull request Aug 10, 2021
…42984)

specific

This commit makes the wrapper function `makeTemplateDiagnostic` take an
ErrorCode as a type for the `ts.Diagnostic`s to be generated.

Refs #42966

PR Close #42984
AndrewKushnir pushed a commit that referenced this pull request Aug 10, 2021
…omponent` function (#42984)

Add function to get extended template diagnostics generated by all the template checks.

Refs #42966

PR Close #42984
AndrewKushnir pushed a commit that referenced this pull request Aug 10, 2021
#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 #42966

PR Close #42984
AndrewKushnir pushed a commit that referenced this pull request Aug 10, 2021
…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 #42966

PR Close #42984
AndrewKushnir pushed a commit that referenced this pull request Aug 10, 2021
…plates (#42984)

This commit adds to the exisiting `RecursiveVisitor` and visits inputs
and outputs for elements and templates.

Refs #42966

PR Close #42984
AndrewKushnir pushed a commit that referenced this pull request Aug 10, 2021
…#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 #42966

PR Close #42984
AndrewKushnir pushed a commit that referenced this pull request Aug 10, 2021
Create the test package for extended_template_diagnostics and add a unit
test for the `BananaInBoxCheck`.

Refs #42966

PR Close #42984
@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 26, 2021
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: compiler Issues related to `ngc`, Angular's template compiler cla: yes target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.