Skip to content

Latest commit

 

History

History
4984 lines (3827 loc) · 103 KB

no-array-for-each.mjs.md

File metadata and controls

4984 lines (3827 loc) · 103 KB

Snapshot report for test/no-array-for-each.mjs

The actual snapshot is saved in no-array-for-each.mjs.snap.

Generated by AVA.

Invalid #1

  1 | foo.forEach?.(element => bar(element))

Error 1/1

`␊
> 1 | foo.forEach?.(element => bar(element))␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #2

  1 | ((  foo.forEach(element => bar(element))  ))

Output

`␊
  1 |   for (const element of foo) bar(element)  ␊
`

Error 1/1

`␊
> 1 | ((  foo.forEach(element => bar(element))  ))␊
    |         ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #3

  1 | ((  foo?.forEach(element => bar(element))  ))

Output

`␊
  1 |   if (foo) for (const element of foo) bar(element)  ␊
`

Error 1/1

`␊
> 1 | ((  foo?.forEach(element => bar(element))  ))␊
    |          ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #4

  1 | foo.forEach(element => bar(element), thisArgument)

Error 1/1

`␊
> 1 | foo.forEach(element => bar(element), thisArgument)␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #5

  1 | foo?.forEach(element => bar(element), thisArgument)

Error 1/1

`␊
> 1 | foo?.forEach(element => bar(element), thisArgument)␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #6

  1 | foo.forEach()

Error 1/1

`␊
> 1 | foo.forEach()␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #7

  1 | foo?.forEach()

Error 1/1

`␊
> 1 | foo?.forEach()␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #8

  1 | const baz = foo.forEach(element => bar(element))

Error 1/1

`␊
> 1 | const baz = foo.forEach(element => bar(element))␊
    |                 ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #9

  1 | const baz = foo?.forEach(element => bar(element))

Error 1/1

`␊
> 1 | const baz = foo?.forEach(element => bar(element))␊
    |                  ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #10

  1 | foo.forEach(bar)

Error 1/1

`␊
> 1 | foo.forEach(bar)␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #11

  1 | foo?.forEach(bar)

Error 1/1

`␊
> 1 | foo?.forEach(bar)␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #12

  1 | foo.forEach(async function(element) {})

Error 1/1

`␊
> 1 | foo.forEach(async function(element) {})␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #13

  1 | foo?.forEach(async function(element) {})

Error 1/1

`␊
> 1 | foo?.forEach(async function(element) {})␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #14

  1 | foo.forEach(function * (element) {})

Error 1/1

`␊
> 1 | foo.forEach(function * (element) {})␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #15

  1 | foo?.forEach(function * (element) {})

Error 1/1

`␊
> 1 | foo?.forEach(function * (element) {})␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #16

  1 | foo.forEach(() => bar())

Error 1/1

`␊
> 1 | foo.forEach(() => bar())␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #17

  1 | foo?.forEach(() => bar())

Error 1/1

`␊
> 1 | foo?.forEach(() => bar())␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #18

  1 | foo.forEach((element, index, array) => bar())

Error 1/1

`␊
> 1 | foo.forEach((element, index, array) => bar())␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #19

  1 | foo?.forEach((element, index, array) => bar())

Error 1/1

`␊
> 1 | foo?.forEach((element, index, array) => bar())␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #20

  1 | property.forEach(({property}) => bar(property))

Error 1/1

`␊
> 1 | property.forEach(({property}) => bar(property))␊
    |          ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #21

  1 | property?.forEach(({property}) => bar(property))

Error 1/1

`␊
> 1 | property?.forEach(({property}) => bar(property))␊
    |           ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #22

  1 | () => foo.forEach()

Error 1/1

`␊
> 1 | () => foo.forEach()␊
    |           ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #23

  1 | () => foo?.forEach()

Error 1/1

`␊
> 1 | () => foo?.forEach()␊
    |            ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #24

  1 | foo.forEach((element = {}) => call(element))

Error 1/1

`␊
> 1 | foo.forEach((element = {}) => call(element))␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #25

  1 | foo?.forEach((element = {}) => call(element))

Error 1/1

`␊
> 1 | foo?.forEach((element = {}) => call(element))␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #26

  1 | foo.forEach(element => {
  2 | 	do {
  3 | 		return
  4 | 	} while (element)
  5 | });

Error 1/1

`␊
> 1 | foo.forEach(element => {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	do {␊
  3 | 		return␊
  4 | 	} while (element)␊
  5 | });␊
`

Invalid #27

  1 | foo?.forEach(element => {
  2 | 	do {
  3 | 		return
  4 | 	} while (element)
  5 | });

Error 1/1

`␊
> 1 | foo?.forEach(element => {␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	do {␊
  3 | 		return␊
  4 | 	} while (element)␊
  5 | });␊
`

Invalid #28

  1 | foo.forEach(element => {
  2 | 	while (element) {
  3 | 		return;
  4 | 	}
  5 | });

Error 1/1

`␊
> 1 | foo.forEach(element => {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	while (element) {␊
  3 | 		return;␊
  4 | 	}␊
  5 | });␊
`

Invalid #29

  1 | foo?.forEach(element => {
  2 | 	while (element) {
  3 | 		return;
  4 | 	}
  5 | });

Error 1/1

`␊
> 1 | foo?.forEach(element => {␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	while (element) {␊
  3 | 		return;␊
  4 | 	}␊
  5 | });␊
`

Invalid #30

  1 | foo.forEach(element => {
  2 | 	for (let i = 0; i < 2; i++) {
  3 | 		return;
  4 | 	}
  5 | });

Error 1/1

`␊
> 1 | foo.forEach(element => {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	for (let i = 0; i < 2; i++) {␊
  3 | 		return;␊
  4 | 	}␊
  5 | });␊
`

Invalid #31

  1 | foo?.forEach(element => {
  2 | 	for (let i = 0; i < 2; i++) {
  3 | 		return;
  4 | 	}
  5 | });

Error 1/1

`␊
> 1 | foo?.forEach(element => {␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	for (let i = 0; i < 2; i++) {␊
  3 | 		return;␊
  4 | 	}␊
  5 | });␊
`

Invalid #32

  1 | foo.forEach(element => {
  2 | 	for (let i in element) {
  3 | 		return;
  4 | 	}
  5 | });

Error 1/1

`␊
> 1 | foo.forEach(element => {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	for (let i in element) {␊
  3 | 		return;␊
  4 | 	}␊
  5 | });␊
`

Invalid #33

  1 | foo?.forEach(element => {
  2 | 	for (let i in element) {
  3 | 		return;
  4 | 	}
  5 | });

Error 1/1

`␊
> 1 | foo?.forEach(element => {␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	for (let i in element) {␊
  3 | 		return;␊
  4 | 	}␊
  5 | });␊
`

Invalid #34

  1 | foo.forEach(element => {
  2 | 	for (let i of element) {
  3 | 		return;
  4 | 	}
  5 | });

Error 1/1

`␊
> 1 | foo.forEach(element => {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	for (let i of element) {␊
  3 | 		return;␊
  4 | 	}␊
  5 | });␊
`

Invalid #35

  1 | foo?.forEach(element => {
  2 | 	for (let i of element) {
  3 | 		return;
  4 | 	}
  5 | });

Error 1/1

`␊
> 1 | foo?.forEach(element => {␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	for (let i of element) {␊
  3 | 		return;␊
  4 | 	}␊
  5 | });␊
