Codelyzer: A better way to disable rules in template

Created on 27 May 2018  路  2Comments  路  Source: mgechev/codelyzer

Consider the following markup:

// tslint:disable:trackBy-function <--
@Component({
  template: `
    <div *ngFor="let a of arr"> // Supposing that I want to disable the rule only here
      {{ a }}
    </div>

    <div *ngFor="let a of arr1">
      {{ a }}
    </div>
  `
})
class AppComponent {
  arr = [1, 2, 3];
  arr1 = [1, 2, 3, 4];
}

I can't disable a specific rule for specific line/lines. Currently I've to disable all the template.

votes needed

Most helpful comment

Idea:

<!--
// tslint:disable
-->
<div>template</div>
<!--
// tslint:enable
-->

But indeed, it's ugly. I wonder if the disable/enable commets are configurable in tslint...

All 2 comments

Idea:

<!--
// tslint:disable
-->
<div>template</div>
<!--
// tslint:enable
-->

But indeed, it's ugly. I wonder if the disable/enable commets are configurable in tslint...

I think with more and more rules for template in this repo, we definitely will need a way to disable rules.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

artaommahe picture artaommahe  路  3Comments

Bigous picture Bigous  路  4Comments

damsorian picture damsorian  路  3Comments

davidanaya picture davidanaya  路  4Comments

wesleycho picture wesleycho  路  3Comments