Why is this an issue?

Jump statements, such as return, break and continue, are used to change the normal flow of execution in a program. They are useful because they allow for more complex and flexible code. However, it is important to use jump statements judiciously, as overuse or misuse can make code difficult to read and maintain.

Jump statements are redundant when they do not affect the program flow or behavior.

function redundantJump(x) {
  if (x == 1) {
    console.log("x == 1");
    return; // Noncompliant: The function would return 'undefined' also without this 'return' statement
  }
}

Remove any jump statements that are unnecessary or redundant.

function redundantJump(x) {
  if (x == 1) {
    console.log("x == 1");
  }
}

Exceptions

Resources

Documentation