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

Rules to enforce template syntax #314

Closed
QuentinFchx opened this issue Jun 2, 2017 · 3 comments
Closed

Rules to enforce template syntax #314

QuentinFchx opened this issue Jun 2, 2017 · 3 comments

Comments

@QuentinFchx
Copy link

Would it be possible/relevant to add rules that check the syntax of angular templates?
Ideas:

  • ensure whitespaces in interpolation {{ value }}
  • ensure whitespaces around pipe operator {{ value | pipe }}
  • ensure whitespaces after semicolon in structural dir*ngIf="condition; else"
  • check banana-box syntax [()] vs ([])
  • check for unused template-ref <div #unusedRef></div>
@mgechev
Copy link
Owner

mgechev commented Jun 7, 2017

Hey @QuentinFchx good ideas!

  • ensure whitespaces in interpolation {{ value }}
  • ensure whitespaces around pipe operator {{ value | pipe }}
  • ensure whitespaces after semicolon in structural dir*ngIf="condition; else"

Doable with the TemplateVisitor.

  • check banana-box syntax [()] vs ([])

Sounds like a good fit for the TemplateVisitor as well. It also feels like a good candidate for a compile-time error.

  • check for unused template-ref <div #unusedRef>

The current shallow linting doesn't deal well with template references but that's another good candidate.

@mgechev
Copy link
Owner

mgechev commented Jun 11, 2017

Started whitespace in interpolation here d9d7da4

@mgechev
Copy link
Owner

mgechev commented Jun 15, 2017

Three of the rules are already implemented. I will open two issues to track the remaining two.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants