Would it be possible/relevant to add rules that check the syntax of angular templates?
Ideas:
{{ value }}{{ value | pipe }}*ngIf="condition; else"[()] vs ([])<div #unusedRef></div>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
The current shallow linting doesn't deal well with template references but that's another good candidate.
Started whitespace in interpolation here https://github.com/mgechev/codelyzer/commit/d9d7da425b0e92178914d5bde142ace43cbd95d5
Three of the rules are already implemented. I will open two issues to track the remaining two.
Most helpful comment
Hey @QuentinFchx good ideas!
Doable with the
TemplateVisitor.Sounds like a good fit for the
TemplateVisitoras well. It also feels like a good candidate for a compile-time error.The current shallow linting doesn't deal well with template references but that's another good candidate.