Skip to content

Fix Angular ESLint v13 #183

Fix Angular ESLint v13

Fix Angular ESLint v13 #183

GitHub Actions / test report (Node.js 16.14.0, ESLint 7, Angular ESLint 15) succeeded Apr 17, 2024 in 1s

81 passed, 0 failed and 0 skipped

Tests passed successfully

✅ coverage/junit.xml

81 tests were completed in 3s with 81 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
tests/rules/eslint-plugin-angular-template-consistent-this/test.ts 81✅ 3s

✅ tests/rules/eslint-plugin-angular-template-consistent-this/test.ts

eslint-plugin-angular-template-consistent-this › valid
  ✅ <test [bar]="123" [foo]="true">{{'test'}}</test>
  ✅ <test [bar]="123" [foo]="true">{{'test'}}</test>
  ✅ <test [bar]="this.foo">{{this.bar}}</test>
  ✅ <test [bar]="foo">{{bar}}</test>
  ✅ <test [bar]="this.foo">{{this.bar}}</test>
  ✅ <test [bar]="  this.foo  ">{{\u0009\u0009this.bar\u0009\u0009}}</test>
  ✅ <test [bar]="  foo  ">{{\u0009\u0009bar\u0009\u0009}}</test>
  ✅ <test [bar]="  this.foo  ">{{\u0009\u0009this.bar\u0009\u0009}}</test>
  ✅ <test [bar]="
  this.foo
">{{
  this.bar
}}</test>
  ✅ <test [bar]="
  foo
">{{
  bar
}}</test>
  ✅ <test [bar]="
  this.foo
">{{
  this.bar
}}</test>
  ✅ <test bar="{{this.foo}}">{{this.bar}}</test>
  ✅ <test bar="{{foo}}">{{bar}}</test>
  ✅ <test bar="{{this.foo}}">{{this.bar}}</test>
  ✅ <test bar="{{  this.foo  }}">{{\u0009\u0009this.bar\u0009\u0009}}</test>
  ✅ <test bar="{{  foo  }}">{{\u0009\u0009bar\u0009\u0009}}</test>
  ✅ <test bar="{{  this.foo  }}">{{\u0009\u0009this.bar\u0009\u0009}}</test>
  ✅ <test bar="{{
        this.foo
      }}">{{
        this.bar
      }}</test>
  ✅ <test bar="{{
        foo
      }}">{{
        bar
      }}</test>
  ✅ <test bar="{{
        this.foo
      }}">{{
        this.bar
      }}</test>
  ✅ <test bar="{{this.foo | json}}">{{this.bar | json}}</test>
  ✅ <test bar="{{foo | json}}">{{bar | json}}</test>
  ✅ <test bar="{{this.foo | json}}">{{this.bar | json}}</test>
  ✅ <test [bar]="this.foo.bar.baz">{{this.foo.bar.baz}}</test>
  ✅ <test [bar]="foo.bar.baz">{{foo.bar.baz}}</test>
  ✅ <test [bar]="this.foo.bar.baz">{{this.foo.bar.baz}}</test>
  ✅ <test *ngIf="this.foo"><item>{{this.foo}}</item></test>
  ✅ <test *ngIf="foo"><item>{{foo}}</item></test>
  ✅ <test *ngIf="this.foo"><item>{{this.foo}}</item></test>
  ✅ <test [ngIf]="this.foo"><item>{{this.foo}}</item></test>
  ✅ <test [ngIf]="foo"><item>{{foo}}</item></test>
  ✅ <test [ngIf]="this.foo"><item>{{this.foo}}</item></test>
  ✅ <test *ngIf="this.foo as bar;"><item>{{this.foo}} {{this.bar}}</item></test>
  ✅ <test *ngIf="this.foo as bar;"><item>{{this.foo}} {{bar}}</item></test>
  ✅ <test *ngIf="this.foo as bar;"><item>{{this.foo}} {{bar}}</item></test>
  ✅ <test *ngIf="this.foo; let bar;"><item>{{this.foo}} {{this.bar}}</item></test>
  ✅ <test *ngIf="this.foo; let bar;"><item>{{this.foo}} {{bar}}</item></test>
  ✅ <test *ngIf="this.foo; let bar;"><item>{{this.foo}} {{this.bar}}</item></test>
  ✅ <test *ngIf="this.foo as bar; then this.thenBlock else this.elseBlock">{{bar}}</test>
        <ng-template #thenBlock>...</ng-template>
        <ng-template #elseBlock>...</ng-template>
  ✅ <test *ngIf="this.foo as bar; then thenBlock else elseBlock">{{bar}}</test>
        <ng-template #thenBlock>...</ng-template>
        <ng-template #elseBlock>...</ng-template>
  ✅ <test *ngIf="foo as bar; then thenBlock else elseBlock">{{this.bar}}</test>
        <ng-template #thenBlock>...</ng-template>
        <ng-template #elseBlock>...</ng-template>
  ✅ <li *ngFor="let item of this.items; index as i; trackBy: this.trackByFn">
          <test>{{this.i}} {{this.item}}</test>
        </li>
  ✅ <li *ngFor="let item of items; index as i; trackBy: trackByFn">
          <test>{{i}} {{item}}</test>
        </li>
  ✅ <ng-template ngFor let-item [ngForOf]="this.items" let-i="index" [ngForTrackBy]="this.trackByFn">
          <li>
            <test>{{this.i}} {{this.item}}</test>
          </li>
        </ng-template>
  ✅ <ng-template ngFor let-item [ngForOf]="items" let-i="index" [ngForTrackBy]="trackByFn">
          <li>
            <test>{{i}} {{item}}</test>
          </li>
        </ng-template>
  ✅ <ng-container *ngTemplateOutlet="greetings; context: this.myContext"></ng-container>
        <ng-template #greetings let-person="firstName"><span>Dear {{person}}</span></ng-template>
  ✅ <ng-container *ngTemplateOutlet="this.greetings; context: this.myContext"></ng-container>
        <ng-template #greetings let-person="firstName"><span>Dear {{this.person}}</span></ng-template>
  ✅ <ng-container *ngTemplateOutlet="greetings; context: myContext"></ng-container>
        <ng-template #greetings let-person="firstName"><span>Dear {{person}}</span></ng-template>
  ✅ <test-elm-with-id #test_identifier>
          <test-elm-child [prop]="test_identifier.property"></test-elm-child>
        </test-elm-with-id>
  ✅ <test-elm-with-id #test_identifier>
          <test-elm-child [prop]="this.test_identifier.property"></test-elm-child>
        </test-elm-with-id>
  ✅ <test-elm-with-id #test_identifier>
          <test-elm-child [prop]="test_identifier.property"></test-elm-child>
        </test-elm-with-id>
  ✅ <test-elm-with-id #test_identifier>
          {{ test_identifier.property }}
        </test-elm-with-id>
  ✅ <test-elm-with-id #test_identifier>
          {{ this.test_identifier.property }}
        </test-elm-with-id>
  ✅ <test-elm-with-id #test_identifier>
          {{ test_identifier.property }}
        </test-elm-with-id>
  ✅ <test (bar)="this.foo($event)"></test>
