Skip to content

Latest commit

 

History

History
53 lines (35 loc) · 1.12 KB

File metadata and controls

53 lines (35 loc) · 1.12 KB

eslint/no-continue

What it does

Disallow continue statements

Why is this bad?

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.

Example

var sum = 0,
  i;

for (i = 0; i < 10; i++) {
  if (i >= 5) {
    continue;
  }

  sum += i;
}

How to use

To enable this rule in the CLI or using the config file, you can use:

::: code-group

oxlint --deny no-continue
{
  "rules": {
    "no-continue": "error"
  }
}

:::

References