I want to enforce developers in my application to use []
instead of {{}}
in element attributes.
for example this code should cause an error (in the build/serve/lint time ):
<mycomponent id="{{i}}">
the current code is
<mycomponent [id]="i">
How I do that?
As commented, one of the possibilities would be to create a custom TSLint rule and add severity to force developers when compiling throwing the proper errors. You will have a tslint.json in your project for all the core rules and custom ones.
Please, check here how to write a custom rule: https://palantir.github.io/tslint/develop/custom-rules/
In other matters be aware that TSLint is being deprecated and ESLint would be its substitute.
Teach them, be nice and set good examples.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With