codedang
codedang copied to clipboard
ESLint `no-useless-return` rule
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
- [X] Follow our Code of Conduct
- [X] Read the Contributing Guidelines
- [X] Check that there isn't already an issue