Skip to content

Commit 247e156

Browse files
docs: add missing let declarations in no-plusplus (#19980)
1 parent 0d17242 commit 247e156

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

docs/src/rules/no-plusplus.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ foo++;
4242
let bar = 42;
4343
bar--;
4444

45-
for (i = 0; i < l; i++) {
45+
for (let i = 0; i < l; i++) {
4646
doSomething(i);
4747
}
4848
```
@@ -62,7 +62,7 @@ foo += 1;
6262
let bar = 42;
6363
bar -= 1;
6464

65-
for (i = 0; i < l; i += 1) {
65+
for (let i = 0; i < l; i += 1) {
6666
doSomething(i);
6767
}
6868
```
@@ -84,15 +84,15 @@ Examples of **correct** code for this rule with the `{ "allowForLoopAfterthought
8484
```js
8585
/*eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }]*/
8686

87-
for (i = 0; i < l; i++) {
87+
for (let i = 0; i < l; i++) {
8888
doSomething(i);
8989
}
9090

91-
for (i = l; i >= 0; i--) {
91+
for (let i = l; i >= 0; i--) {
9292
doSomething(i);
9393
}
9494

95-
for (i = 0, j = l; i < l; i++, j--) {
95+
for (let i = 0, j = l; i < l; i++, j--) {
9696
doSomething(i, j);
9797
}
9898
```
@@ -106,15 +106,15 @@ Examples of **incorrect** code for this rule with the `{ "allowForLoopAfterthoug
106106
```js
107107
/*eslint no-plusplus: ["error", { "allowForLoopAfterthoughts": true }]*/
108108

109-
for (i = 0; i < l; j = i++) {
109+
for (let i = 0; i < l; j = i++) {
110110
doSomething(i, j);
111111
}
112112

113-
for (i = l; i--;) {
113+
for (let i = l; i--;) {
114114
doSomething(i);
115115
}
116116

117-
for (i = 0; i < l;) i++;
117+
for (let i = 0; i < l;) i++;
118118
```
119119

120120
:::

0 commit comments

Comments
 (0)