@@ -481,13 +481,13 @@ const patterns = [
481481 } ,
482482
483483 // Array methods.
484- {
485- code : " Array.from ([], function() { console.log(this); z(x => console.log(x, this)); });" ,
484+ ... [ "from" , "fromAsync" ] . map ( methodName => ( {
485+ code : ` Array.${ methodName } ([], function() { console.log(this); z(x => console.log(x, this)); });` ,
486486 languageOptions : { ecmaVersion : 6 } ,
487487 errors,
488488 valid : [ NORMAL ] ,
489489 invalid : [ USE_STRICT , IMPLIED_STRICT , MODULES ] ,
490- } ,
490+ } ) ) ,
491491 ...[
492492 "every" ,
493493 "filter" ,
@@ -506,12 +506,12 @@ const patterns = [
506506 valid : [ NORMAL ] ,
507507 invalid : [ USE_STRICT , IMPLIED_STRICT , MODULES ] ,
508508 } ) ) ,
509- {
510- code : " Array.from ([], function() { console.log(this); z(x => console.log(x, this)); }, obj);" ,
509+ ... [ "from" , "fromAsync" ] . map ( methodName => ( {
510+ code : ` Array.${ methodName } ([], function() { console.log(this); z(x => console.log(x, this)); }, obj);` ,
511511 languageOptions : { ecmaVersion : 6 } ,
512512 valid : [ NORMAL , USE_STRICT , IMPLIED_STRICT , MODULES ] ,
513513 invalid : [ ] ,
514- } ,
514+ } ) ) ,
515515 ...[
516516 "every" ,
517517 "filter" ,
@@ -1123,6 +1123,17 @@ ruleTesterTypeScript.run("no-invalid-this", rule, {
11231123 );
11241124 ` ,
11251125
1126+ `
1127+ Array.fromAsync(
1128+ [],
1129+ function () {
1130+ console.log(this);
1131+ z(x => console.log(x, this));
1132+ },
1133+ obj,
1134+ );
1135+ ` ,
1136+
11261137 `
11271138 foo.every(function () {
11281139 console.log(this);
@@ -1606,6 +1617,15 @@ ruleTesterTypeScript.run("no-invalid-this", rule, {
16061617 } ,
16071618 {
16081619 code : `
1620+ Array.fromAsync([], function () {
1621+ console.log(this);
1622+ z(x => console.log(x, this));
1623+ });
1624+ ` ,
1625+ errors,
1626+ } ,
1627+ {
1628+ code : `
16091629 foo.every(function () {
16101630 console.log(this);
16111631 z(x => console.log(x, this));
0 commit comments