Aller au contenu

noUnnecessaryContinue

Ce contenu n’est pas encore disponible dans votre langue.

Diagnostic Category: lint/correctness/noUnnecessaryContinue

Since: v1.0.0

Avoid using unnecessary continue.

loop: for (let i = 0; i < 5; i++) {
continue loop;
}
code-block.js:2:3 lint/correctness/noUnnecessaryContinue  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Unnecessary continue statement

1 │ loop: for (let i = 0; i < 5; i++) {
> 2 │ continue loop;
^^^^^^^^^^^^^^
3 │ }
4 │

Unsafe fix: Delete the unnecessary continue statement

1 1 loop: for (let i = 0; i < 5; i++) {
2 - ··continue·loop;
3 2 }
4 3

while (i--) {
continue;
}
code-block.js:2:3 lint/correctness/noUnnecessaryContinue  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Unnecessary continue statement

1 │ while (i—) {
> 2 │ continue;
^^^^^^^^^
3 │ }
4 │

Unsafe fix: Delete the unnecessary continue statement

1 1 while (i—) {
2 - ··continue;
3 2 }
4 3

while (1) {
continue;
}
code-block.js:2:3 lint/correctness/noUnnecessaryContinue  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Unnecessary continue statement

1 │ while (1) {
> 2 │ continue;
^^^^^^^^^
3 │ }
4 │

Unsafe fix: Delete the unnecessary continue statement

1 1 while (1) {
2 - ··continue;
3 2 }
4 3

for (let i = 0; i < 10; i++) {
if (i > 5) {
console.log("foo");
continue;
} else if (i >= 5 && i < 8) {
console.log("test");
} else {
console.log("test");
}
}
code-block.js:4:5 lint/correctness/noUnnecessaryContinue  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Unnecessary continue statement

2 │ if (i > 5) {
3 │ console.log(“foo”);
> 4 │ continue;
^^^^^^^^^
5 │ } else if (i >= 5 && i < 8) {
6 │ console.log(“test”);

Unsafe fix: Delete the unnecessary continue statement

2 2 if (i > 5) {
3 3 console.log(“foo”);
4 - ····continue;
5 4 } else if (i >= 5 && i < 8) {
6 5 console.log(“test”);

for (let i = 0; i < 9; i++) {
continue;
}
code-block.js:2:3 lint/correctness/noUnnecessaryContinue  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Unnecessary continue statement

1 │ for (let i = 0; i < 9; i++) {
> 2 │ continue;
^^^^^^^^^
3 │ }
4 │

Unsafe fix: Delete the unnecessary continue statement

1 1 for (let i = 0; i < 9; i++) {
2 - ··continue;
3 2 }
4 3

test2: do {
continue test2;
} while (true);
code-block.js:2:2 lint/correctness/noUnnecessaryContinue  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Unnecessary continue statement

1 │ test2: do {
> 2 │ continue test2;
^^^^^^^^^^^^^^^
3 │ } while (true);
4 │

Unsafe fix: Delete the unnecessary continue statement

1 1 test2: do {
2 - continue·test2;
3 2 } while (true);
4 3

while (i) {
if (i > 5) {
continue;
}
console.log(i);
i--;
}
loop: while (1) {
forLoop: for (let i = 0; i < 5; i++) {
if (someCondition) {
continue loop;
}
}
}