codedang icon indicating copy to clipboard operation
codedang copied to clipboard

ESLint `no-useless-return` rule

Open dotoleeoak opened this issue 2 years ago • 1 comments

Describe the problem and solution

필요 없는 return statement를 방지합니다.

// ❌
function foo() { return; }

function foo() {
  doSomething();
  return;
}

function foo() {
  if (condition) {
    bar();
    return;
  } else {
    baz();
  }
}
// ✅
function foo() { return 5; }

function foo() {
  return doSomething();
}

function foo() {
  if (condition) {
    bar();
    return;
  } else {
    baz();
  }
  qux();
}

Validations

dotoleeoak avatar Jul 28 '23 14:07 dotoleeoak

Changed the connected Notion task status to not-started

TAS-499 ESLint no-useless-return rule

jimin9038 avatar Aug 01 '24 02:08 jimin9038