Repository: zulip/zulip

Issue:
lint rules: Prevent `return undefined;`
We should sweep the code to replace `return undefined;` with `return;`, and then make a lint rule for it, either via eslint (if they support that) or by making a custom rule.


Discussion:
Hello @zulip/server-testing members, this issue was labeled with the **area: testing-infrastructure** label, so you may want to check it out!

<!-- areaLabelNotification -->
@zulipbot claim

Resolving patch:
diff --git a/version.py b/version.py
--- a/version.py
+++ b/version.py
@@ -8,4 +8,4 @@
 # Typically, adding a dependency only requires a minor version bump, and
 # removing a dependency requires a major version bump.
 
-PROVISION_VERSION = '15.9'
+PROVISION_VERSION = '15.10'


Test patch:
diff --git a/frontend_tests/node_tests/people.js b/frontend_tests/node_tests/people.js
--- a/frontend_tests/node_tests/people.js
+++ b/frontend_tests/node_tests/people.js
@@ -2,7 +2,7 @@ zrequire('util');
 zrequire('people');
 
 set_global('blueslip', {
-    error: function () { return undefined; },
+    error: function () { return; },
 });
 set_global('page_params', {});
 set_global('md5', function (s) {
@@ -555,7 +555,7 @@ initialize();
     assert.equal(email, 'debbie71@example.com');
 
     // Test undefined slug
-    people.emails_strings_to_user_ids_string = function () { return undefined; };
+    people.emails_strings_to_user_ids_string = function () { return; };
     assert.equal(people.emails_to_slug(), undefined);
 }());
 
diff --git a/frontend_tests/node_tests/people_errors.js b/frontend_tests/node_tests/people_errors.js
--- a/frontend_tests/node_tests/people_errors.js
+++ b/frontend_tests/node_tests/people_errors.js
@@ -107,7 +107,7 @@ people.initialize_current_user(me.user_id);
     assert(reply_to.indexOf('?') > -1);
 
     people.pm_with_user_ids = function () { return [42]; };
-    people.get_person_from_user_id = function () { return undefined; };
+    people.get_person_from_user_id = function () { return; };
     global.blueslip.error = function (msg) {
         assert.equal(msg, 'Unknown people in message');
     };
diff --git a/frontend_tests/node_tests/search_suggestion.js b/frontend_tests/node_tests/search_suggestion.js
--- a/frontend_tests/node_tests/search_suggestion.js
+++ b/frontend_tests/node_tests/search_suggestion.js
@@ -53,7 +53,7 @@ topic_data.reset();
     };
 
     global.narrow_state.stream = function () {
-        return undefined;
+        return;
     };
 
     var suggestions = search.get_suggestions(query);
@@ -73,7 +73,7 @@ topic_data.reset();
     };
 
     global.narrow_state.stream = function () {
-        return undefined;
+        return;
     };
 
     var ted =
@@ -244,7 +244,7 @@ topic_data.reset();
     };
 
     global.narrow_state.stream = function () {
-        return undefined;
+        return;
     };
 
     set_global('activity', {
@@ -430,7 +430,7 @@ init();
     };
 
     global.narrow_state.stream = function () {
-        return undefined;
+        return;
     };
 
     var suggestions = search.get_suggestions(query);
@@ -466,7 +466,7 @@ init();
     };
 
     global.narrow_state.stream = function () {
-        return undefined;
+        return;
     };
 
     var query = '';
diff --git a/frontend_tests/node_tests/topic_generator.js b/frontend_tests/node_tests/topic_generator.js
--- a/frontend_tests/node_tests/topic_generator.js
+++ b/frontend_tests/node_tests/topic_generator.js
@@ -174,7 +174,7 @@ function is_odd(i) { return i % 2 === 1; }
     assert.equal(gen.next(), undefined);
 
     var undef = function () {
-        return undefined;
+        return;
     };
 
     global.blueslip.error = function (msg) {
@@ -315,7 +315,7 @@ function is_odd(i) { return i % 2 === 1; }
 
     unread.num_unread_for_person = function (user_ids_string) {
         if (user_ids_string === 'unk') {
-            return undefined;
+            return;
         }
 
         if (user_ids_string === 'read') {