noUnnecessaryContinue
Ce contenu n’est pas encore disponible dans votre langue.
Diagnostic Category: lint/correctness/noUnnecessaryContinue
Since: v1.0.0
Avoid using unnecessary continue
.
Examples
Section titled ExamplesInvalid
Section titled Invalidcode-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 │
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 │
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 │
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”);
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 │
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 │