skkuding / codedang

Online Judge for SKKU
https://codedang.com
MIT License
46 stars 9 forks source link

ESLint `no-useless-return` rule #687

Open dotoleeoak opened 1 year ago

dotoleeoak commented 1 year ago

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

jimin9038 commented 4 months ago

Changed the connected Notion task status to not-started

TAS-499 ESLint no-useless-return rule