At the moment if I add a rule example trackBy-function which validates html content there is no way to disable a rule for a specific file or line such as https://palantir.github.io/tslint/usage/rule-flags/
It would be nice to have this feature, in order to disable a rule where one doesn't want to emit a lint error.
This could be caused by the rule naming. Did you try using both /* tslint disable:trackBy-function */ and the lower case alternative?
I can try again, but when I checked tslint was only looking for these in TS
files and not HTML files, causes it uses TypeScript to find comments and it
cannot read comments in Html files.
But surly I can try the lower case later and give you an update.
On Tue, 16 Jan 2018 at 16:24, Minko Gechev notifications@github.com wrote:
This could be caused by the rule naming. Did you try using both /* tslint
disable:trackBy-function */ and the lower case alternative?—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/mgechev/codelyzer/issues/491#issuecomment-357995339,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AQv-Wlvf_Do4DIC5c68YnnVDNPmzMnYGks5tLL8YgaJpZM4RfVHE
.
@alan-agius4 yes, you should add this marker in the TypeScript file referencing your HTML template.
We should add an entry in the readme for this case. In case you have a minute, a PR with a one-liner saying this will be helpful!
That works fine thanks :) I'll happily do a PR. Maybe you can indicate in
which readme it should go?
In the root of the project should be fine. Thanks!
It would be great if we could actually disable this rule for specific lines in the template file. I have a situation where some of my ngForOfs are just looping over strings and don't need template-use-track-by-function.
It would be great if we could actually disable this rule for specific lines in the template file. I have a situation where some of my ngForOfs are just looping over strings and don't need template-use-track-by-function.
Absolutely. I'm finding that I have to disable the rule altogether as around half of the usages in the codebase use strings/numbers, and if we have to disable the rule for an entire template there's really no point in trying to enforce it. Maybe there's even a way for the rule to be configured to ignore string/number collections?
Most helpful comment
It would be great if we could actually disable this rule for specific lines in the template file. I have a situation where some of my ngForOfs are just looping over strings and don't need template-use-track-by-function.