noContinue
Summary
Section titled “Summary”- Rule available since:
v2.3.4 - Diagnostic Category:
lint/nursery/noContinue - This rule doesn’t have a fix.
- The default severity of this rule is information.
- Sources:
- Same as
no-continue
- Same as
How to configure
Section titled “How to configure”{ "linter": { "rules": { "nursery": { "noContinue": "error" } } }}Description
Section titled “Description”Disallow continue statements.
The continue statement terminates execution of the statements in the current iteration of the current or labeled loop, and continues execution of the loop with the next iteration. When used incorrectly it makes code less testable, less readable and less maintainable. Structured control flow statements such as if should be used instead.
Examples
Section titled “Examples”Invalid
Section titled “Invalid”let sum = 0, i;
for(i = 0; i < 10; i++) { if(i >= 5) { continue; }
sum += i;}code-block.js:6:9 lint/nursery/noContinue ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
ℹ Unexpected use of continue statement.
4 │ for(i = 0; i < 10; i++) {
5 │ if(i >= 5) {
> 6 │ continue;
│ ^^^^^^^^^
7 │ }
8 │
ℹ The continue statement terminates execution of the statements in the current iteration, when used incorrectly it makes code less testable, less readable and less maintainable. Structured control flow statements such as if should be used instead.
ℹ This rule belongs to the nursery group, which means it is not yet stable and may change in the future. Visit https://biomejs.dev/linter/#nursery for more information.
let sum = 0, i;
for(i = 0; i < 10; i++) { if(i < 5) { sum += i; }}Related links
Section titled “Related links”Copyright (c) 2023-present Biome Developers and Contributors.