@@ -63,7 +63,7 @@ const invalidTestCases: Array<TSESLint.InvalidTestCase<MessageIds, Options>> = [
63
63
errors : [
64
64
{
65
65
line : 9 ,
66
- messageId : 'unbound ' ,
66
+ messageId : 'unboundWithoutThisAnnotation ' ,
67
67
} ,
68
68
] ,
69
69
} ,
@@ -72,7 +72,7 @@ const invalidTestCases: Array<TSESLint.InvalidTestCase<MessageIds, Options>> = [
72
72
errors : [
73
73
{
74
74
line : 1 ,
75
- messageId : 'unbound ' ,
75
+ messageId : 'unboundWithoutThisAnnotation ' ,
76
76
} ,
77
77
] ,
78
78
} ,
@@ -87,7 +87,7 @@ const invalidTestCases: Array<TSESLint.InvalidTestCase<MessageIds, Options>> = [
87
87
errors : [
88
88
{
89
89
line : 10 ,
90
- messageId : 'unbound ' ,
90
+ messageId : 'unboundWithoutThisAnnotation ' ,
91
91
} ,
92
92
] ,
93
93
} ,
@@ -101,7 +101,7 @@ const invalidTestCases: Array<TSESLint.InvalidTestCase<MessageIds, Options>> = [
101
101
errors : [
102
102
{
103
103
line : 9 ,
104
- messageId : 'unbound ' as const ,
104
+ messageId : 'unboundWithoutThisAnnotation ' as const ,
105
105
} ,
106
106
] ,
107
107
} ) ) ,
@@ -115,7 +115,7 @@ const invalidTestCases: Array<TSESLint.InvalidTestCase<MessageIds, Options>> = [
115
115
errors : [
116
116
{
117
117
line : 9 ,
118
- messageId : 'unbound ' as const ,
118
+ messageId : 'unboundWithoutThisAnnotation ' as const ,
119
119
} ,
120
120
] ,
121
121
} ) ) ,
@@ -237,7 +237,7 @@ function addContainsMethodsClassInvalid(
237
237
errors : [
238
238
{
239
239
line : 18 ,
240
- messageId : 'unbound ' ,
240
+ messageId : 'unboundWithoutThisAnnotation ' ,
241
241
} ,
242
242
] ,
243
243
} ) ) ;
@@ -460,6 +460,22 @@ class Foo {
460
460
}
461
461
const { bound } = new Foo();
462
462
` ,
463
+ // https://github.com/typescript-eslint/typescript-eslint/issues/1866
464
+ `
465
+ class BaseClass {
466
+ x: number = 42;
467
+ logThis() {}
468
+ }
469
+ class OtherClass extends BaseClass {
470
+ superLogThis: any;
471
+ constructor() {
472
+ super();
473
+ this.superLogThis = super.logThis;
474
+ }
475
+ }
476
+ const oc = new OtherClass();
477
+ oc.superLogThis();
478
+ ` ,
463
479
] ,
464
480
invalid : [
465
481
{
@@ -477,7 +493,7 @@ Promise.resolve().then(console.log);
477
493
errors : [
478
494
{
479
495
line : 10 ,
480
- messageId : 'unbound ' ,
496
+ messageId : 'unboundWithoutThisAnnotation ' ,
481
497
} ,
482
498
] ,
483
499
} ,
@@ -489,7 +505,7 @@ const x = console.log;
489
505
errors : [
490
506
{
491
507
line : 3 ,
492
- messageId : 'unbound ' ,
508
+ messageId : 'unboundWithoutThisAnnotation ' ,
493
509
} ,
494
510
] ,
495
511
} ,
@@ -504,15 +520,15 @@ function foo(arg: ContainsMethods | null) {
504
520
errors : [
505
521
{
506
522
line : 20 ,
507
- messageId : 'unbound ' ,
523
+ messageId : 'unboundWithoutThisAnnotation ' ,
508
524
} ,
509
525
{
510
526
line : 21 ,
511
- messageId : 'unbound ' ,
527
+ messageId : 'unboundWithoutThisAnnotation ' ,
512
528
} ,
513
529
{
514
530
line : 22 ,
515
- messageId : 'unbound ' ,
531
+ messageId : 'unboundWithoutThisAnnotation ' ,
516
532
} ,
517
533
] ,
518
534
} ,
@@ -554,7 +570,7 @@ ContainsMethods.unboundStatic;
554
570
errors : [
555
571
{
556
572
line : 8 ,
557
- messageId : 'unbound ' ,
573
+ messageId : 'unboundWithoutThisAnnotation ' ,
558
574
} ,
559
575
] ,
560
576
} ,
@@ -569,7 +585,7 @@ const x = CommunicationError.prototype.foo;
569
585
errors : [
570
586
{
571
587
line : 5 ,
572
- messageId : 'unbound ' ,
588
+ messageId : 'unboundWithoutThisAnnotation ' ,
573
589
} ,
574
590
] ,
575
591
} ,
@@ -579,7 +595,7 @@ const x = CommunicationError.prototype.foo;
579
595
errors : [
580
596
{
581
597
line : 1 ,
582
- messageId : 'unbound ' ,
598
+ messageId : 'unboundWithoutThisAnnotation ' ,
583
599
} ,
584
600
] ,
585
601
} ,
@@ -598,7 +614,7 @@ instance.unbound = x; // THIS SHOULD NOT
598
614
errors : [
599
615
{
600
616
line : 9 ,
601
- messageId : 'unbound ' ,
617
+ messageId : 'unboundWithoutThisAnnotation ' ,
602
618
} ,
603
619
] ,
604
620
} ,
@@ -626,7 +642,7 @@ const { unbound } = new Foo();
626
642
errors : [
627
643
{
628
644
line : 5 ,
629
- messageId : 'unbound ' ,
645
+ messageId : 'unboundWithoutThisAnnotation ' ,
630
646
} ,
631
647
] ,
632
648
} ,
@@ -655,7 +671,7 @@ let unbound;
655
671
errors : [
656
672
{
657
673
line : 6 ,
658
- messageId : 'unbound ' ,
674
+ messageId : 'unboundWithoutThisAnnotation ' ,
659
675
} ,
660
676
] ,
661
677
} ,
@@ -684,7 +700,7 @@ const { foo } = CommunicationError.prototype;
684
700
errors : [
685
701
{
686
702
line : 5 ,
687
- messageId : 'unbound ' ,
703
+ messageId : 'unboundWithoutThisAnnotation ' ,
688
704
} ,
689
705
] ,
690
706
} ,
@@ -699,7 +715,7 @@ let foo;
699
715
errors : [
700
716
{
701
717
line : 6 ,
702
- messageId : 'unbound ' ,
718
+ messageId : 'unboundWithoutThisAnnotation ' ,
703
719
} ,
704
720
] ,
705
721
} ,
@@ -711,7 +727,7 @@ const { log } = console;
711
727
errors : [
712
728
{
713
729
line : 3 ,
714
- messageId : 'unbound ' ,
730
+ messageId : 'unboundWithoutThisAnnotation ' ,
715
731
} ,
716
732
] ,
717
733
} ,
@@ -720,7 +736,50 @@ const { log } = console;
720
736
errors : [
721
737
{
722
738
line : 1 ,
723
- messageId : 'unbound' ,
739
+ messageId : 'unboundWithoutThisAnnotation' ,
740
+ } ,
741
+ ] ,
742
+ } ,
743
+ // https://github.com/typescript-eslint/typescript-eslint/issues/1866
744
+ {
745
+ code : `
746
+ class BaseClass {
747
+ logThis() {}
748
+ }
749
+ class OtherClass extends BaseClass {
750
+ constructor() {
751
+ super();
752
+ const x = super.logThis;
753
+ }
754
+ }
755
+ ` ,
756
+ errors : [
757
+ {
758
+ line : 8 ,
759
+ column : 15 ,
760
+ messageId : 'unboundWithoutThisAnnotation' ,
761
+ } ,
762
+ ] ,
763
+ } ,
764
+ // https://github.com/typescript-eslint/typescript-eslint/issues/1866
765
+ {
766
+ code : `
767
+ class BaseClass {
768
+ logThis() {}
769
+ }
770
+ class OtherClass extends BaseClass {
771
+ constructor() {
772
+ super();
773
+ let x;
774
+ x = super.logThis;
775
+ }
776
+ }
777
+ ` ,
778
+ errors : [
779
+ {
780
+ line : 9 ,
781
+ column : 9 ,
782
+ messageId : 'unboundWithoutThisAnnotation' ,
724
783
} ,
725
784
] ,
726
785
} ,
0 commit comments