mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 13:33:24 +00:00
eslint: Replace empty-returns with consistent-return.
Instead of prohibiting ‘return undefined’ (#8669), we require that a function must return an explicit value always or never. This prevents you from forgetting to return a value in some cases. It will also be important for TypeScript, which distinguishes between undefined and void. Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
fe66aef0ad
commit
d72423ef21
@@ -81,6 +81,7 @@ run_test("pills", () => {
|
||||
if (user_email === othello.email) {
|
||||
return othello;
|
||||
}
|
||||
throw new Error(`Unknown user email ${user_email}`);
|
||||
};
|
||||
|
||||
let get_by_user_id_called = false;
|
||||
@@ -89,8 +90,10 @@ run_test("pills", () => {
|
||||
if (id === othello.user_id) {
|
||||
return othello;
|
||||
}
|
||||
assert.equal(id, 3);
|
||||
return hamlet;
|
||||
if (id === hamlet.user_id) {
|
||||
return hamlet;
|
||||
}
|
||||
throw new Error(`Unknown user ID ${id}`);
|
||||
};
|
||||
|
||||
function test_create_item(handler) {
|
||||
|
||||
Reference in New Issue
Block a user