eslint-plugin-angular-template-consistent-this › invalid
  ✅ <test [bar]="foo">{{this.bar}}</test>
  ✅ <test [bar]="this.foo">{{bar}}</test>
  ✅ <test [bar]="  \u0009\u0009foo  \u0009\u0009">{{this.bar}}</test>
                       \u0009\u0009
  ✅ <test [bar]="  \u0009\u0009this.foo  \u0009\u0009">{{bar}}</test>
                       \u0009\u0009
  ✅ <test [bar]="
          
          foo
          
        ">{{this.bar}}</test>
  ✅ <test [bar]="
          
          this.foo
          
        ">{{bar}}</test>
  ✅ <test bar="{{foo}}">{{this.bar}}</test>
  ✅ <test bar="{{this.foo}}">{{bar}}</test>
  ✅ <test bar="{{  foo  }}">{{\u0009\u0009bar\u0009\u0009}}</test>
                                  \u0009\u0009.
  ✅ <test bar="{{  this.foo  }}">{{\u0009\u0009this.bar\u0009\u0009}}</test>
                                       \u0009\u0009.
  ✅ test {{
          pagination
          
        }}
  ✅ test {{
  this.pagination
  
}}
  ✅ <test bar="{{foo | json}}">{{this.bar | json}}</test>
  ✅ <test bar="{{this.foo | json}}">{{bar | json}}</test>
  ✅ <test2 [bar]="foo.bar.baz">{{ foo.bar.baz }}</test2>
                                      .
  ✅ <test3 [bar]="this.foo.bar.baz">{{ this.foo.bar.baz }}</test3>
                                           .
  ✅ <test-elm-with-id #test_identifier>
          <test-elm-child [prop]="test_identifier.property"></test-elm-child>
                                  
        </test-elm-with-id>
  ✅ <test-elm-with-id #test_identifier>
          <test-elm-child [prop]="this.test_identifier.property"></test-elm-child>
                                  
        </test-elm-with-id>
  ✅ <test-elm-with-id #test_identifier>
          {{ test_identifier.property }}
             
        </test-elm-with-id>
  ✅ <test-elm-with-id #test_identifier>
          {{ this.test_identifier.property }}
             
        </test-elm-with-id>
  ✅ <test4 *ngIf="foo as bar; then thenBlock else elseBlock">{{bar}}</test4>
                                                                   .
        <ng-template #thenBlock>...</ng-template>
        <ng-template #elseBlock>...</ng-template>
  ✅ <test *ngIf="this.foo as bar; then this.thenBlock else this.elseBlock">{{this.bar}}</test>
                                                                                 .
        <ng-template #thenBlock>...</ng-template>
        <ng-template #elseBlock>...</ng-template>
  ✅ <li *ngFor="let item of items; index as i; trackBy: trackByFn">
                                                                     .
          <test>{{i}} {{item}}</test>
                        .
        </li>
  ✅ <li *ngFor="let item of this.items; index as i; trackBy: this.trackByFn">
                                                                               .
          <test-ng-for>{{this.i}} {{this.item}}</test-ng-for>
                                    .
        </li>
  ✅ \u0009\u0009\u0009\u0009\u0009<test
\u0009\u0009\u0009\u0009\u0009\u0009*ngIf="
\u0009\u0009\u0009\u0009\u0009\u0009\u0009\u0009foo.bar.baz !== null &&
\u0009\u0009\u0009\u0009\u0009\u0009\u0009\u0009   
\u0009\u0009\u0009\u0009\u0009\u0009\u0009\u0009\u0009\u0009\u0009foo.bar.baz.length > 0
\u0009\u0009\u0009\u0009\u0009\u0009\u0009\u0009\u0009\u0009\u0009;
\u0009\u0009\u0009\u0009\u0009\u0009">
\u0009\u0009\u0009\u0009\u0009\u0009</test>
  ✅ \u0009\u0009\u0009\u0009\u0009<test
\u0009\u0009\u0009\u0009\u0009\u0009*ngIf="
\u0009\u0009\u0009\u0009\u0009\u0009\u0009\u0009foo2.bar2.baz2
\u0009\u0009\u0009\u0009\u0009\u0009\u0009\u0009;
\u0009\u0009\u0009\u0009\u0009\u0009">
\u0009\u0009\u0009\u0009\u0009\u0009</test>