`

Invalid #36

  1 | foo.forEach(element => {
  2 | 	switch (element) {
  3 | 		case 1:
  4 | 			break;
  5 | 		case 2:
  6 | 			return;
  7 | 	}
  8 | });

Output

`␊
  1 | for (const element of foo) {␊
  2 | 	switch (element) {␊
  3 | 		case 1:␊
  4 | 			break;␊
  5 | 		case 2:␊
  6 | 			continue;␊
  7 | 	}␊
  8 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach(element => {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	switch (element) {␊
  3 | 		case 1:␊
  4 | 			break;␊
  5 | 		case 2:␊
  6 | 			return;␊
  7 | 	}␊
  8 | });␊
`

Invalid #37

  1 | foo?.forEach(element => {
  2 | 	switch (element) {
  3 | 		case 1:
  4 | 			break;
  5 | 		case 2:
  6 | 			return;
  7 | 	}
  8 | });

Output

`␊
  1 | if (foo) for (const element of foo) {␊
  2 | 	switch (element) {␊
  3 | 		case 1:␊
  4 | 			break;␊
  5 | 		case 2:␊
  6 | 			continue;␊
  7 | 	}␊
  8 | }␊
`

Error 1/1

`␊
> 1 | foo?.forEach(element => {␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	switch (element) {␊
  3 | 		case 1:␊
  4 | 			break;␊
  5 | 		case 2:␊
  6 | 			return;␊
  7 | 	}␊
  8 | });␊
`

Invalid #38

  1 | foo.forEach(foo => bar());

Error 1/1

`␊
> 1 | foo.forEach(foo => bar());␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #39

  1 | foo?.forEach(foo => bar());

Error 1/1

`␊
> 1 | foo?.forEach(foo => bar());␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #40

  1 | const foo = [];
  2 | foo.forEach(foo => bar());

Error 1/1

`␊
  1 | const foo = [];␊
> 2 | foo.forEach(foo => bar());␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #41

  1 | const foo = [];
  2 | foo?.forEach(foo => bar());

Error 1/1

`␊
  1 | const foo = [];␊
> 2 | foo?.forEach(foo => bar());␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #42

  1 | const foo = [];
  2 | function unicorn() {
  3 | 	foo.forEach(foo => bar());
  4 | }

Error 1/1

`␊
  1 | const foo = [];␊
  2 | function unicorn() {␊
> 3 | 	foo.forEach(foo => bar());␊
    | 	    ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  4 | }␊
`

Invalid #43

  1 | const foo = [];
  2 | function unicorn() {
  3 | 	foo?.forEach(foo => bar());
  4 | }

Error 1/1

`␊
  1 | const foo = [];␊
  2 | function unicorn() {␊
> 3 | 	foo?.forEach(foo => bar());␊
    | 	     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  4 | }␊
`

Invalid #44

  1 | index.forEach((a, index) => bar());

Error 1/1

`␊
> 1 | index.forEach((a, index) => bar());␊
    |       ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #45

  1 | index?.forEach((a, index) => bar());

Error 1/1

`␊
> 1 | index?.forEach((a, index) => bar());␊
    |        ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #46

  1 | const index = [];
  2 | index.forEach((a, index) => bar());

Error 1/1

`␊
  1 | const index = [];␊
> 2 | index.forEach((a, index) => bar());␊
    |       ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #47

  1 | const index = [];
  2 | index?.forEach((a, index) => bar());

Error 1/1

`␊
  1 | const index = [];␊
> 2 | index?.forEach((a, index) => bar());␊
    |        ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #48

  1 | const index = [];
  2 | function unicorn() {
  3 | 	index.forEach((a, index) => bar());
  4 | }

Error 1/1

`␊
  1 | const index = [];␊
  2 | function unicorn() {␊
> 3 | 	index.forEach((a, index) => bar());␊
    | 	      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  4 | }␊
`

Invalid #49

  1 | const index = [];
  2 | function unicorn() {
  3 | 	index?.forEach((a, index) => bar());
  4 | }

Error 1/1

`␊
  1 | const index = [];␊
  2 | function unicorn() {␊
> 3 | 	index?.forEach((a, index) => bar());␊
    | 	       ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  4 | }␊
`

Invalid #50

  1 | a[foo].forEach(foo => bar());

Error 1/1

`␊
> 1 | a[foo].forEach(foo => bar());␊
    |        ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #51

  1 | a[foo]?.forEach(foo => bar());

Error 1/1

`␊
> 1 | a[foo]?.forEach(foo => bar());␊
    |         ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #52

  1 | const foo = 1;
  2 | a[foo].forEach(foo => bar());

Error 1/1

`␊
  1 | const foo = 1;␊
> 2 | a[foo].forEach(foo => bar());␊
    |        ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #53

  1 | const foo = 1;
  2 | a[foo]?.forEach(foo => bar());

Error 1/1

`␊
  1 | const foo = 1;␊
> 2 | a[foo]?.forEach(foo => bar());␊
    |         ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #54

  1 | const foo = 1;
  2 | function unicorn() {
  3 | 	a[foo].forEach(foo => bar());
  4 | }

Error 1/1

`␊
  1 | const foo = 1;␊
  2 | function unicorn() {␊
> 3 | 	a[foo].forEach(foo => bar());␊
    | 	       ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  4 | }␊
`

Invalid #55

  1 | const foo = 1;
  2 | function unicorn() {
  3 | 	a[foo]?.forEach(foo => bar());
  4 | }

Error 1/1

`␊
  1 | const foo = 1;␊
  2 | function unicorn() {␊
> 3 | 	a[foo]?.forEach(foo => bar());␊
    | 	        ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  4 | }␊
`

Invalid #56

  1 | a[index].forEach((b, index) => bar());

Error 1/1

`␊
> 1 | a[index].forEach((b, index) => bar());␊
    |          ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #57

  1 | a[index]?.forEach((b, index) => bar());

Error 1/1

`␊
> 1 | a[index]?.forEach((b, index) => bar());␊
    |           ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #58

  1 | a((foo) => foo).forEach(foo => bar());

Output

`␊
  1 | for (const foo of a((foo) => foo)) bar();␊
`

Error 1/1

`␊
> 1 | a((foo) => foo).forEach(foo => bar());␊
    |                 ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #59

  1 | a((foo) => foo)?.forEach(foo => bar());

Error 1/1

`␊
> 1 | a((foo) => foo)?.forEach(foo => bar());␊
    |                  ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊

--------------------------------------------------------------------------------␊
Suggestion 1/1: Switch to \`for…of\`.␊
  1 | if (a((foo) => foo)) for (const foo of a((foo) => foo)) bar();␊
`

Invalid #60

  1 | a((foo, index) => foo + index).forEach((foo, index) => bar());

Output

`␊
  1 | for (const [index, foo] of a((foo, index) => foo + index).entries()) bar();␊
`

Error 1/1

`␊
> 1 | a((foo, index) => foo + index).forEach((foo, index) => bar());␊
    |                                ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #61

  1 | a((foo, index) => foo + index)?.forEach((foo, index) => bar());

Error 1/1

`␊
> 1 | a((foo, index) => foo + index)?.forEach((foo, index) => bar());␊
    |                                 ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊

--------------------------------------------------------------------------------␊
Suggestion 1/1: Switch to \`for…of\`.␊
  1 | if (a((foo, index) => foo + index)) for (const [index, foo] of a((foo, index) => foo + index).entries()) bar();␊
`

Invalid #62

  1 | const foo = [];
  2 | const index = 1;
  3 | a.forEach((foo, index) => foo[index]);

Output

`␊
  1 | const foo = [];␊
  2 | const index = 1;␊
  3 | for (const [index, foo] of a.entries()) foo[index];␊
`

Error 1/1

`␊
  1 | const foo = [];␊
  2 | const index = 1;␊
> 3 | a.forEach((foo, index) => foo[index]);␊
    |   ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #63

  1 | const foo = [];
  2 | const index = 1;
  3 | a?.forEach((foo, index) => foo[index]);

Output

`␊
  1 | const foo = [];␊
  2 | const index = 1;␊
  3 | if (a) for (const [index, foo] of a.entries()) foo[index];␊
`

Error 1/1

`␊
  1 | const foo = [];␊
  2 | const index = 1;␊
> 3 | a?.forEach((foo, index) => foo[index]);␊
    |    ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #64

  1 | foo.forEach(function a(element) {
  2 | 	bar(a)
  3 | })

Error 1/1

`␊
> 1 | foo.forEach(function a(element) {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	bar(a)␊
  3 | })␊
`

Invalid #65

  1 | foo?.forEach(function a(element) {
  2 | 	bar(a)
  3 | })

Error 1/1

`␊
> 1 | foo?.forEach(function a(element) {␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	bar(a)␊
  3 | })␊
`

Invalid #66

  1 | foo.forEach(function a(element) {
  2 | 	function b() {
  3 | 		bar(a)
  4 | 	}
  5 | })

Error 1/1

`␊
> 1 | foo.forEach(function a(element) {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	function b() {␊
  3 | 		bar(a)␊
  4 | 	}␊
  5 | })␊
`

Invalid #67

  1 | foo?.forEach(function a(element) {
  2 | 	function b() {
  3 | 		bar(a)
  4 | 	}
  5 | })

Error 1/1

`␊
> 1 | foo?.forEach(function a(element) {␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	function b() {␊
  3 | 		bar(a)␊
  4 | 	}␊
  5 | })␊
`

Invalid #68

  1 | foo.forEach(function a(element) {
  2 | 	function b(a) {
  3 | 		bar(a)
  4 | 	}
  5 | })

Output

`␊
  1 | for (const element of foo) {␊
  2 | 	function b(a) {␊
  3 | 		bar(a)␊
  4 | 	}␊
  5 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach(function a(element) {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	function b(a) {␊
  3 | 		bar(a)␊
  4 | 	}␊
  5 | })␊
`

Invalid #69

  1 | foo?.forEach(function a(element) {
  2 | 	function b(a) {
  3 | 		bar(a)
  4 | 	}
  5 | })

Output

`␊
  1 | if (foo) for (const element of foo) {␊
  2 | 	function b(a) {␊
  3 | 		bar(a)␊
  4 | 	}␊
  5 | }␊
`

Error 1/1

`␊
> 1 | foo?.forEach(function a(element) {␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	function b(a) {␊
  3 | 		bar(a)␊
  4 | 	}␊
  5 | })␊
`

Invalid #70

  1 | foo.forEach(function(element) {
  2 | 	bar(this)
  3 | })

Error 1/1

`␊
> 1 | foo.forEach(function(element) {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	bar(this)␊
  3 | })␊
`

Invalid #71

  1 | foo?.forEach(function(element) {
  2 | 	bar(this)
  3 | })

Error 1/1

`␊
> 1 | foo?.forEach(function(element) {␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	bar(this)␊
  3 | })␊
`

Invalid #72

  1 | foo.forEach(function(element) {
  2 | 	function b() {
  3 | 		bar(this)
  4 | 	}
  5 | })

Output

`␊
  1 | for (const element of foo) {␊
  2 | 	function b() {␊
  3 | 		bar(this)␊
  4 | 	}␊
  5 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach(function(element) {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	function b() {␊
  3 | 		bar(this)␊
  4 | 	}␊
  5 | })␊
`

Invalid #73

  1 | foo?.forEach(function(element) {
  2 | 	function b() {
  3 | 		bar(this)
  4 | 	}
  5 | })

Output

`␊
  1 | if (foo) for (const element of foo) {␊
  2 | 	function b() {␊
  3 | 		bar(this)␊
  4 | 	}␊
  5 | }␊
`

Error 1/1

`␊
> 1 | foo?.forEach(function(element) {␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	function b() {␊
  3 | 		bar(this)␊
  4 | 	}␊
  5 | })␊
`

Invalid #74

  1 | foo.forEach(function(element) {
  2 | 	const x = b => {
  3 | 		bar(this)
  4 | 	}
  5 | })

Output

`␊
  1 | for (const element of foo) {␊
  2 | 	const x = b => {␊
  3 | 		bar(this)␊
  4 | 	}␊
  5 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach(function(element) {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	const x = b => {␊
  3 | 		bar(this)␊
  4 | 	}␊
  5 | })␊
`

Invalid #75

  1 | foo?.forEach(function(element) {
  2 | 	const x = b => {
  3 | 		bar(this)
  4 | 	}
  5 | })

Output

`␊
  1 | if (foo) for (const element of foo) {␊
  2 | 	const x = b => {␊
  3 | 		bar(this)␊
  4 | 	}␊
  5 | }␊
`

Error 1/1

`␊
> 1 | foo?.forEach(function(element) {␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	const x = b => {␊
  3 | 		bar(this)␊
  4 | 	}␊
  5 | })␊
`

Invalid #76

  1 | foo.forEach((element) => {
  2 | 	bar(this)
  3 | })

Output

`␊
  1 | for (const element of foo) {␊
  2 | 	bar(this)␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach((element) => {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	bar(this)␊
  3 | })␊
`

Invalid #77

  1 | foo?.forEach((element) => {
  2 | 	bar(this)
  3 | })

Output

`␊
  1 | if (foo) for (const element of foo) {␊
  2 | 	bar(this)␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo?.forEach((element) => {␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	bar(this)␊
  3 | })␊
`

Invalid #78

  1 | foo.forEach(function(element) {
  2 | 	bar(arguments)
  3 | })

Error 1/1

`␊
> 1 | foo.forEach(function(element) {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	bar(arguments)␊
  3 | })␊
`

Invalid #79

  1 | foo?.forEach(function(element) {
  2 | 	bar(arguments)
  3 | })

Error 1/1

`␊
> 1 | foo?.forEach(function(element) {␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	bar(arguments)␊
  3 | })␊
`

Invalid #80

  1 | foo.forEach(function(element) {
  2 | 	function b() {
  3 | 		bar(arguments)
  4 | 	}
  5 | })

Output

`␊
  1 | for (const element of foo) {␊
  2 | 	function b() {␊
  3 | 		bar(arguments)␊
  4 | 	}␊
  5 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach(function(element) {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	function b() {␊
  3 | 		bar(arguments)␊
  4 | 	}␊
  5 | })␊
`

Invalid #81

  1 | foo?.forEach(function(element) {
  2 | 	function b() {
  3 | 		bar(arguments)
  4 | 	}
  5 | })

Output

`␊
  1 | if (foo) for (const element of foo) {␊
  2 | 	function b() {␊
  3 | 		bar(arguments)␊
  4 | 	}␊
  5 | }␊
`

Error 1/1

`␊
> 1 | foo?.forEach(function(element) {␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	function b() {␊
  3 | 		bar(arguments)␊
  4 | 	}␊
  5 | })␊
`

Invalid #82

  1 | foo.forEach(function(element) {
  2 | 	const b = () => {
  3 | 		bar(arguments)
  4 | 	}
  5 | })

Output

`␊
  1 | for (const element of foo) {␊
  2 | 	const b = () => {␊
  3 | 		bar(arguments)␊
  4 | 	}␊
  5 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach(function(element) {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	const b = () => {␊
  3 | 		bar(arguments)␊
  4 | 	}␊
  5 | })␊
`

Invalid #83

  1 | foo?.forEach(function(element) {
  2 | 	const b = () => {
  3 | 		bar(arguments)
  4 | 	}
  5 | })

Output

`␊
  1 | if (foo) for (const element of foo) {␊
  2 | 	const b = () => {␊
  3 | 		bar(arguments)␊
  4 | 	}␊
  5 | }␊
`

Error 1/1

`␊
> 1 | foo?.forEach(function(element) {␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	const b = () => {␊
  3 | 		bar(arguments)␊
  4 | 	}␊
  5 | })␊
`

Invalid #84

  1 | foo.forEach((element) => {
  2 | 	bar(arguments)
  3 | })

Output

`␊
  1 | for (const element of foo) {␊
  2 | 	bar(arguments)␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach((element) => {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	bar(arguments)␊
  3 | })␊
`

Invalid #85

  1 | foo?.forEach((element) => {
  2 | 	bar(arguments)
  3 | })

Output

`␊
  1 | if (foo) for (const element of foo) {␊
  2 | 	bar(arguments)␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo?.forEach((element) => {␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	bar(arguments)␊
  3 | })␊
`

Invalid #86

  1 | a = foo?.bar.forEach((element) => bar(element));

Error 1/1

`␊
> 1 | a = foo?.bar.forEach((element) => bar(element));␊
    |              ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #87

  1 | a = foo?.bar?.forEach((element) => bar(element));

Error 1/1

`␊
> 1 | a = foo?.bar?.forEach((element) => bar(element));␊
    |               ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #88

  1 | foo.forEach(function (element) {
  2 | 	bar(element);
  3 | });

Output

`␊
  1 | for (const element of foo) {␊
  2 | 	bar(element);␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach(function (element) {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	bar(element);␊
  3 | });␊
`

Invalid #89

  1 | foo?.forEach(function (element) {
  2 | 	bar(element);
  3 | });

Output

`␊
  1 | if (foo) for (const element of foo) {␊
  2 | 	bar(element);␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo?.forEach(function (element) {␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	bar(element);␊
  3 | });␊
`

Invalid #90

  1 | foo.forEach(function withName(element) {
  2 | 	bar(element);
  3 | });

Output

`␊
  1 | for (const element of foo) {␊
  2 | 	bar(element);␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach(function withName(element) {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	bar(element);␊
  3 | });␊
`

Invalid #91

  1 | foo?.forEach(function withName(element) {
  2 | 	bar(element);
  3 | });

Output

`␊
  1 | if (foo) for (const element of foo) {␊
  2 | 	bar(element);␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo?.forEach(function withName(element) {␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	bar(element);␊
  3 | });␊
`

Invalid #92

  1 | foo.forEach((element) => {
  2 | 	bar(element);
  3 | });

Output

`␊
  1 | for (const element of foo) {␊
  2 | 	bar(element);␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach((element) => {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	bar(element);␊
  3 | });␊
`

Invalid #93

  1 | foo?.forEach((element) => {
  2 | 	bar(element);
  3 | });

Output

`␊
  1 | if (foo) for (const element of foo) {␊
  2 | 	bar(element);␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo?.forEach((element) => {␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	bar(element);␊
  3 | });␊
`

Invalid #94

  1 | foo.forEach((element) => bar(element));

Output

`␊
  1 | for (const element of foo) bar(element);␊
`

Error 1/1

`␊
> 1 | foo.forEach((element) => bar(element));␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #95

  1 | foo?.forEach((element) => bar(element));

Output

`␊
  1 | if (foo) for (const element of foo) bar(element);␊
`

Error 1/1

`␊
> 1 | foo?.forEach((element) => bar(element));␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #96

  1 | foo.forEach(function (element, index) {
  2 | 	bar(element, index);
  3 | });

Output

`␊
  1 | for (const [index, element] of foo.entries()) {␊
  2 | 	bar(element, index);␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach(function (element, index) {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	bar(element, index);␊
  3 | });␊
`

Invalid #97

  1 | foo?.forEach(function (element, index) {
  2 | 	bar(element, index);
  3 | });

Output

`␊
  1 | if (foo) for (const [index, element] of foo.entries()) {␊
  2 | 	bar(element, index);␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo?.forEach(function (element, index) {␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	bar(element, index);␊
  3 | });␊
`

Invalid #98

  1 | foo.forEach(function withName(element, index) {
  2 | 	bar(element, index);
  3 | });

Output

`␊
  1 | for (const [index, element] of foo.entries()) {␊
  2 | 	bar(element, index);␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach(function withName(element, index) {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	bar(element, index);␊
  3 | });␊
`

Invalid #99

  1 | foo?.forEach(function withName(element, index) {
  2 | 	bar(element, index);
  3 | });

Output

`␊
  1 | if (foo) for (const [index, element] of foo.entries()) {␊
  2 | 	bar(element, index);␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo?.forEach(function withName(element, index) {␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	bar(element, index);␊
  3 | });␊
`

Invalid #100

  1 | foo.forEach((element, index) => {
  2 | 	bar(element, index);
  3 | });

Output

`␊
  1 | for (const [index, element] of foo.entries()) {␊
  2 | 	bar(element, index);␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach((element, index) => {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	bar(element, index);␊
  3 | });␊
`

Invalid #101

  1 | foo?.forEach((element, index) => {
  2 | 	bar(element, index);
  3 | });

Output

`␊
  1 | if (foo) for (const [index, element] of foo.entries()) {␊
  2 | 	bar(element, index);␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo?.forEach((element, index) => {␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	bar(element, index);␊
  3 | });␊
`

Invalid #102

  1 | foo.forEach((element, index) => bar(element, index));

Output

`␊
  1 | for (const [index, element] of foo.entries()) bar(element, index);␊
`

Error 1/1

`␊
> 1 | foo.forEach((element, index) => bar(element, index));␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #103

  1 | foo?.forEach((element, index) => bar(element, index));

Output

`␊
  1 | if (foo) for (const [index, element] of foo.entries()) bar(element, index);␊
`

Error 1/1

`␊
> 1 | foo?.forEach((element, index) => bar(element, index));␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #104

  1 | foo?.bar.forEach((element) => bar(element));

Output

`␊
  1 | for (const element of foo?.bar) bar(element);␊
`

Error 1/1

`␊
> 1 | foo?.bar.forEach((element) => bar(element));␊
    |          ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #105

  1 | foo?.bar?.forEach((element) => bar(element));

Output

`␊
  1 | if (foo?.bar) for (const element of foo?.bar) bar(element);␊
`

Error 1/1

`␊
> 1 | foo?.bar?.forEach((element) => bar(element));␊
    |           ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #106

  1 | foo.bar.forEach((element) => log(element))

Output

`␊
  1 | for (const element of foo.bar) log(element)␊
`

Error 1/1

`␊
> 1 | foo.bar.forEach((element) => log(element))␊
    |         ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #107

  1 | foo.bar?.forEach((element) => log(element))

Output

`␊
  1 | if (foo.bar) for (const element of foo.bar) log(element)␊
`

Error 1/1

`␊
> 1 | foo.bar?.forEach((element) => log(element))␊
    |          ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #108

  1 | foo.bar().forEach((element) => log(element))

Output

`␊
  1 | for (const element of foo.bar()) log(element)␊
`

Error 1/1

`␊
> 1 | foo.bar().forEach((element) => log(element))␊
    |           ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #109

  1 | foo.bar()?.forEach((element) => log(element))

Error 1/1

`␊
> 1 | foo.bar()?.forEach((element) => log(element))␊
    |            ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊

--------------------------------------------------------------------------------␊
Suggestion 1/1: Switch to \`for…of\`.␊
  1 | if (foo.bar()) for (const element of foo.bar()) log(element)␊
`

Invalid #110

  1 | (a ? b : c).forEach((element) => log(element))

Output

`␊
  1 | for (const element of (a ? b : c)) log(element)␊
`

Error 1/1

`␊
> 1 | (a ? b : c).forEach((element) => log(element))␊
    |             ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #111

  1 | (a ? b : c)?.forEach((element) => log(element))

Output

`␊
  1 | if (a ? b : c) for (const element of (a ? b : c)) log(element)␊
`

Error 1/1

`␊
> 1 | (a ? b : c)?.forEach((element) => log(element))␊
    |              ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #112

  1 | (a ? b : c()).forEach((element) => log(element))

Output

`␊
  1 | for (const element of (a ? b : c())) log(element)␊
`

Error 1/1

`␊
> 1 | (a ? b : c()).forEach((element) => log(element))␊
    |               ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #113

  1 | (a ? b : c())?.forEach((element) => log(element))

Error 1/1

`␊
> 1 | (a ? b : c())?.forEach((element) => log(element))␊
    |                ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊

--------------------------------------------------------------------------------␊
Suggestion 1/1: Switch to \`for…of\`.␊
  1 | if (a ? b : c()) for (const element of (a ? b : c())) log(element)␊
`

Invalid #114

  1 | (foo || bar).forEach((element) => log(element))

Output

`␊
  1 | for (const element of (foo || bar)) log(element)␊
`

Error 1/1

`␊
> 1 | (foo || bar).forEach((element) => log(element))␊
    |              ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #115

  1 | (foo || bar)?.forEach((element) => log(element))

Output

`␊
  1 | if (foo || bar) for (const element of (foo || bar)) log(element)␊
`

Error 1/1

`␊
> 1 | (foo || bar)?.forEach((element) => log(element))␊
    |               ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #116

  1 | (foo || bar()).forEach((element) => log(element))

Output

`␊
  1 | for (const element of (foo || bar())) log(element)␊
`

Error 1/1

`␊
> 1 | (foo || bar()).forEach((element) => log(element))␊
    |                ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #117

  1 | (foo || bar())?.forEach((element) => log(element))

Error 1/1

`␊
> 1 | (foo || bar())?.forEach((element) => log(element))␊
    |                 ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊

--------------------------------------------------------------------------------␊
Suggestion 1/1: Switch to \`for…of\`.␊
  1 | if (foo || bar()) for (const element of (foo || bar())) log(element)␊
`

Invalid #118

  1 | (foo).forEach((element, index) => bar(element, index))

Output

`␊
  1 | for (const [index, element] of (foo).entries()) bar(element, index)␊
`

Error 1/1

`␊
> 1 | (foo).forEach((element, index) => bar(element, index))␊
    |       ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #119

  1 | (foo)?.forEach((element, index) => bar(element, index))

Output

`␊
  1 | if (foo) for (const [index, element] of (foo).entries()) bar(element, index)␊
`

Error 1/1

`␊
> 1 | (foo)?.forEach((element, index) => bar(element, index))␊
    |        ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #120

  1 | (0, foo).forEach((element, index) => bar(element, index))

Output

`␊
  1 | for (const [index, element] of (0, foo).entries()) bar(element, index)␊
`

Error 1/1

`␊
> 1 | (0, foo).forEach((element, index) => bar(element, index))␊
    |          ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #121

  1 | (0, foo)?.forEach((element, index) => bar(element, index))

Output

`␊
  1 | if (0, foo) for (const [index, element] of (0, foo).entries()) bar(element, index)␊
`

Error 1/1

`␊
> 1 | (0, foo)?.forEach((element, index) => bar(element, index))␊
    |           ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #122

  1 | foo.forEach(function (element) {
  2 | 	bar(element);
  3 | },);

Output

`␊
  1 | for (const element of foo) {␊
  2 | 	bar(element);␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach(function (element) {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	bar(element);␊
  3 | },);␊
`

Invalid #123

  1 | foo?.forEach(function (element) {
  2 | 	bar(element);
  3 | },);

Output

`␊
  1 | if (foo) for (const element of foo) {␊
  2 | 	bar(element);␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo?.forEach(function (element) {␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	bar(element);␊
  3 | },);␊
`

Invalid #124

  1 | foo.forEach(function withName(element) {
  2 | 	bar(element);
  3 | },);

Output

`␊
  1 | for (const element of foo) {␊
  2 | 	bar(element);␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach(function withName(element) {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	bar(element);␊
  3 | },);␊
`

Invalid #125

  1 | foo?.forEach(function withName(element) {
  2 | 	bar(element);
  3 | },);

Output

`␊
  1 | if (foo) for (const element of foo) {␊
  2 | 	bar(element);␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo?.forEach(function withName(element) {␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	bar(element);␊
  3 | },);␊
`

Invalid #126

  1 | foo.forEach((element) => {
  2 | 	bar(element);
  3 | },);

Output

`␊
  1 | for (const element of foo) {␊
  2 | 	bar(element);␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach((element) => {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	bar(element);␊
  3 | },);␊
`

Invalid #127

  1 | foo?.forEach((element) => {
  2 | 	bar(element);
  3 | },);

Output

`␊
  1 | if (foo) for (const element of foo) {␊
  2 | 	bar(element);␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo?.forEach((element) => {␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	bar(element);␊
  3 | },);␊
`

Invalid #128

  1 | foo.forEach((element) => bar(element),);

Output

`␊
  1 | for (const element of foo) bar(element);␊
`

Error 1/1

`␊
> 1 | foo.forEach((element) => bar(element),);␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #129

  1 | foo?.forEach((element) => bar(element),);

Output

`␊
  1 | if (foo) for (const element of foo) bar(element);␊
`

Error 1/1

`␊
> 1 | foo?.forEach((element) => bar(element),);␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #130

  1 | foo.forEach((element) => bar(element))
  2 | ;[foo].pop();

Output

`␊
  1 | for (const element of foo) bar(element)␊
  2 | ;[foo].pop();␊
`

Error 1/1

`␊
> 1 | foo.forEach((element) => bar(element))␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | ;[foo].pop();␊
`

Invalid #131

  1 | foo?.forEach((element) => bar(element))
  2 | ;[foo].pop();

Output

`␊
  1 | if (foo) for (const element of foo) bar(element)␊
  2 | ;[foo].pop();␊
`

Error 1/1

`␊
> 1 | foo?.forEach((element) => bar(element))␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | ;[foo].pop();␊
`

Invalid #132

  1 | foo.forEach((element) => {
  2 | 	bar(element);
  3 | });
  4 | function noneRelatedFunction() {
  5 | 	while (element) {
  6 | 		return;
  7 | 	}
  8 | }

Output

`␊
  1 | for (const element of foo) {␊
  2 | 	bar(element);␊
  3 | }␊
  4 | function noneRelatedFunction() {␊
  5 | 	while (element) {␊
  6 | 		return;␊
  7 | 	}␊
  8 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach((element) => {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	bar(element);␊
  3 | });␊
  4 | function noneRelatedFunction() {␊
  5 | 	while (element) {␊
  6 | 		return;␊
  7 | 	}␊
  8 | }␊
`

Invalid #133

  1 | foo?.forEach((element) => {
  2 | 	bar(element);
  3 | });
  4 | function noneRelatedFunction() {
  5 | 	while (element) {
  6 | 		return;
  7 | 	}
  8 | }

Output

`␊
  1 | if (foo) for (const element of foo) {␊
  2 | 	bar(element);␊
  3 | }␊
  4 | function noneRelatedFunction() {␊
  5 | 	while (element) {␊
  6 | 		return;␊
  7 | 	}␊
  8 | }␊
`

Error 1/1

`␊
> 1 | foo?.forEach((element) => {␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	bar(element);␊
  3 | });␊
  4 | function noneRelatedFunction() {␊
  5 | 	while (element) {␊
  6 | 		return;␊
  7 | 	}␊
  8 | }␊
`

Invalid #134

  1 | foo.forEach(element => ({}))

Output

`␊
  1 | for (const element of foo) ({})␊
`

Error 1/1

`␊
> 1 | foo.forEach(element => ({}))␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #135

  1 | foo?.forEach(element => ({}))

Output

`␊
  1 | if (foo) for (const element of foo) ({})␊
`

Error 1/1

`␊
> 1 | foo?.forEach(element => ({}))␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #136

  1 | foo.forEach((((((element => bar(element)))))));

Output

`␊
  1 | for (const element of foo) bar(element);␊
`

Error 1/1

`␊
> 1 | foo.forEach((((((element => bar(element)))))));␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #137

  1 | foo?.forEach((((((element => bar(element)))))));

Output

`␊
  1 | if (foo) for (const element of foo) bar(element);␊
`

Error 1/1

`␊
> 1 | foo?.forEach((((((element => bar(element)))))));␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #138

   1 | foo.forEach((element) => {
   2 | 	if (1) {
   3 | 		return;
   4 | 	}
   5 | 	if (1) {
   6 | 		return
   7 | 	}
   8 | 	if (1) {
   9 | 		return!true;
  10 | 	}
  11 | 	if (1) {
  12 | 		return!true
  13 | 	}
  14 | 	if (1) {
  15 | 		return bar();
  16 | 	}
  17 | 	if (1) {
  18 | 		return bar()
  19 | 		unreachable();
  20 | 	}
  21 | 	if (1) {
  22 | 		return {};
  23 | 	}
  24 | 	if (1) {
  25 | 		return ({});
  26 | 	}
  27 | 	if (1) {
  28 | 		return {a} = a;
  29 | 	}
  30 | 	if (1) {
  31 | 		return [a] = a;
  32 | 	}
  33 | 	if (1) {
  34 | 		foo
  35 | 		return []
  36 | 	}
  37 | 	if (1) {
  38 | 		foo
  39 | 		return [foo] = bar;
  40 | 	}
  41 | });

Output

`␊
   1 | for (const element of foo) {␊
   2 | 	if (1) {␊
   3 | 		continue;␊
   4 | 	}␊
   5 | 	if (1) {␊
   6 | 		continue␊
   7 | 	}␊
   8 | 	if (1) {␊
   9 | 		!true; continue;␊
  10 | 	}␊
  11 | 	if (1) {␊
  12 | 		!true; continue;␊
  13 | 	}␊
  14 | 	if (1) {␊
  15 | 		 bar(); continue;␊
  16 | 	}␊
  17 | 	if (1) {␊
  18 | 		 bar(); continue;␊
  19 | 		unreachable();␊
  20 | 	}␊
  21 | 	if (1) {␊
  22 | 		 ({}); continue;␊
  23 | 	}␊
  24 | 	if (1) {␊
  25 | 		 ({}); continue;␊
  26 | 	}␊
  27 | 	if (1) {␊
  28 | 		 ({a} = a); continue;␊
  29 | 	}␊
  30 | 	if (1) {␊
  31 | 		 ([a] = a); continue;␊
  32 | 	}␊
  33 | 	if (1) {␊
  34 | 		foo␊
  35 | 		 ;[]; continue;␊
  36 | 	}␊
  37 | 	if (1) {␊
  38 | 		foo␊
  39 | 		 ;([foo] = bar); continue;␊
  40 | 	}␊
  41 | }␊
`

Error 1/1

`␊
>  1 | foo.forEach((element) => {␊
     |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
   2 | 	if (1) {␊
   3 | 		return;␊
   4 | 	}␊
   5 | 	if (1) {␊
   6 | 		return␊
   7 | 	}␊
   8 | 	if (1) {␊
   9 | 		return!true;␊
  10 | 	}␊
  11 | 	if (1) {␊
  12 | 		return!true␊
  13 | 	}␊
  14 | 	if (1) {␊
  15 | 		return bar();␊
  16 | 	}␊
  17 | 	if (1) {␊
  18 | 		return bar()␊
  19 | 		unreachable();␊
  20 | 	}␊
  21 | 	if (1) {␊
  22 | 		return {};␊
  23 | 	}␊
  24 | 	if (1) {␊
  25 | 		return ({});␊
  26 | 	}␊
  27 | 	if (1) {␊
  28 | 		return {a} = a;␊
  29 | 	}␊
  30 | 	if (1) {␊
  31 | 		return [a] = a;␊
  32 | 	}␊
  33 | 	if (1) {␊
  34 | 		foo␊
  35 | 		return []␊
  36 | 	}␊
  37 | 	if (1) {␊
  38 | 		foo␊
  39 | 		return [foo] = bar;␊
  40 | 	}␊
  41 | });␊
`

Invalid #139

   1 | foo?.forEach((element) => {
   2 | 	if (1) {
   3 | 		return;
   4 | 	}
   5 | 	if (1) {
   6 | 		return
   7 | 	}
   8 | 	if (1) {
   9 | 		return!true;
  10 | 	}
  11 | 	if (1) {
  12 | 		return!true
  13 | 	}
  14 | 	if (1) {
  15 | 		return bar();
  16 | 	}
  17 | 	if (1) {
  18 | 		return bar()
  19 | 		unreachable();
  20 | 	}
  21 | 	if (1) {
  22 | 		return {};
  23 | 	}
  24 | 	if (1) {
  25 | 		return ({});
  26 | 	}
  27 | 	if (1) {
  28 | 		return {a} = a;
  29 | 	}
  30 | 	if (1) {
  31 | 		return [a] = a;
  32 | 	}
  33 | 	if (1) {
  34 | 		foo
  35 | 		return []
  36 | 	}
  37 | 	if (1) {
  38 | 		foo
  39 | 		return [foo] = bar;
  40 | 	}
  41 | });

Output

`␊
   1 | if (foo) for (const element of foo) {␊
   2 | 	if (1) {␊
   3 | 		continue;␊
   4 | 	}␊
   5 | 	if (1) {␊
   6 | 		continue␊
   7 | 	}␊
   8 | 	if (1) {␊
   9 | 		!true; continue;␊
  10 | 	}␊
  11 | 	if (1) {␊
  12 | 		!true; continue;␊
  13 | 	}␊
  14 | 	if (1) {␊
  15 | 		 bar(); continue;␊
  16 | 	}␊
  17 | 	if (1) {␊
  18 | 		 bar(); continue;␊
  19 | 		unreachable();␊
  20 | 	}␊
  21 | 	if (1) {␊
  22 | 		 ({}); continue;␊
  23 | 	}␊
  24 | 	if (1) {␊
  25 | 		 ({}); continue;␊
  26 | 	}␊
  27 | 	if (1) {␊
  28 | 		 ({a} = a); continue;␊
  29 | 	}␊
  30 | 	if (1) {␊
  31 | 		 ([a] = a); continue;␊
  32 | 	}␊
  33 | 	if (1) {␊
  34 | 		foo␊
  35 | 		 ;[]; continue;␊
  36 | 	}␊
  37 | 	if (1) {␊
  38 | 		foo␊
  39 | 		 ;([foo] = bar); continue;␊
  40 | 	}␊
  41 | }␊
`

Error 1/1

`␊
>  1 | foo?.forEach((element) => {␊
     |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
   2 | 	if (1) {␊
   3 | 		return;␊
   4 | 	}␊
   5 | 	if (1) {␊
   6 | 		return␊
   7 | 	}␊
   8 | 	if (1) {␊
   9 | 		return!true;␊
  10 | 	}␊
  11 | 	if (1) {␊
  12 | 		return!true␊
  13 | 	}␊
  14 | 	if (1) {␊
  15 | 		return bar();␊
  16 | 	}␊
  17 | 	if (1) {␊
  18 | 		return bar()␊
  19 | 		unreachable();␊
  20 | 	}␊
  21 | 	if (1) {␊
  22 | 		return {};␊
  23 | 	}␊
  24 | 	if (1) {␊
  25 | 		return ({});␊
  26 | 	}␊
  27 | 	if (1) {␊
  28 | 		return {a} = a;␊
  29 | 	}␊
  30 | 	if (1) {␊
  31 | 		return [a] = a;␊
  32 | 	}␊
  33 | 	if (1) {␊
  34 | 		foo␊
  35 | 		return []␊
  36 | 	}␊
  37 | 	if (1) {␊
  38 | 		foo␊
  39 | 		return [foo] = bar;␊
  40 | 	}␊
  41 | });␊
`

Invalid #140

  1 | node.children.index.forEach((children, index) => process(children, index))

Output

`␊
  1 | for (const [index, children] of node.children.index.entries()) process(children, index)␊
`

Error 1/1

`␊
> 1 | node.children.index.forEach((children, index) => process(children, index))␊
    |                     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #141

  1 | node.children.index?.forEach((children, index) => process(children, index))

Output

`␊
  1 | if (node.children.index) for (const [index, children] of node.children.index.entries()) process(children, index)␊
`

Error 1/1

`␊
> 1 | node.children.index?.forEach((children, index) => process(children, index))␊
    |                      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #142

  1 | (node?.children?.index).forEach((children, index) => process(children, index))

Output

`␊
  1 | for (const [index, children] of (node?.children?.index).entries()) process(children, index)␊
`

Error 1/1

`␊
> 1 | (node?.children?.index).forEach((children, index) => process(children, index))␊
    |                         ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #143

  1 | (node?.children?.index)?.forEach((children, index) => process(children, index))

Output

`␊
  1 | if (node?.children?.index) for (const [index, children] of (node?.children?.index).entries()) process(children, index)␊
`

Error 1/1

`␊
> 1 | (node?.children?.index)?.forEach((children, index) => process(children, index))␊
    |                          ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #144

  1 | node[children].index.forEach((children, index) => process(children, index))

Error 1/1

`␊
> 1 | node[children].index.forEach((children, index) => process(children, index))␊
    |                      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #145

  1 | node[children].index?.forEach((children, index) => process(children, index))

Error 1/1

`␊
> 1 | node[children].index?.forEach((children, index) => process(children, index))␊
    |                       ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #146

  1 | (node.children?.[index]).forEach((children, index) => process(children, index))

Error 1/1

`␊
> 1 | (node.children?.[index]).forEach((children, index) => process(children, index))␊
    |                          ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #147

  1 | (node.children?.[index])?.forEach((children, index) => process(children, index))

Error 1/1

`␊
> 1 | (node.children?.[index])?.forEach((children, index) => process(children, index))␊
    |                           ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #148

  1 | [{children: 1, index: 1}].forEach((children, index) => process(children, index))

Output

`␊
  1 | for (const [index, children] of [{children: 1, index: 1}].entries()) process(children, index)␊
`

Error 1/1

`␊
> 1 | [{children: 1, index: 1}].forEach((children, index) => process(children, index))␊
    |                           ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #149

  1 | [{children: 1, index: 1}]?.forEach((children, index) => process(children, index))

Output

`␊
  1 | if ([{children: 1, index: 1}]) for (const [index, children] of [{children: 1, index: 1}].entries()) process(children, index)␊
`

Error 1/1

`␊
> 1 | [{children: 1, index: 1}]?.forEach((children, index) => process(children, index))␊
    |                            ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #150

  1 | [{[children]: 1, index: 1}].forEach((children, index) => process(children, index))

Error 1/1

`␊
> 1 | [{[children]: 1, index: 1}].forEach((children, index) => process(children, index))␊
    |                             ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #151

  1 | [{[children]: 1, index: 1}]?.forEach((children, index) => process(children, index))

Error 1/1

`␊
> 1 | [{[children]: 1, index: 1}]?.forEach((children, index) => process(children, index))␊
    |                              ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #152

  1 | [{[children]: 1, [index]: 1}].forEach((children, index) => process(children, index))

Error 1/1

`␊
> 1 | [{[children]: 1, [index]: 1}].forEach((children, index) => process(children, index))␊
    |                               ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #153

  1 | [{[children]: 1, [index]: 1}]?.forEach((children, index) => process(children, index))

Error 1/1

`␊
> 1 | [{[children]: 1, [index]: 1}]?.forEach((children, index) => process(children, index))␊
    |                                ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #154

  1 | [{children, index: 1}].forEach((children, index) => process(children, index))

Error 1/1

`␊
> 1 | [{children, index: 1}].forEach((children, index) => process(children, index))␊
    |                        ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #155

  1 | [{children, index: 1}]?.forEach((children, index) => process(children, index))

Error 1/1

`␊
> 1 | [{children, index: 1}]?.forEach((children, index) => process(children, index))␊
    |                         ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #156

  1 | [{children: 1, index}].forEach((children, index) => process(children, index))

Error 1/1

`␊
> 1 | [{children: 1, index}].forEach((children, index) => process(children, index))␊
    |                        ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #157

  1 | [{children: 1, index}]?.forEach((children, index) => process(children, index))

Error 1/1

`␊
> 1 | [{children: 1, index}]?.forEach((children, index) => process(children, index))␊
    |                         ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #158

  1 | [function name() {}].forEach((name, index) => process(name, index))

Output

`␊
  1 | for (const [index, name] of [function name() {}].entries()) process(name, index)␊
`

Error 1/1

`␊
> 1 | [function name() {}].forEach((name, index) => process(name, index))␊
    |                      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #159

  1 | [function name() {}]?.forEach((name, index) => process(name, index))

Output

`␊
  1 | if ([function name() {}]) for (const [index, name] of [function name() {}].entries()) process(name, index)␊
`

Error 1/1

`␊
> 1 | [function name() {}]?.forEach((name, index) => process(name, index))␊
    |                       ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #160

  1 | [
  2 | 	function () {
  3 | 		function index() {}
  4 | 	}
  5 | ].forEach((name, index) => process(name, index))

Output

`␊
  1 | for (const [index, name] of [␊
  2 | 	function () {␊
  3 | 		function index() {}␊
  4 | 	}␊
  5 | ].entries()) process(name, index)␊
`

Error 1/1

`␊
  1 | [␊
  2 | 	function () {␊
  3 | 		function index() {}␊
  4 | 	}␊
> 5 | ].forEach((name, index) => process(name, index))␊
    |   ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #161

  1 | [
  2 | 	function () {
  3 | 		function index() {}
  4 | 	}
  5 | ]?.forEach((name, index) => process(name, index))

Output

`␊
  1 | if ([␊
  2 | 	function () {␊
  3 | 		function index() {}␊
  4 | 	}␊
  5 | ]) for (const [index, name] of [␊
  6 | 	function () {␊
  7 | 		function index() {}␊
  8 | 	}␊
  9 | ].entries()) process(name, index)␊
`

Error 1/1

`␊
  1 | [␊
  2 | 	function () {␊
  3 | 		function index() {}␊
  4 | 	}␊
> 5 | ]?.forEach((name, index) => process(name, index))␊
    |    ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #162

  1 | [
  2 | 	function () {
  3 | 		class index {}
  4 | 	}
  5 | ].forEach((name, index) => process(name, index))

Output

`␊
  1 | for (const [index, name] of [␊
  2 | 	function () {␊
  3 | 		class index {}␊
  4 | 	}␊
  5 | ].entries()) process(name, index)␊
`

Error 1/1

`␊
  1 | [␊
  2 | 	function () {␊
  3 | 		class index {}␊
  4 | 	}␊
> 5 | ].forEach((name, index) => process(name, index))␊
    |   ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #163

  1 | [
  2 | 	function () {
  3 | 		class index {}
  4 | 	}
  5 | ]?.forEach((name, index) => process(name, index))

Output

`␊
  1 | if ([␊
  2 | 	function () {␊
  3 | 		class index {}␊
  4 | 	}␊
  5 | ]) for (const [index, name] of [␊
  6 | 	function () {␊
  7 | 		class index {}␊
  8 | 	}␊
  9 | ].entries()) process(name, index)␊
`

Error 1/1

`␊
  1 | [␊
  2 | 	function () {␊
  3 | 		class index {}␊
  4 | 	}␊
> 5 | ]?.forEach((name, index) => process(name, index))␊
    |    ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #164

  1 | [class Foo{}].forEach((Foo, index) => process(Foo, index))

Output

`␊
  1 | for (const [index, Foo] of [class Foo{}].entries()) process(Foo, index)␊
`

Error 1/1

`␊
> 1 | [class Foo{}].forEach((Foo, index) => process(Foo, index))␊
    |               ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #165

  1 | [class Foo{}]?.forEach((Foo, index) => process(Foo, index))

Output

`␊
  1 | if ([class Foo{}]) for (const [index, Foo] of [class Foo{}].entries()) process(Foo, index)␊
`

Error 1/1

`␊
> 1 | [class Foo{}]?.forEach((Foo, index) => process(Foo, index))␊
    |                ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #166

  1 | [class Foo{}].forEach((X, Foo) => process(X, Foo))

Output

`␊
  1 | for (const [Foo, X] of [class Foo{}].entries()) process(X, Foo)␊
`

Error 1/1

`␊
> 1 | [class Foo{}].forEach((X, Foo) => process(X, Foo))␊
    |               ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #167

  1 | [class Foo{}]?.forEach((X, Foo) => process(X, Foo))

Output

`␊
  1 | if ([class Foo{}]) for (const [Foo, X] of [class Foo{}].entries()) process(X, Foo)␊
`

Error 1/1

`␊
> 1 | [class Foo{}]?.forEach((X, Foo) => process(X, Foo))␊
    |                ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #168

  1 | [
  2 | 	class Foo {
  3 | 		bar() {}
  4 | 	}
  5 | ].forEach((Foo, bar) => process(Foo, bar))

Output

`␊
  1 | for (const [bar, Foo] of [␊
  2 | 	class Foo {␊
  3 | 		bar() {}␊
  4 | 	}␊
  5 | ].entries()) process(Foo, bar)␊
`

Error 1/1

`␊
  1 | [␊
  2 | 	class Foo {␊
  3 | 		bar() {}␊
  4 | 	}␊
> 5 | ].forEach((Foo, bar) => process(Foo, bar))␊
    |   ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #169

  1 | [
  2 | 	class Foo {
  3 | 		bar() {}
  4 | 	}
  5 | ]?.forEach((Foo, bar) => process(Foo, bar))

Output

`␊
  1 | if ([␊
  2 | 	class Foo {␊
  3 | 		bar() {}␊
  4 | 	}␊
  5 | ]) for (const [bar, Foo] of [␊
  6 | 	class Foo {␊
  7 | 		bar() {}␊
  8 | 	}␊
  9 | ].entries()) process(Foo, bar)␊
`

Error 1/1

`␊
  1 | [␊
  2 | 	class Foo {␊
  3 | 		bar() {}␊
  4 | 	}␊
> 5 | ]?.forEach((Foo, bar) => process(Foo, bar))␊
    |    ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #170

  1 | foo.React.Children.forEach(bar)

Error 1/1

`␊
> 1 | foo.React.Children.forEach(bar)␊
    |                    ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #171

  1 | foo.React.Children?.forEach(bar)

Error 1/1

`␊
> 1 | foo.React.Children?.forEach(bar)␊
    |                     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #172

  1 | NotReact.Children.forEach(bar)

Error 1/1

`␊
> 1 | NotReact.Children.forEach(bar)␊
    |                   ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #173

  1 | NotReact.Children?.forEach(bar)

Error 1/1

`␊
> 1 | NotReact.Children?.forEach(bar)␊
    |                    ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #174

  1 | React.NotChildren.forEach(bar)

Error 1/1

`␊
> 1 | React.NotChildren.forEach(bar)␊
    |                   ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #175

  1 | React.NotChildren?.forEach(bar)

Error 1/1

`␊
> 1 | React.NotChildren?.forEach(bar)␊
    |                    ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #176

  1 | React?.Children.forEach(bar)

Error 1/1

`␊
> 1 | React?.Children.forEach(bar)␊
    |                 ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #177

  1 | React?.Children?.forEach(bar)

Error 1/1

`␊
> 1 | React?.Children?.forEach(bar)␊
    |                  ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #178

  1 | NotChildren.forEach(bar)

Error 1/1

`␊
> 1 | NotChildren.forEach(bar)␊
    |             ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #179

  1 | NotChildren?.forEach(bar)

Error 1/1

`␊
> 1 | NotChildren?.forEach(bar)␊
    |              ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #180

  1 | foo.forEach(element => {
  2 | 	element ++;
  3 | })

Output

`␊
  1 | for (let element of foo) {␊
  2 | 	element ++;␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach(element => {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	element ++;␊
  3 | })␊
`

Invalid #181

  1 | foo?.forEach(element => {
  2 | 	element ++;
  3 | })

Output

`␊
  1 | if (foo) for (let element of foo) {␊
  2 | 	element ++;␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo?.forEach(element => {␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	element ++;␊
  3 | })␊
`

Invalid #182

  1 | foo.forEach(element => {
  2 | 	const a = -- element;
  3 | })

Output

`␊
  1 | for (let element of foo) {␊
  2 | 	const a = -- element;␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach(element => {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	const a = -- element;␊
  3 | })␊
`

Invalid #183

  1 | foo?.forEach(element => {
  2 | 	const a = -- element;
  3 | })

Output

`␊
  1 | if (foo) for (let element of foo) {␊
  2 | 	const a = -- element;␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo?.forEach(element => {␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	const a = -- element;␊
  3 | })␊
`

Invalid #184

  1 | foo.forEach((element, index) => {
  2 | 	index ++;
  3 | 	element = 2
  4 | });

Output

`␊
  1 | for (let [index, element] of foo.entries()) {␊
  2 | 	index ++;␊
  3 | 	element = 2␊
  4 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach((element, index) => {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	index ++;␊
  3 | 	element = 2␊
  4 | });␊
`

Invalid #185

  1 | foo?.forEach((element, index) => {
  2 | 	index ++;
  3 | 	element = 2
  4 | });

Output

`␊
  1 | if (foo) for (let [index, element] of foo.entries()) {␊
  2 | 	index ++;␊
  3 | 	element = 2␊
  4 | }␊
`

Error 1/1

`␊
> 1 | foo?.forEach((element, index) => {␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	index ++;␊
  3 | 	element = 2␊
  4 | });␊
`

Invalid #186

  1 | foo.forEach((element, index) => {
  2 | 	element >>>= 2;
  3 | });

Output

`␊
  1 | for (let [index, element] of foo.entries()) {␊
  2 | 	element >>>= 2;␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach((element, index) => {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	element >>>= 2;␊
  3 | });␊
`

Invalid #187

  1 | foo?.forEach((element, index) => {
  2 | 	element >>>= 2;
  3 | });

Output

`␊
  1 | if (foo) for (let [index, element] of foo.entries()) {␊
  2 | 	element >>>= 2;␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo?.forEach((element, index) => {␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	element >>>= 2;␊
  3 | });␊
`

Invalid #188

  1 | foo.forEach((element, index) => {
  2 | 	const a = element = 1;
  3 | });

Output

`␊
  1 | for (let [index, element] of foo.entries()) {␊
  2 | 	const a = element = 1;␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach((element, index) => {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	const a = element = 1;␊
  3 | });␊
`

Invalid #189

  1 | foo?.forEach((element, index) => {
  2 | 	const a = element = 1;
  3 | });

Output

`␊
  1 | if (foo) for (let [index, element] of foo.entries()) {␊
  2 | 	const a = element = 1;␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo?.forEach((element, index) => {␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	const a = element = 1;␊
  3 | });␊
`

Invalid #190

  1 | foo.forEach((element, index) => {
  2 | 	let a;
  3 | 	a >>>= element;
  4 | });

Output

`␊
  1 | for (const [index, element] of foo.entries()) {␊
  2 | 	let a;␊
  3 | 	a >>>= element;␊
  4 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach((element, index) => {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	let a;␊
  3 | 	a >>>= element;␊
  4 | });␊
`

Invalid #191

  1 | foo?.forEach((element, index) => {
  2 | 	let a;
  3 | 	a >>>= element;
  4 | });

Output

`␊
  1 | if (foo) for (const [index, element] of foo.entries()) {␊
  2 | 	let a;␊
  3 | 	a >>>= element;␊
  4 | }␊
`

Error 1/1

`␊
> 1 | foo?.forEach((element, index) => {␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	let a;␊
  3 | 	a >>>= element;␊
  4 | });␊
`

Invalid #192

  1 | foo.forEach(({property}) => {bar(property)})

Output

`␊
  1 | for (const {property} of foo) {bar(property)}␊
`

Error 1/1

`␊
> 1 | foo.forEach(({property}) => {bar(property)})␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #193

  1 | foo?.forEach(({property}) => {bar(property)})

Output

`␊
  1 | if (foo) for (const {property} of foo) {bar(property)}␊
`

Error 1/1

`␊
> 1 | foo?.forEach(({property}) => {bar(property)})␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #194

  1 | foo.forEach(({foo: {foo: [property]}}) => {bar(property, index)})

Output

`␊
  1 | for (const {foo: {foo: [property]}} of foo) {bar(property, index)}␊
`

Error 1/1

`␊
> 1 | foo.forEach(({foo: {foo: [property]}}) => {bar(property, index)})␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #195

  1 | foo?.forEach(({foo: {foo: [property]}}) => {bar(property, index)})

Output

`␊
  1 | if (foo) for (const {foo: {foo: [property]}} of foo) {bar(property, index)}␊
`

Error 1/1

`␊
> 1 | foo?.forEach(({foo: {foo: [property]}}) => {bar(property, index)})␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #196

  1 | foo.forEach((element, {bar: {bar: [index]}}) => {bar(element, index)})

Error 1/1

`␊
> 1 | foo.forEach((element, {bar: {bar: [index]}}) => {bar(element, index)})␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #197

  1 | foo?.forEach((element, {bar: {bar: [index]}}) => {bar(element, index)})

Error 1/1

`␊
> 1 | foo?.forEach((element, {bar: {bar: [index]}}) => {bar(element, index)})␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #198

  1 | foo.forEach((element = elementDefaultValue, index = indexDefaultValue) => {})

Error 1/1

`␊
> 1 | foo.forEach((element = elementDefaultValue, index = indexDefaultValue) => {})␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #199

  1 | foo?.forEach((element = elementDefaultValue, index = indexDefaultValue) => {})

Error 1/1

`␊
> 1 | foo?.forEach((element = elementDefaultValue, index = indexDefaultValue) => {})␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #200

  1 | foo.forEach(({}) => {})

Output

`␊
  1 | for (const {} of foo) {}␊
`

Error 1/1

`␊
> 1 | foo.forEach(({}) => {})␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #201

  1 | foo?.forEach(({}) => {})

Output

`␊
  1 | if (foo) for (const {} of foo) {}␊
`

Error 1/1

`␊
> 1 | foo?.forEach(({}) => {})␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #202

  1 | foo.forEach(function foo({a, b, c, d}) {})

Output

`␊
  1 | for (const {a, b, c, d} of foo) {}␊
`

Error 1/1

`␊
> 1 | foo.forEach(function foo({a, b, c, d}) {})␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #203

  1 | foo?.forEach(function foo({a, b, c, d}) {})

Output

`␊
  1 | if (foo) for (const {a, b, c, d} of foo) {}␊
`

Error 1/1

`␊
> 1 | foo?.forEach(function foo({a, b, c, d}) {})␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #204

  1 | foo.forEach(function foo({a, b, c, d, foo}) {})

Error 1/1

`␊
> 1 | foo.forEach(function foo({a, b, c, d, foo}) {})␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #205

  1 | foo?.forEach(function foo({a, b, c, d, foo}) {})

Error 1/1

`␊
> 1 | foo?.forEach(function foo({a, b, c, d, foo}) {})␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #206

  1 | foo.forEach(({foo: property}) => {bar(property)})

Output

`␊
  1 | for (const {foo: property} of foo) {bar(property)}␊
`

Error 1/1

`␊
> 1 | foo.forEach(({foo: property}) => {bar(property)})␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #207

  1 | foo?.forEach(({foo: property}) => {bar(property)})

Output

`␊
  1 | if (foo) for (const {foo: property} of foo) {bar(property)}␊
`

Error 1/1

`␊
> 1 | foo?.forEach(({foo: property}) => {bar(property)})␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #208

  1 | foo.forEach(({[foo]: property}) => {bar(property)})

Output

`␊
  1 | for (const {[foo]: property} of foo) {bar(property)}␊
`

Error 1/1

`␊
> 1 | foo.forEach(({[foo]: property}) => {bar(property)})␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #209

  1 | foo?.forEach(({[foo]: property}) => {bar(property)})

Output

`␊
  1 | if (foo) for (const {[foo]: property} of foo) {bar(property)}␊
`

Error 1/1

`␊
> 1 | foo?.forEach(({[foo]: property}) => {bar(property)})␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #210

  1 | foo.forEach(({element}, index) => {
  2 | 	element &&= 2;
  3 | });

Output

`␊
  1 | for (let [index, {element}] of foo.entries()) {␊
  2 | 	element &&= 2;␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach(({element}, index) => {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	element &&= 2;␊
  3 | });␊
`

Invalid #211

  1 | foo?.forEach(({element}, index) => {
  2 | 	element &&= 2;
  3 | });

Output

`␊
  1 | if (foo) for (let [index, {element}] of foo.entries()) {␊
  2 | 	element &&= 2;␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo?.forEach(({element}, index) => {␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	element &&= 2;␊
  3 | });␊
`

Invalid #212

  1 | foo.forEach(_ => {
  2 | 	if (true) return {};
  3 | })

Output

`␊
  1 | for (const _ of foo) {␊
  2 | 	if (true)  { ({}); continue; }␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach(_ => {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	if (true) return {};␊
  3 | })␊
`

Invalid #213

  1 | foo?.forEach(_ => {
  2 | 	if (true) return {};
  3 | })

Output

`␊
  1 | if (foo) for (const _ of foo) {␊
  2 | 	if (true)  { ({}); continue; }␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo?.forEach(_ => {␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	if (true) return {};␊
  3 | })␊
`

Invalid #214

  1 | foo.forEach(_ => {
  2 | 	if (true);
  3 | 	else return {};
  4 | })

Output

`␊
  1 | for (const _ of foo) {␊
  2 | 	if (true);␊
  3 | 	else  { ({}); continue; }␊
  4 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach(_ => {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	if (true);␊
  3 | 	else return {};␊
  4 | })␊
`

Invalid #215

  1 | foo?.forEach(_ => {
  2 | 	if (true);
  3 | 	else return {};
  4 | })

Output

`␊
  1 | if (foo) for (const _ of foo) {␊
  2 | 	if (true);␊
  3 | 	else  { ({}); continue; }␊
  4 | }␊
`

Error 1/1

`␊
> 1 | foo?.forEach(_ => {␊
    |      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	if (true);␊
  3 | 	else return {};␊
  4 | })␊
`

Invalid #216

  1 | if (true) {} else[foo].forEach((element) => {})

Output

`␊
  1 | if (true) {} else for (const element of [foo]) {}␊
`

Error 1/1

`␊
> 1 | if (true) {} else[foo].forEach((element) => {})␊
    |                        ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #217

  1 | if (true) {} else[foo]?.forEach((element) => {})

Output

`␊
  1 | if (true) {} else if ([foo]) for (const element of [foo]) {}␊
`

Error 1/1

`␊
> 1 | if (true) {} else[foo]?.forEach((element) => {})␊
    |                         ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #218

  1 | const a = () => ((  foo.forEach(element => bar(element))  ))

Output

`␊
  1 | const a = () =>   { for (const element of foo) bar(element) }  ␊
`

Error 1/1

`␊
> 1 | const a = () => ((  foo.forEach(element => bar(element))  ))␊
    |                         ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #219

  1 | const a = () => ((  foo?.forEach(element => bar(element))  ))

Output

`␊
  1 | const a = () =>   { if (foo) for (const element of foo) bar(element) }  ␊
`

Error 1/1

`␊
> 1 | const a = () => ((  foo?.forEach(element => bar(element))  ))␊
    |                          ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #220

  1 | const a = () => ((  foo.forEach(element => bar(element))  ));

Output

`␊
  1 | const a = () =>   { for (const element of foo) bar(element) }  ;␊
`

Error 1/1

`␊
> 1 | const a = () => ((  foo.forEach(element => bar(element))  ));␊
    |                         ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #221

  1 | const a = () => ((  foo?.forEach(element => bar(element))  ));

Output

`␊
  1 | const a = () =>   { if (foo) for (const element of foo) bar(element) }  ;␊
`

Error 1/1

`␊
> 1 | const a = () => ((  foo?.forEach(element => bar(element))  ));␊
    |                          ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #222

  1 | const a = () => foo.forEach(element => bar(element))

Output

`␊
  1 | const a = () => { for (const element of foo) bar(element) }␊
`

Error 1/1

`␊
> 1 | const a = () => foo.forEach(element => bar(element))␊
    |                     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #223

  1 | const a = () => foo?.forEach(element => bar(element))

Output

`␊
  1 | const a = () => { if (foo) for (const element of foo) bar(element) }␊
`

Error 1/1

`␊
> 1 | const a = () => foo?.forEach(element => bar(element))␊
    |                      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #224

  1 | const a = () => foo.forEach(element => bar(element));

Output

`␊
  1 | const a = () => { for (const element of foo) bar(element) };␊
`

Error 1/1

`␊
> 1 | const a = () => foo.forEach(element => bar(element));␊
    |                     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #225

  1 | const a = () => foo?.forEach(element => bar(element));

Output

`␊
  1 | const a = () => { if (foo) for (const element of foo) bar(element) };␊
`

Error 1/1

`␊
> 1 | const a = () => foo?.forEach(element => bar(element));␊
    |                      ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #226

  1 | const a = () => void foo.forEach(element => bar(element));

Error 1/1

`␊
> 1 | const a = () => void foo.forEach(element => bar(element));␊
    |                          ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #227

  1 | const a = () => void foo?.forEach(element => bar(element));

Error 1/1

`␊
> 1 | const a = () => void foo?.forEach(element => bar(element));␊
    |                           ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #228

  1 | 1?.forEach((a, b) => call(a, b))

Output

`␊
  1 | if (1) for (const [b, a] of (1).entries()) call(a, b)␊
`

Error 1/1

`␊
> 1 | 1?.forEach((a, b) => call(a, b))␊
    |    ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #229

  1 | array.forEach((arrayInArray) => arrayInArray.forEach(element => bar(element)));

Output

`␊
  1 | for (const arrayInArray of array) for (const element of arrayInArray) bar(element);␊
`

Error 1/2

`␊
> 1 | array.forEach((arrayInArray) => arrayInArray.forEach(element => bar(element)));␊
    |       ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Error 2/2

`␊
> 1 | array.forEach((arrayInArray) => arrayInArray.forEach(element => bar(element)));␊
    |                                              ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #230

  1 | array.forEach((arrayInArray) => arrayInArray?.forEach(element => bar(element)));

Output

`␊
  1 | for (const arrayInArray of array) if (arrayInArray) for (const element of arrayInArray) bar(element);␊
`

Error 1/2

`␊
> 1 | array.forEach((arrayInArray) => arrayInArray?.forEach(element => bar(element)));␊
    |       ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Error 2/2

`␊
> 1 | array.forEach((arrayInArray) => arrayInArray?.forEach(element => bar(element)));␊
    |                                               ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #231

  1 | foo.forEach(element => {
  2 | 	({element} = bar);
  3 | });

Output

`␊
  1 | for (let element of foo) {␊
  2 | 	({element} = bar);␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach(element => {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	({element} = bar);␊
  3 | });␊
`

Invalid #232

  1 | foo.forEach(element => {
  2 | 	({element: a} = bar);
  3 | });

Output

`␊
  1 | for (const element of foo) {␊
  2 | 	({element: a} = bar);␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach(element => {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	({element: a} = bar);␊
  3 | });␊
`

Invalid #233

  1 | foo.forEach(element => {
  2 | 	({a: element} = bar);
  3 | });

Output

`␊
  1 | for (let element of foo) {␊
  2 | 	({a: element} = bar);␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach(element => {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	({a: element} = bar);␊
  3 | });␊
`

Invalid #234

  1 | foo.forEach(element => {
  2 | 	({[element]: a} = bar);
  3 | });

Output

`␊
  1 | for (const element of foo) {␊
  2 | 	({[element]: a} = bar);␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach(element => {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	({[element]: a} = bar);␊
  3 | });␊
`

Invalid #235

  1 | foo.forEach(element => {
  2 | 	({[a]: element} = bar);
  3 | });

Output

`␊
  1 | for (let element of foo) {␊
  2 | 	({[a]: element} = bar);␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach(element => {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	({[a]: element} = bar);␊
  3 | });␊
`

Invalid #236

  1 | foo.forEach(element => {
  2 | 	({element = a} = bar);
  3 | });

Output

`␊
  1 | for (let element of foo) {␊
  2 | 	({element = a} = bar);␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach(element => {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	({element = a} = bar);␊
  3 | });␊
`

Invalid #237

  1 | foo.forEach(element => {
  2 | 	({a = element} = bar);
  3 | });

Output

`␊
  1 | for (const element of foo) {␊
  2 | 	({a = element} = bar);␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach(element => {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	({a = element} = bar);␊
  3 | });␊
`

Invalid #238

  1 | foo.forEach(element => {
  2 | 	[element] = bar;
  3 | });

Output

`␊
  1 | for (let element of foo) {␊
  2 | 	[element] = bar;␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach(element => {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	[element] = bar;␊
  3 | });␊
`

Invalid #239

  1 | foo.forEach(element => {
  2 | 	[element = a] = bar;
  3 | });

Output

`␊
  1 | for (let element of foo) {␊
  2 | 	[element = a] = bar;␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach(element => {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	[element = a] = bar;␊
  3 | });␊
`

Invalid #240

  1 | foo.forEach(element => {
  2 | 	[a = element] = bar;
  3 | });

Output

`␊
  1 | for (const element of foo) {␊
  2 | 	[a = element] = bar;␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach(element => {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	[a = element] = bar;␊
  3 | });␊
`

Invalid #241

  1 | foo.forEach(element => {
  2 | 	({deep: {element}} = bar);
  3 | });

Output

`␊
  1 | for (let element of foo) {␊
  2 | 	({deep: {element}} = bar);␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach(element => {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	({deep: {element}} = bar);␊
  3 | });␊
`

Invalid #242

  1 | foo.forEach(element => {
  2 | 	({deep: {element: a}} = bar);
  3 | });

Output

`␊
  1 | for (const element of foo) {␊
  2 | 	({deep: {element: a}} = bar);␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach(element => {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	({deep: {element: a}} = bar);␊
  3 | });␊
`

Invalid #243

  1 | foo.forEach(element => {
  2 | 	({deep: {a: element}} = bar);
  3 | });

Output

`␊
  1 | for (let element of foo) {␊
  2 | 	({deep: {a: element}} = bar);␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach(element => {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	({deep: {a: element}} = bar);␊
  3 | });␊
`

Invalid #244

  1 | foo.forEach(element => {
  2 | 	({deep: {[element]: a}} = bar);
  3 | });

Output

`␊
  1 | for (const element of foo) {␊
  2 | 	({deep: {[element]: a}} = bar);␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach(element => {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	({deep: {[element]: a}} = bar);␊
  3 | });␊
`

Invalid #245

  1 | foo.forEach(element => {
  2 | 	({deep: {[a]: element}} = bar);
  3 | });

Output

`␊
  1 | for (let element of foo) {␊
  2 | 	({deep: {[a]: element}} = bar);␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach(element => {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	({deep: {[a]: element}} = bar);␊
  3 | });␊
`

Invalid #246

  1 | foo.forEach(element => {
  2 | 	({deep: {element = a}} = bar);
  3 | });

Output

`␊
  1 | for (let element of foo) {␊
  2 | 	({deep: {element = a}} = bar);␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach(element => {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	({deep: {element = a}} = bar);␊
  3 | });␊
`

Invalid #247

  1 | foo.forEach(element => {
  2 | 	({deep: {a = element}} = bar);
  3 | });

Output

`␊
  1 | for (const element of foo) {␊
  2 | 	({deep: {a = element}} = bar);␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach(element => {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	({deep: {a = element}} = bar);␊
  3 | });␊
`

Invalid #248

  1 | foo.forEach(element => {
  2 | 	({deep: [element]} = bar);
  3 | });

Output

`␊
  1 | for (let element of foo) {␊
  2 | 	({deep: [element]} = bar);␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach(element => {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	({deep: [element]} = bar);␊
  3 | });␊
`

Invalid #249

  1 | foo.forEach(element => {
  2 | 	({deep: [element = a]} = bar);
  3 | });

Output

`␊
  1 | for (let element of foo) {␊
  2 | 	({deep: [element = a]} = bar);␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach(element => {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	({deep: [element = a]} = bar);␊
  3 | });␊
`

Invalid #250

  1 | foo.forEach(element => {
  2 | 	({deep: [a = element]} = bar);
  3 | });

Output

`␊
  1 | for (const element of foo) {␊
  2 | 	({deep: [a = element]} = bar);␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach(element => {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	({deep: [a = element]} = bar);␊
  3 | });␊
`

Invalid #251

  1 | foo.forEach(element => {
  2 | 	[{element}] = bar;
  3 | });

Output

`␊
  1 | for (let element of foo) {␊
  2 | 	[{element}] = bar;␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach(element => {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	[{element}] = bar;␊
  3 | });␊
`

Invalid #252

  1 | foo.forEach(element => {
  2 | 	[{element: a}] = bar;
  3 | });

Output

`␊
  1 | for (const element of foo) {␊
  2 | 	[{element: a}] = bar;␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach(element => {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	[{element: a}] = bar;␊
  3 | });␊
`

Invalid #253

  1 | foo.forEach(element => {
  2 | 	[{a: element}] = bar;
  3 | });

Output

`␊
  1 | for (let element of foo) {␊
  2 | 	[{a: element}] = bar;␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach(element => {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	[{a: element}] = bar;␊
  3 | });␊
`

Invalid #254

  1 | foo.forEach(element => {
  2 | 	[{[element]: a}] = bar;
  3 | });

Output

`␊
  1 | for (const element of foo) {␊
  2 | 	[{[element]: a}] = bar;␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach(element => {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	[{[element]: a}] = bar;␊
  3 | });␊
`

Invalid #255

  1 | foo.forEach(element => {
  2 | 	[{[a]: element}] = bar;
  3 | });

Output

`␊
  1 | for (let element of foo) {␊
  2 | 	[{[a]: element}] = bar;␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach(element => {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	[{[a]: element}] = bar;␊
  3 | });␊
`

Invalid #256

  1 | foo.forEach(element => {
  2 | 	[{element = a}] = bar;
  3 | });

Output

`␊
  1 | for (let element of foo) {␊
  2 | 	[{element = a}] = bar;␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach(element => {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	[{element = a}] = bar;␊
  3 | });␊
`

Invalid #257

  1 | foo.forEach(element => {
  2 | 	[{a = element}] = bar;
  3 | });

Output

`␊
  1 | for (const element of foo) {␊
  2 | 	[{a = element}] = bar;␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach(element => {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	[{a = element}] = bar;␊
  3 | });␊
`

Invalid #258

  1 | foo.forEach(element => {
  2 | 	[[element]] = bar;
  3 | });

Output

`␊
  1 | for (let element of foo) {␊
  2 | 	[[element]] = bar;␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach(element => {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	[[element]] = bar;␊
  3 | });␊
`

Invalid #259

  1 | foo.forEach(element => {
  2 | 	[[element = a]] = bar;
  3 | });

Output

`␊
  1 | for (let element of foo) {␊
  2 | 	[[element = a]] = bar;␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach(element => {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	[[element = a]] = bar;␊
  3 | });␊
`

Invalid #260

  1 | foo.forEach(element => {
  2 | 	[[a = element]] = bar;
  3 | });

Output

`␊
  1 | for (const element of foo) {␊
  2 | 	[[a = element]] = bar;␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach(element => {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	[[a = element]] = bar;␊
  3 | });␊
`

Invalid #261

  1 | foo.forEach(element => {
  2 | 	[
  3 | 		bar = ((element) => {
  4 | 			[element] = array;
  5 | 		})(element)
  6 | 	] = baz;
  7 | });

Output

`␊
  1 | for (const element of foo) {␊
  2 | 	[␊
  3 | 		bar = ((element) => {␊
  4 | 			[element] = array;␊
  5 | 		})(element)␊
  6 | 	] = baz;␊
  7 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach(element => {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	[␊
  3 | 		bar = ((element) => {␊
  4 | 			[element] = array;␊
  5 | 		})(element)␊
  6 | 	] = baz;␊
  7 | });␊
`

Invalid #262

  1 | foo.forEach(element => {
  2 | 	[
  3 | 		bar = ((element = array) => element)(element)
  4 | 	] = baz;
  5 | });

Output

`␊
  1 | for (const element of foo) {␊
  2 | 	[␊
  3 | 		bar = ((element = array) => element)(element)␊
  4 | 	] = baz;␊
  5 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach(element => {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	[␊
  3 | 		bar = ((element = array) => element)(element)␊
  4 | 	] = baz;␊
  5 | });␊
`

Invalid #263

  1 | foo.forEach(element => {
  2 | 	[
  3 | 		bar = (([element] = array) => element)(element)
  4 | 	] = baz;
  5 | });

Output

`␊
  1 | for (const element of foo) {␊
  2 | 	[␊
  3 | 		bar = (([element] = array) => element)(element)␊
  4 | 	] = baz;␊
  5 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach(element => {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	[␊
  3 | 		bar = (([element] = array) => element)(element)␊
  4 | 	] = baz;␊
  5 | });␊
`

Invalid #264

  1 | foo.forEach(element => {
  2 | 	for (element in bar);
  3 | });

Output

`␊
  1 | for (let element of foo) {␊
  2 | 	for (element in bar);␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach(element => {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	for (element in bar);␊
  3 | });␊
`

Invalid #265

  1 | foo.forEach(element => {
  2 | 	for ([{element}] of bar);
  3 | });

Output

`␊
  1 | for (let element of foo) {␊
  2 | 	for ([{element}] of bar);␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach(element => {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	for ([{element}] of bar);␊
  3 | });␊
`

Invalid #266

  1 | foo.forEach(element => {
  2 | 	for (key in element);
  3 | 	for (item of element);
  4 | });

Output

`␊
  1 | for (const element of foo) {␊
  2 | 	for (key in element);␊
  3 | 	for (item of element);␊
  4 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach(element => {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	for (key in element);␊
  3 | 	for (item of element);␊
  4 | });␊
`

Invalid #267

  1 | foo.forEach((element, index) => {
  2 | 	for (index of bar);
  3 | });

Output

`␊
  1 | for (let [index, element] of foo.entries()) {␊
  2 | 	for (index of bar);␊
  3 | }␊
`

Error 1/1

`␊
> 1 | foo.forEach((element, index) => {␊
    |     ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
  2 | 	for (index of bar);␊
  3 | });␊
`

Invalid #268

  1 | array.forEach((element, index = element) => {})

Error 1/1

`␊
> 1 | array.forEach((element, index = element) => {})␊
    |       ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #269

  1 | array.forEach(({foo}, index = foo) => {})

Error 1/1

`␊
> 1 | array.forEach(({foo}, index = foo) => {})␊
    |       ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #270

  1 | array.forEach((element, {bar = element}) => {})

Error 1/1

`␊
> 1 | array.forEach((element, {bar = element}) => {})␊
    |       ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`

Invalid #271

  1 | array.forEach(({foo}, {bar = foo}) => {})

Error 1/1

`␊
> 1 | array.forEach(({foo}, {bar = foo}) => {})␊
    |       ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`