Skip to content

Commit 99489b9

Browse files
authoredMay 7, 2024··
no-array-method-this-argument: Check Array.fromAsync() (#2330)
1 parent 497519e commit 99489b9

4 files changed

+299
-23
lines changed
 

‎rules/no-array-method-this-argument.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -184,12 +184,12 @@ const create = context => {
184184
});
185185
});
186186

187-
// `Array.from()`
187+
// `Array.from()` and `Array.fromAsync()`
188188
context.on('CallExpression', callExpression => {
189189
if (
190190
!isMethodCall(callExpression, {
191191
object: 'Array',
192-
method: 'from',
192+
methods: ['from', 'fromAsync'],
193193
argumentsLength: 3,
194194
optionalCall: false,
195195
optionalMember: false,

‎test/no-array-method-this-argument.mjs

+31
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ test.snapshot({
1414
'Array.from?.(iterableOrArrayLike, () => {}, thisArgument)',
1515
'Array?.from(iterableOrArrayLike, () => {}, thisArgument)',
1616
'NotArray.from(iterableOrArrayLike, () => {}, thisArgument)',
17+
'new Array.fromAsync(iterableOrArrayLike, () => {}, thisArgument)',
18+
'Array.fromAsync?.(iterableOrArrayLike, () => {}, thisArgument)',
19+
'Array?.fromAsync(iterableOrArrayLike, () => {}, thisArgument)',
20+
'NotArray.fromAsync(iterableOrArrayLike, () => {}, thisArgument)',
1721

1822
// More or less arguments
1923
'array.map()',
@@ -28,6 +32,13 @@ test.snapshot({
2832
'Array.from(iterableOrArrayLike, ...() => {}, thisArgument)',
2933
'Array.from(...iterableOrArrayLike, () => {}, thisArgument)',
3034
'Array.from(iterableOrArrayLike, () => {}, thisArgument, extraArgument)',
35+
'Array.fromAsync()',
36+
'Array.fromAsync(iterableOrArrayLike)',
37+
'Array.fromAsync(iterableOrArrayLike, () => {},)',
38+
'Array.fromAsync(iterableOrArrayLike, () => {}, ...thisArgument)',
39+
'Array.fromAsync(iterableOrArrayLike, ...() => {}, thisArgument)',
40+
'Array.fromAsync(...iterableOrArrayLike, () => {}, thisArgument)',
41+
'Array.fromAsync(iterableOrArrayLike, () => {}, thisArgument, extraArgument)',
3142

3243
// Ignored
3344
'lodash.every(array, () => {})',
@@ -52,8 +63,11 @@ test.snapshot({
5263
'array.map(1, thisArgument)',
5364
'async () => array.map(await callback, thisArgument)',
5465
'Array.from(iterableOrArrayLike, new Callback, thisArgument)',
66+
'Array.fromAsync(iterableOrArrayLike, new Callback, thisArgument)',
5567
'Array.from(iterableOrArrayLike, 1, thisArgument)',
68+
'Array.fromAsync(iterableOrArrayLike, 1, thisArgument)',
5669
'Array.from(iterableOrArrayLike, await callback, thisArgument)',
70+
'Array.fromAsync(iterableOrArrayLike, await callback, thisArgument)',
5771
],
5872
invalid: [
5973
'array.every(() => {}, thisArgument)',
@@ -66,13 +80,16 @@ test.snapshot({
6680
'array.forEach(() => {}, thisArgument)',
6781
'array.map(() => {}, thisArgument)',
6882
'Array.from(iterableOrArrayLike, () => {}, thisArgument)',
83+
'Array.fromAsync(iterableOrArrayLike, () => {}, thisArgument)',
6984
// Comma
7085
'array.map(() => {}, thisArgument,)',
7186
'array.map(() => {}, (0, thisArgument),)',
7287
'Array.from(iterableOrArrayLike, () => {}, thisArgument,)',
88+
'Array.fromAsync(iterableOrArrayLike, () => {}, thisArgument,)',
7389
// Side effect
7490
'array.map(() => {}, thisArgumentHasSideEffect())',
7591
'Array.from(iterableOrArrayLike, () => {}, thisArgumentHasSideEffect())',
92+
'Array.fromAsync(iterableOrArrayLike, () => {}, thisArgumentHasSideEffect())',
7693
],
7794
});
7895

@@ -82,12 +99,15 @@ test.snapshot({
8299
invalid: [
83100
'array.map(callback, thisArgument)',
84101
'Array.from(iterableOrArrayLike, callback, thisArgument)',
102+
'Array.fromAsync(iterableOrArrayLike, callback, thisArgument)',
85103
'array.map(callback, (0, thisArgument))',
86104
'Array.from(iterableOrArrayLike, callback, (0, thisArgument))',
105+
'Array.fromAsync(iterableOrArrayLike, callback, (0, thisArgument))',
87106
'array.map(function () {}, thisArgument)',
88107
'Array.from(iterableOrArrayLike, function () {}, thisArgument)',
89108
'array.map(function callback () {}, thisArgument)',
90109
'Array.from(iterableOrArrayLike, function callback () {}, thisArgument)',
110+
'Array.fromAsync(iterableOrArrayLike, function callback () {}, thisArgument)',
91111
{
92112
code: 'array.map( foo as bar, (( thisArgument )),)',
93113
languageOptions: {parser: parsers.typescript},
@@ -96,6 +116,10 @@ test.snapshot({
96116
code: 'Array.from(iterableOrArrayLike, foo as bar, (( thisArgument )),)',
97117
languageOptions: {parser: parsers.typescript},
98118
},
119+
{
120+
code: 'Array.fromAsync(iterableOrArrayLike, foo as bar, (( thisArgument )),)',
121+
languageOptions: {parser: parsers.typescript},
122+
},
99123
{
100124
code: 'array.map( (( foo as bar )), (( thisArgument )),)',
101125
languageOptions: {parser: parsers.typescript},
@@ -104,13 +128,20 @@ test.snapshot({
104128
code: 'Array.from(iterableOrArrayLike, (( foo as bar )), (( thisArgument )),)',
105129
languageOptions: {parser: parsers.typescript},
106130
},
131+
{
132+
code: 'Array.fromAsync(iterableOrArrayLike, (( foo as bar )), (( thisArgument )),)',
133+
languageOptions: {parser: parsers.typescript},
134+
},
107135
'array.map( (( 0, callback )), (( thisArgument )),)',
108136
'Array.from(iterableOrArrayLike, (( 0, callback )), (( thisArgument )),)',
137+
'Array.fromAsync(iterableOrArrayLike, (( 0, callback )), (( thisArgument )),)',
109138
// This callback is actually arrow function, but we don't know
110139
'array.map((0, () => {}), thisArgument)',
111140
'Array.from(iterableOrArrayLike, (0, () => {}), thisArgument)',
141+
'Array.fromAsync(iterableOrArrayLike, (0, () => {}), thisArgument)',
112142
// This callback is a bound function, but we don't know
113143
'array.map(callback.bind(foo), thisArgument)',
114144
'Array.from(iterableOrArrayLike, callback.bind(foo), thisArgument)',
145+
'Array.fromAsync(iterableOrArrayLike, callback.bind(foo), thisArgument)',
115146
],
116147
});

‎test/snapshots/no-array-method-this-argument.mjs.md

+266-21
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,28 @@ Generated by [AVA](https://avajs.dev).
214214
| ^^^^^^^^^^^^ Do not use the \`this\` argument in \`Array.from()\`.␊
215215
`
216216

217-
## invalid(11): array.map(() => {}, thisArgument,)
217+
## invalid(11): Array.fromAsync(iterableOrArrayLike, () => {}, thisArgument)
218+
219+
> Input
220+
221+
`␊
222+
1 | Array.fromAsync(iterableOrArrayLike, () => {}, thisArgument)␊
223+
`
224+
225+
> Output
226+
227+
`␊
228+
1 | Array.fromAsync(iterableOrArrayLike, () => {})␊
229+
`
230+
231+
> Error 1/1
232+
233+
`␊
234+
> 1 | Array.fromAsync(iterableOrArrayLike, () => {}, thisArgument)␊
235+
| ^^^^^^^^^^^^ Do not use the \`this\` argument in \`Array.fromAsync()\`.␊
236+
`
237+
238+
## invalid(12): array.map(() => {}, thisArgument,)
218239

219240
> Input
220241
@@ -235,7 +256,7 @@ Generated by [AVA](https://avajs.dev).
235256
| ^^^^^^^^^^^^ Do not use the \`this\` argument in \`Array#map()\`.␊
236257
`
237258

238-
## invalid(12): array.map(() => {}, (0, thisArgument),)
259+
## invalid(13): array.map(() => {}, (0, thisArgument),)
239260

240261
> Input
241262
@@ -256,7 +277,7 @@ Generated by [AVA](https://avajs.dev).
256277
| ^^^^^^^^^^^^^^^ Do not use the \`this\` argument in \`Array#map()\`.␊
257278
`
258279

259-
## invalid(13): Array.from(iterableOrArrayLike, () => {}, thisArgument,)
280+
## invalid(14): Array.from(iterableOrArrayLike, () => {}, thisArgument,)
260281

261282
> Input
262283
@@ -277,7 +298,28 @@ Generated by [AVA](https://avajs.dev).
277298
| ^^^^^^^^^^^^ Do not use the \`this\` argument in \`Array.from()\`.␊
278299
`
279300

280-
## invalid(14): array.map(() => {}, thisArgumentHasSideEffect())
301+
## invalid(15): Array.fromAsync(iterableOrArrayLike, () => {}, thisArgument,)
302+
303+
> Input
304+
305+
`␊
306+
1 | Array.fromAsync(iterableOrArrayLike, () => {}, thisArgument,)␊
307+
`
308+
309+
> Output
310+
311+
`␊
312+
1 | Array.fromAsync(iterableOrArrayLike, () => {},)␊
313+
`
314+
315+
> Error 1/1
316+
317+
`␊
318+
> 1 | Array.fromAsync(iterableOrArrayLike, () => {}, thisArgument,)␊
319+
| ^^^^^^^^^^^^ Do not use the \`this\` argument in \`Array.fromAsync()\`.␊
320+
`
321+
322+
## invalid(16): array.map(() => {}, thisArgumentHasSideEffect())
281323

282324
> Input
283325
@@ -296,7 +338,7 @@ Generated by [AVA](https://avajs.dev).
296338
1 | array.map(() => {})␊
297339
`
298340

299-
## invalid(15): Array.from(iterableOrArrayLike, () => {}, thisArgumentHasSideEffect())
341+
## invalid(17): Array.from(iterableOrArrayLike, () => {}, thisArgumentHasSideEffect())
300342

301343
> Input
302344
@@ -315,6 +357,25 @@ Generated by [AVA](https://avajs.dev).
315357
1 | Array.from(iterableOrArrayLike, () => {})␊
316358
`
317359

360+
## invalid(18): Array.fromAsync(iterableOrArrayLike, () => {}, thisArgumentHasSideEffect())
361+
362+
> Input
363+
364+
`␊
365+
1 | Array.fromAsync(iterableOrArrayLike, () => {}, thisArgumentHasSideEffect())␊
366+
`
367+
368+
> Error 1/1
369+
370+
`␊
371+
> 1 | Array.fromAsync(iterableOrArrayLike, () => {}, thisArgumentHasSideEffect())␊
372+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ Do not use the \`this\` argument in \`Array.fromAsync()\`.␊
373+
374+
--------------------------------------------------------------------------------␊
375+
Suggestion 1/1: Remove this argument.␊
376+
1 | Array.fromAsync(iterableOrArrayLike, () => {})␊
377+
`
378+
318379
## invalid(1): array.map(callback, thisArgument)
319380

320381
> Input
@@ -361,7 +422,30 @@ Generated by [AVA](https://avajs.dev).
361422
1 | Array.from(iterableOrArrayLike, callback.bind(thisArgument))␊
362423
`
363424

364-
## invalid(3): array.map(callback, (0, thisArgument))
425+
## invalid(3): Array.fromAsync(iterableOrArrayLike, callback, thisArgument)
426+
427+
> Input
428+
429+
`␊
430+
1 | Array.fromAsync(iterableOrArrayLike, callback, thisArgument)␊
431+
`
432+
433+
> Error 1/1
434+
435+
`␊
436+
> 1 | Array.fromAsync(iterableOrArrayLike, callback, thisArgument)␊
437+
| ^^^^^^^^^^^^ Do not use the \`this\` argument in \`Array.fromAsync()\`.␊
438+
439+
--------------------------------------------------------------------------------␊
440+
Suggestion 1/2: Remove this argument.␊
441+
1 | Array.fromAsync(iterableOrArrayLike, callback)␊
442+
443+
--------------------------------------------------------------------------------␊
444+
Suggestion 2/2: Use a bound function.␊
445+
1 | Array.fromAsync(iterableOrArrayLike, callback.bind(thisArgument))␊
446+
`
447+
448+
## invalid(4): array.map(callback, (0, thisArgument))
365449

366450
> Input
367451
@@ -384,7 +468,7 @@ Generated by [AVA](https://avajs.dev).
384468
1 | array.map(callback.bind((0, thisArgument)))␊
385469
`
386470

387-
## invalid(4): Array.from(iterableOrArrayLike, callback, (0, thisArgument))
471+
## invalid(5): Array.from(iterableOrArrayLike, callback, (0, thisArgument))
388472

389473
> Input
390474
@@ -407,7 +491,30 @@ Generated by [AVA](https://avajs.dev).
407491
1 | Array.from(iterableOrArrayLike, callback.bind((0, thisArgument)))␊
408492
`
409493

410-
## invalid(5): array.map(function () {}, thisArgument)
494+
## invalid(6): Array.fromAsync(iterableOrArrayLike, callback, (0, thisArgument))
495+
496+
> Input
497+
498+
`␊
499+
1 | Array.fromAsync(iterableOrArrayLike, callback, (0, thisArgument))␊
500+
`
501+
502+
> Error 1/1
503+
504+
`␊
505+
> 1 | Array.fromAsync(iterableOrArrayLike, callback, (0, thisArgument))␊
506+
| ^^^^^^^^^^^^^^^ Do not use the \`this\` argument in \`Array.fromAsync()\`.␊
507+
508+
--------------------------------------------------------------------------------␊
509+
Suggestion 1/2: Remove this argument.␊
510+
1 | Array.fromAsync(iterableOrArrayLike, callback)␊
511+
512+
--------------------------------------------------------------------------------␊
513+
Suggestion 2/2: Use a bound function.␊
514+
1 | Array.fromAsync(iterableOrArrayLike, callback.bind((0, thisArgument)))␊
515+
`
516+
517+
## invalid(7): array.map(function () {}, thisArgument)
411518

412519
> Input
413520
@@ -430,7 +537,7 @@ Generated by [AVA](https://avajs.dev).
430537
1 | array.map(function () {}.bind(thisArgument))␊
431538
`
432539

433-
## invalid(6): Array.from(iterableOrArrayLike, function () {}, thisArgument)
540+
## invalid(8): Array.from(iterableOrArrayLike, function () {}, thisArgument)
434541

435542
> Input
436543
@@ -453,7 +560,7 @@ Generated by [AVA](https://avajs.dev).
453560
1 | Array.from(iterableOrArrayLike, function () {}.bind(thisArgument))␊
454561
`
455562

456-
## invalid(7): array.map(function callback () {}, thisArgument)
563+
## invalid(9): array.map(function callback () {}, thisArgument)
457564

458565
> Input
459566
@@ -476,7 +583,7 @@ Generated by [AVA](https://avajs.dev).
476583
1 | array.map(function callback () {}.bind(thisArgument))␊
477584
`
478585

479-
## invalid(8): Array.from(iterableOrArrayLike, function callback () {}, thisArgument)
586+
## invalid(10): Array.from(iterableOrArrayLike, function callback () {}, thisArgument)
480587

481588
> Input
482589
@@ -499,7 +606,30 @@ Generated by [AVA](https://avajs.dev).
499606
1 | Array.from(iterableOrArrayLike, function callback () {}.bind(thisArgument))␊
500607
`
501608

502-
## invalid(9): array.map( foo as bar, (( thisArgument )),)
609+
## invalid(11): Array.fromAsync(iterableOrArrayLike, function callback () {}, thisArgument)
610+
611+
> Input
612+
613+
`␊
614+
1 | Array.fromAsync(iterableOrArrayLike, function callback () {}, thisArgument)␊
615+
`
616+
617+
> Error 1/1
618+
619+
`␊
620+
> 1 | Array.fromAsync(iterableOrArrayLike, function callback () {}, thisArgument)␊
621+
| ^^^^^^^^^^^^ Do not use the \`this\` argument in \`Array.fromAsync()\`.␊
622+
623+
--------------------------------------------------------------------------------␊
624+
Suggestion 1/2: Remove this argument.␊
625+
1 | Array.fromAsync(iterableOrArrayLike, function callback () {})␊
626+
627+
--------------------------------------------------------------------------------␊
628+
Suggestion 2/2: Use a bound function.␊
629+
1 | Array.fromAsync(iterableOrArrayLike, function callback () {}.bind(thisArgument))␊
630+
`
631+
632+
## invalid(12): array.map( foo as bar, (( thisArgument )),)
503633

504634
> Input
505635
@@ -522,7 +652,7 @@ Generated by [AVA](https://avajs.dev).
522652
1 | array.map( (foo as bar).bind((( thisArgument ))),)␊
523653
`
524654

525-
## invalid(10): Array.from(iterableOrArrayLike, foo as bar, (( thisArgument )),)
655+
## invalid(13): Array.from(iterableOrArrayLike, foo as bar, (( thisArgument )),)
526656

527657
> Input
528658
@@ -545,7 +675,30 @@ Generated by [AVA](https://avajs.dev).
545675
1 | Array.from(iterableOrArrayLike, (foo as bar).bind((( thisArgument ))),)␊
546676
`
547677

548-
## invalid(11): array.map( (( foo as bar )), (( thisArgument )),)
678+
## invalid(14): Array.fromAsync(iterableOrArrayLike, foo as bar, (( thisArgument )),)
679+
680+
> Input
681+
682+
`␊
683+
1 | Array.fromAsync(iterableOrArrayLike, foo as bar, (( thisArgument )),)␊
684+
`
685+
686+
> Error 1/1
687+
688+
`␊
689+
> 1 | Array.fromAsync(iterableOrArrayLike, foo as bar, (( thisArgument )),)␊
690+
| ^^^^^^^^^^^^ Do not use the \`this\` argument in \`Array.fromAsync()\`.␊
691+
692+
--------------------------------------------------------------------------------␊
693+
Suggestion 1/2: Remove this argument.␊
694+
1 | Array.fromAsync(iterableOrArrayLike, foo as bar,)␊
695+
696+
--------------------------------------------------------------------------------␊
697+
Suggestion 2/2: Use a bound function.␊
698+
1 | Array.fromAsync(iterableOrArrayLike, (foo as bar).bind((( thisArgument ))),)␊
699+
`
700+
701+
## invalid(15): array.map( (( foo as bar )), (( thisArgument )),)
549702

550703
> Input
551704
@@ -568,7 +721,7 @@ Generated by [AVA](https://avajs.dev).
568721
1 | array.map( (( foo as bar )).bind((( thisArgument ))),)␊
569722
`
570723

571-
## invalid(12): Array.from(iterableOrArrayLike, (( foo as bar )), (( thisArgument )),)
724+
## invalid(16): Array.from(iterableOrArrayLike, (( foo as bar )), (( thisArgument )),)
572725

573726
> Input
574727
@@ -591,7 +744,30 @@ Generated by [AVA](https://avajs.dev).
591744
1 | Array.from(iterableOrArrayLike, (( foo as bar )).bind((( thisArgument ))),)␊
592745
`
593746

594-
## invalid(13): array.map( (( 0, callback )), (( thisArgument )),)
747+
## invalid(17): Array.fromAsync(iterableOrArrayLike, (( foo as bar )), (( thisArgument )),)
748+
749+
> Input
750+
751+
`␊
752+
1 | Array.fromAsync(iterableOrArrayLike, (( foo as bar )), (( thisArgument )),)␊
753+
`
754+
755+
> Error 1/1
756+
757+
`␊
758+
> 1 | Array.fromAsync(iterableOrArrayLike, (( foo as bar )), (( thisArgument )),)␊
759+
| ^^^^^^^^^^^^ Do not use the \`this\` argument in \`Array.fromAsync()\`.␊
760+
761+
--------------------------------------------------------------------------------␊
762+
Suggestion 1/2: Remove this argument.␊
763+
1 | Array.fromAsync(iterableOrArrayLike, (( foo as bar )),)␊
764+
765+
--------------------------------------------------------------------------------␊
766+
Suggestion 2/2: Use a bound function.␊
767+
1 | Array.fromAsync(iterableOrArrayLike, (( foo as bar )).bind((( thisArgument ))),)␊
768+
`
769+
770+
## invalid(18): array.map( (( 0, callback )), (( thisArgument )),)
595771

596772
> Input
597773
@@ -614,7 +790,7 @@ Generated by [AVA](https://avajs.dev).
614790
1 | array.map( (( 0, callback )).bind((( thisArgument ))),)␊
615791
`
616792

617-
## invalid(14): Array.from(iterableOrArrayLike, (( 0, callback )), (( thisArgument )),)
793+
## invalid(19): Array.from(iterableOrArrayLike, (( 0, callback )), (( thisArgument )),)
618794

619795
> Input
620796
@@ -637,7 +813,30 @@ Generated by [AVA](https://avajs.dev).
637813
1 | Array.from(iterableOrArrayLike, (( 0, callback )).bind((( thisArgument ))),)␊
638814
`
639815

640-
## invalid(15): array.map((0, () => {}), thisArgument)
816+
## invalid(20): Array.fromAsync(iterableOrArrayLike, (( 0, callback )), (( thisArgument )),)
817+
818+
> Input
819+
820+
`␊
821+
1 | Array.fromAsync(iterableOrArrayLike, (( 0, callback )), (( thisArgument )),)␊
822+
`
823+
824+
> Error 1/1
825+
826+
`␊
827+
> 1 | Array.fromAsync(iterableOrArrayLike, (( 0, callback )), (( thisArgument )),)␊
828+
| ^^^^^^^^^^^^ Do not use the \`this\` argument in \`Array.fromAsync()\`.␊
829+
830+
--------------------------------------------------------------------------------␊
831+
Suggestion 1/2: Remove this argument.␊
832+
1 | Array.fromAsync(iterableOrArrayLike, (( 0, callback )),)␊
833+
834+
--------------------------------------------------------------------------------␊
835+
Suggestion 2/2: Use a bound function.␊
836+
1 | Array.fromAsync(iterableOrArrayLike, (( 0, callback )).bind((( thisArgument ))),)␊
837+
`
838+
839+
## invalid(21): array.map((0, () => {}), thisArgument)
641840

642841
> Input
643842
@@ -660,7 +859,7 @@ Generated by [AVA](https://avajs.dev).
660859
1 | array.map((0, () => {}).bind(thisArgument))␊
661860
`
662861

663-
## invalid(16): Array.from(iterableOrArrayLike, (0, () => {}), thisArgument)
862+
## invalid(22): Array.from(iterableOrArrayLike, (0, () => {}), thisArgument)
664863

665864
> Input
666865
@@ -683,7 +882,30 @@ Generated by [AVA](https://avajs.dev).
683882
1 | Array.from(iterableOrArrayLike, (0, () => {}).bind(thisArgument))␊
684883
`
685884

686-
## invalid(17): array.map(callback.bind(foo), thisArgument)
885+
## invalid(23): Array.fromAsync(iterableOrArrayLike, (0, () => {}), thisArgument)
886+
887+
> Input
888+
889+
`␊
890+
1 | Array.fromAsync(iterableOrArrayLike, (0, () => {}), thisArgument)␊
891+
`
892+
893+
> Error 1/1
894+
895+
`␊
896+
> 1 | Array.fromAsync(iterableOrArrayLike, (0, () => {}), thisArgument)␊
897+
| ^^^^^^^^^^^^ Do not use the \`this\` argument in \`Array.fromAsync()\`.␊
898+
899+
--------------------------------------------------------------------------------␊
900+
Suggestion 1/2: Remove this argument.␊
901+
1 | Array.fromAsync(iterableOrArrayLike, (0, () => {}))␊
902+
903+
--------------------------------------------------------------------------------␊
904+
Suggestion 2/2: Use a bound function.␊
905+
1 | Array.fromAsync(iterableOrArrayLike, (0, () => {}).bind(thisArgument))␊
906+
`
907+
908+
## invalid(24): array.map(callback.bind(foo), thisArgument)
687909

688910
> Input
689911
@@ -706,7 +928,7 @@ Generated by [AVA](https://avajs.dev).
706928
1 | array.map(callback.bind(foo).bind(thisArgument))␊
707929
`
708930

709-
## invalid(18): Array.from(iterableOrArrayLike, callback.bind(foo), thisArgument)
931+
## invalid(25): Array.from(iterableOrArrayLike, callback.bind(foo), thisArgument)
710932

711933
> Input
712934
@@ -728,3 +950,26 @@ Generated by [AVA](https://avajs.dev).
728950
Suggestion 2/2: Use a bound function.␊
729951
1 | Array.from(iterableOrArrayLike, callback.bind(foo).bind(thisArgument))␊
730952
`
953+
954+
## invalid(26): Array.fromAsync(iterableOrArrayLike, callback.bind(foo), thisArgument)
955+
956+
> Input
957+
958+
`␊
959+
1 | Array.fromAsync(iterableOrArrayLike, callback.bind(foo), thisArgument)␊
960+
`
961+
962+
> Error 1/1
963+
964+
`␊
965+
> 1 | Array.fromAsync(iterableOrArrayLike, callback.bind(foo), thisArgument)␊
966+
| ^^^^^^^^^^^^ Do not use the \`this\` argument in \`Array.fromAsync()\`.␊
967+
968+
--------------------------------------------------------------------------------␊
969+
Suggestion 1/2: Remove this argument.␊
970+
1 | Array.fromAsync(iterableOrArrayLike, callback.bind(foo))␊
971+
972+
--------------------------------------------------------------------------------␊
973+
Suggestion 2/2: Use a bound function.␊
974+
1 | Array.fromAsync(iterableOrArrayLike, callback.bind(foo).bind(thisArgument))␊
975+
`
Binary file not shown.

0 commit comments

Comments
 (0)
Please sign in to comment.