--- source: crates/biome_js_analyze/tests/spec_tests.rs expression: valid.js --- # Input ```jsx test3: do { if (i < 2) { continue test3; } i++; } while (true); while (i) { if (i > 5) { continue; } console.log(i); i--; } while (i) { continue; console.log(i); } while (condition) { if (conditionZ) { if (conditionX) { console.log("log"); continue; } console.log("log"); if (conditionY) { console.log("log"); } } } loop: while (1) { forLoop: for (let i = 0; i < 5; i++) { if (someCondition) { continue loop; } } } loop: for (let i = 0; i < 10; i++) { for (let j = 0; j < byteLength; j++) { if (condition) { continue loop; } } } for (const x of []) { if (x) { // before continue; // statement // after } else { doSomeStuff(); } } function f(xs) { for (const x of xs) { switch (x) { case 0: if (isConstValid) { continue; } // falls through case 1: break; } } } ``` # Diagnostics ``` valid.js:53:3 lint/correctness/noUnnecessaryContinue FIXABLE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ! Unnecessary continue statement 51 │ if (x) { 52 │ // before > 53 │ continue; // statement │ ^^^^^^^^^ 54 │ // after 55 │ } else { i Unsafe fix: Delete the unnecessary continue statement 50 50 │ for (const x of []) { 51 51 │ if (x) { 52 │ - → → //·before 53 │ - → → continue;·//·statement 54 │ - → → //·after 52 │ + → → //·after 55 53 │ } else { 56 54 │ doSomeStuff(); ```