The actual snapshot is saved in no-array-for-each.mjs.snap
.
Generated by AVA.
1 | foo.forEach?.(element => bar(element))
Error 1/1
`␊
> 1 | foo.forEach?.(element => bar(element))␊
| ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
1 | foo.forEach(element => bar(element), thisArgument)
Error 1/1
`␊
> 1 | foo.forEach(element => bar(element), thisArgument)␊
| ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`
1 | foo?.forEach(element => bar(element), thisArgument)
Error 1/1
`␊
> 1 | foo?.forEach(element => bar(element), thisArgument)␊
| ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`
1 | foo.forEach()
Error 1/1
`␊
> 1 | foo.forEach()␊
| ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`
1 | foo?.forEach()
Error 1/1
`␊
> 1 | foo?.forEach()␊
| ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
1 | foo.forEach(bar)
Error 1/1
`␊
> 1 | foo.forEach(bar)␊
| ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`
1 | foo?.forEach(bar)
Error 1/1
`␊
> 1 | foo?.forEach(bar)␊
| ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`
1 | foo.forEach(async function(element) {})
Error 1/1
`␊
> 1 | foo.forEach(async function(element) {})␊
| ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`
1 | foo?.forEach(async function(element) {})
Error 1/1
`␊
> 1 | foo?.forEach(async function(element) {})␊
| ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`
1 | foo.forEach(function * (element) {})
Error 1/1
`␊
> 1 | foo.forEach(function * (element) {})␊
| ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`
1 | foo?.forEach(function * (element) {})
Error 1/1
`␊
> 1 | foo?.forEach(function * (element) {})␊
| ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`
1 | foo.forEach(() => bar())
Error 1/1
`␊
> 1 | foo.forEach(() => bar())␊
| ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`
1 | foo?.forEach(() => bar())
Error 1/1
`␊
> 1 | foo?.forEach(() => bar())␊
| ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`
1 | foo.forEach((element, index, array) => bar())
Error 1/1
`␊
> 1 | foo.forEach((element, index, array) => bar())␊
| ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`
1 | foo?.forEach((element, index, array) => bar())
Error 1/1
`␊
> 1 | foo?.forEach((element, index, array) => bar())␊
| ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`
1 | property.forEach(({property}) => bar(property))
Error 1/1
`␊
> 1 | property.forEach(({property}) => bar(property))␊
| ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`
1 | property?.forEach(({property}) => bar(property))
Error 1/1
`␊
> 1 | property?.forEach(({property}) => bar(property))␊
| ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`
1 | () => foo.forEach()
Error 1/1
`␊
> 1 | () => foo.forEach()␊
| ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`
1 | () => foo?.forEach()
Error 1/1
`␊
> 1 | () => foo?.forEach()␊
| ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`
1 | foo.forEach((element = {}) => call(element))
Error 1/1
`␊
> 1 | foo.forEach((element = {}) => call(element))␊
| ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`
1 | foo?.forEach((element = {}) => call(element))
Error 1/1
`␊
> 1 | foo?.forEach((element = {}) => call(element))␊
| ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
1 | foo.forEach(foo => bar());
Error 1/1
`␊
> 1 | foo.forEach(foo => bar());␊
| ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`
1 | foo?.forEach(foo => bar());
Error 1/1
`␊
> 1 | foo?.forEach(foo => bar());␊
| ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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 | }␊
`
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 | }␊
`
1 | index.forEach((a, index) => bar());
Error 1/1
`␊
> 1 | index.forEach((a, index) => bar());␊
| ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`
1 | index?.forEach((a, index) => bar());
Error 1/1
`␊
> 1 | index?.forEach((a, index) => bar());␊
| ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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 | }␊
`
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 | }␊
`
1 | a[foo].forEach(foo => bar());
Error 1/1
`␊
> 1 | a[foo].forEach(foo => bar());␊
| ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`
1 | a[foo]?.forEach(foo => bar());
Error 1/1
`␊
> 1 | a[foo]?.forEach(foo => bar());␊
| ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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 | }␊
`
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 | }␊
`
1 | a[index].forEach((b, index) => bar());
Error 1/1
`␊
> 1 | a[index].forEach((b, index) => bar());␊
| ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`
1 | a[index]?.forEach((b, index) => bar());
Error 1/1
`␊
> 1 | a[index]?.forEach((b, index) => bar());␊
| ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`
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(…)\`.␊
`
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();␊
`
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(…)\`.␊
`
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();␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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 | })␊
`
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 | })␊
`
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 | })␊
`
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 | })␊
`
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 | })␊
`
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 | })␊
`
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 | })␊
`
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 | })␊
`
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 | })␊
`
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 | })␊
`
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 | })␊
`
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 | })␊
`
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 | })␊
`
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 | })␊
`
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 | })␊
`
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 | })␊
`
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 | })␊
`
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 | })␊
`
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 | })␊
`
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 | })␊
`
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 | })␊
`
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 | })␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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)␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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)␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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)␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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 | },);␊
`
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 | },);␊
`
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 | },);␊
`
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 | },);␊
`
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 | },);␊
`
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 | },);␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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();␊
`
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();␊
`
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 | }␊
`
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 | }␊
`
1 | foo.forEach(element => ({}))
Output
`␊
1 | for (const element of foo) ({})␊
`
Error 1/1
`␊
> 1 | foo.forEach(element => ({}))␊
| ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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 | });␊
`
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 | });␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
1 | foo.React.Children.forEach(bar)
Error 1/1
`␊
> 1 | foo.React.Children.forEach(bar)␊
| ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`
1 | foo.React.Children?.forEach(bar)
Error 1/1
`␊
> 1 | foo.React.Children?.forEach(bar)␊
| ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`
1 | NotReact.Children.forEach(bar)
Error 1/1
`␊
> 1 | NotReact.Children.forEach(bar)␊
| ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`
1 | NotReact.Children?.forEach(bar)
Error 1/1
`␊
> 1 | NotReact.Children?.forEach(bar)␊
| ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`
1 | React.NotChildren.forEach(bar)
Error 1/1
`␊
> 1 | React.NotChildren.forEach(bar)␊
| ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`
1 | React.NotChildren?.forEach(bar)
Error 1/1
`␊
> 1 | React.NotChildren?.forEach(bar)␊
| ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`
1 | React?.Children.forEach(bar)
Error 1/1
`␊
> 1 | React?.Children.forEach(bar)␊
| ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`
1 | React?.Children?.forEach(bar)
Error 1/1
`␊
> 1 | React?.Children?.forEach(bar)␊
| ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`
1 | NotChildren.forEach(bar)
Error 1/1
`␊
> 1 | NotChildren.forEach(bar)␊
| ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`
1 | NotChildren?.forEach(bar)
Error 1/1
`␊
> 1 | NotChildren?.forEach(bar)␊
| ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`
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 | })␊
`
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 | })␊
`
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 | })␊
`
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 | })␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
1 | foo.forEach((element = elementDefaultValue, index = indexDefaultValue) => {})
Error 1/1
`␊
> 1 | foo.forEach((element = elementDefaultValue, index = indexDefaultValue) => {})␊
| ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`
1 | foo?.forEach((element = elementDefaultValue, index = indexDefaultValue) => {})
Error 1/1
`␊
> 1 | foo?.forEach((element = elementDefaultValue, index = indexDefaultValue) => {})␊
| ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`
1 | foo.forEach(({}) => {})
Output
`␊
1 | for (const {} of foo) {}␊
`
Error 1/1
`␊
> 1 | foo.forEach(({}) => {})␊
| ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`
1 | foo?.forEach(({}) => {})
Output
`␊
1 | if (foo) for (const {} of foo) {}␊
`
Error 1/1
`␊
> 1 | foo?.forEach(({}) => {})␊
| ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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 | });␊
`
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 | });␊
`
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 | })␊
`
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 | })␊
`
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 | })␊
`
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 | })␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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(…)\`.␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
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 | });␊
`
1 | array.forEach((element, index = element) => {})
Error 1/1
`␊
> 1 | array.forEach((element, index = element) => {})␊
| ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`
1 | array.forEach(({foo}, index = foo) => {})
Error 1/1
`␊
> 1 | array.forEach(({foo}, index = foo) => {})␊
| ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`
1 | array.forEach((element, {bar = element}) => {})
Error 1/1
`␊
> 1 | array.forEach((element, {bar = element}) => {})␊
| ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`
1 | array.forEach(({foo}, {bar = foo}) => {})
Error 1/1
`␊
> 1 | array.forEach(({foo}, {bar = foo}) => {})␊
| ^^^^^^^ Use \`for…of\` instead of \`.forEach(…)\`.␊
`