Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Bug 1329017 - Enable the no-useless-return rule for eslint and use es…
Browse files Browse the repository at this point in the history
…lint --fix to autofix the errors. r=standard8

MozReview-Commit-ID: 2MhpvzUDgtK
  • Loading branch information
msujaws committed Jan 6, 2017
1 parent 8fa35ca commit 8b4be4d
Show file tree
Hide file tree
Showing 38 changed files with 8 additions and 58 deletions.
1 change: 0 additions & 1 deletion browser/base/content/abouthome/aboutHome.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,6 @@ function loadSnippets() {
} catch (ex) {
showSnippets();
loadCompleted();
return;
}
} else {
showSnippets();
Expand Down
1 change: 0 additions & 1 deletion browser/base/content/browser-data-submission-info-bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ var gDataNotificationInfoBar = {
this._displayDataPolicyInfoBar(request);
} catch (ex) {
request.onUserNotifyFailed(ex);
return;
}
break;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ add_task(function* panel_shown_for_once_for_doubleclick_on_new_bookmark_star_and
add_task(function* panel_shown_once_for_slow_doubleclick_on_new_bookmark_star_and_autocloses() {
todo(false, "bug 1250267, may need to add some tracking state to " +
"browser-places.js for this.");
return;

/*
yield test_bookmarks_popup({
Expand Down
2 changes: 1 addition & 1 deletion browser/base/content/test/general/browser_bug356571.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ var gProgressListener = {

function test() {
todo(false, "temp. disabled");
return; /* FIXME */
/* FIXME */
/*
waitForExplicitFinish();
// Wait for all tabs to finish loading
Expand Down
7 changes: 0 additions & 7 deletions browser/base/content/test/general/browser_contextmenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,6 @@ add_task(function* test_textarea() {
// Disabled since this is seeing spell-check-enabled
// instead of spell-add-dictionaries-main
todo(false, "spell checker tests are failing, bug 1246296");
return;

/*
yield test_contextmenu("#test-textarea",
Expand All @@ -398,7 +397,6 @@ add_task(function* test_textarea() {

add_task(function* test_textarea_spellcheck() {
todo(false, "spell checker tests are failing, bug 1246296");
return;

/*
yield test_contextmenu("#test-textarea",
Expand Down Expand Up @@ -438,7 +436,6 @@ add_task(function* test_plaintext2() {

add_task(function* test_undo_add_to_dictionary() {
todo(false, "spell checker tests are failing, bug 1246296");
return;

/*
yield test_contextmenu("#test-textarea",
Expand Down Expand Up @@ -472,7 +469,6 @@ add_task(function* test_undo_add_to_dictionary() {

add_task(function* test_contenteditable() {
todo(false, "spell checker tests are failing, bug 1246296");
return;

/*
yield test_contextmenu("#test-contenteditable",
Expand Down Expand Up @@ -726,7 +722,6 @@ add_task(function* test_imagelink() {

add_task(function* test_select_input_text() {
todo(false, "spell checker tests are failing, bug 1246296");
return;

/*
yield test_contextmenu("#test-select-input-text",
Expand Down Expand Up @@ -759,7 +754,6 @@ add_task(function* test_select_input_text() {

add_task(function* test_select_input_text_password() {
todo(false, "spell checker tests are failing, bug 1246296");
return;

/*
yield test_contextmenu("#test-select-input-text-type-password",
Expand Down Expand Up @@ -878,7 +872,6 @@ add_task(function* test_srcdoc() {

add_task(function* test_input_spell_false() {
todo(false, "spell checker tests are failing, bug 1246296");
return;

/*
yield test_contextmenu("#test-contenteditable-spellcheck-false",
Expand Down
1 change: 0 additions & 1 deletion browser/base/content/test/newtab/head.js
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,6 @@ function whenSearchInitDone() {
// Wait for the search controller to receive the event, then resolve.
if (content.gSearch._contentSearchController.defaultEngine) {
resolve();
return;
}
}
content.setTimeout(resolver, 0);
Expand Down
1 change: 0 additions & 1 deletion browser/components/customizableui/CustomizableWidgets.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -917,7 +917,6 @@ const CustomizableWidgets = [
if (!gotView) {
aEvent.preventDefault();
aEvent.stopPropagation();
return;
}
},
onCreated(node) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ add_task(function* test_pinned() {
// Remove created tab.
browser.tabs.remove(tabId);
browser.test.notifyPass("finish");
return;
}
});
browser.tabs.update(tab.id, {pinned: true});
Expand All @@ -144,7 +143,6 @@ add_task(function* test_unpinned() {
// Remove created tab.
browser.tabs.remove(tabId);
browser.test.notifyPass("finish");
return;
}
});
browser.tabs.update(tab.id, {pinned: false});
Expand All @@ -167,7 +165,6 @@ add_task(function* test_url() {
// Remove created tab.
browser.tabs.remove(tabId);
browser.test.notifyPass("finish");
return;
}
});
browser.tabs.update(tab.id, {url: "about:blank"});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ add_task(function* tabsSendMessageReply() {
} else if (msg == "respond-promise") {
return Promise.resolve(msg);
} else if (msg == "respond-never") {
return;
return undefined;
} else if (msg == "respond-error") {
return Promise.reject(new Error(msg));
} else if (msg == "throw-error") {
Expand Down
1 change: 0 additions & 1 deletion browser/components/places/content/sidebarUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ var SidebarUtils = {

if (aEvent.button == 0 && isContainer && !openInTabs) {
tbo.view.toggleOpenState(cell.row);
return;
} else if (!mouseInGutter && openInTabs &&
aEvent.originalTarget.localName == "treechildren") {
tbo.view.selection.select(cell.row);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ gTests.push({
break;
default:
ok(false, "unknown event: " + aEvent.type);
return;
}
}
};
Expand Down Expand Up @@ -223,7 +222,6 @@ gTests.push({
break;
default:
ok(false, "unknown event: " + aEvent.type);
return;
}
}
};
Expand Down
7 changes: 0 additions & 7 deletions browser/components/preferences/blocklists.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,6 @@ var gBlocklistManager = {

document.title = params.windowTitle;

let treecols = document.getElementsByTagName("treecols")[0];
treecols.addEventListener("click", event => {
if (event.target.nodeName != "treecol" || event.button != 0) {
return;
}
});

this._loadBlockLists();
},

Expand Down
1 change: 0 additions & 1 deletion browser/components/preferences/in-content/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ var gMainPane = {
return;
case CONFIRM_RESTART_PROMPT_RESTART_LATER:
createOrRemoveSpecialDevEditionFile();
return;
}
}
},
Expand Down
1 change: 0 additions & 1 deletion browser/components/search/test/browser_426329.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ add_task(function* testAltReturn() {

// Shift key has no effect for now, so skip it
add_task(function* testShiftAltReturn() {
return;
/*
yield* prepareTest();
Expand Down
2 changes: 0 additions & 2 deletions browser/components/uitour/UITour.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -1951,7 +1951,6 @@ this.UITour = {
ReaderParent.showReaderModeInfoPanel(browser);
} else {
log.error("startSubTour: Unknown feature option specified");
return;
}
},

Expand Down Expand Up @@ -2031,7 +2030,6 @@ this.UITour = {
}
}
reject("selectSearchEngine could not find engine with given ID");
return;
});
});
},
Expand Down
2 changes: 0 additions & 2 deletions browser/extensions/pocket/content/pocket-content-process.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ AboutPocketChildListener.prototype = {
default:
break;
}

return;
}
};

Expand Down
1 change: 0 additions & 1 deletion browser/modules/ContentSearch.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,6 @@ this.ContentSearch = {
}
win.BrowserSearch.recordSearchInTelemetry(engine, data.healthReportKey,
{ selection: data.selection });
return;
},

getSuggestions: Task.async(function* (engineName, searchString, browser) {
Expand Down
1 change: 0 additions & 1 deletion browser/modules/LaterRun.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ let LaterRun = {
if (this.hoursSinceInstall > kSelfDestructHoursLimit ||
this.sessionCount > kSelfDestructSessionLimit) {
this.selfDestruct();
return;
}
},

Expand Down
3 changes: 3 additions & 0 deletions toolkit/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,9 @@ module.exports = {
// Disallow unnecessary .call() and .apply()
"no-useless-call": "error",

// Disallow redundant return statements
"no-useless-return": "error",

// No using with
"no-with": "error",

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,6 @@ _ContextualIdentityService.prototype = {
}
} catch (error) {
this.loadError(error);
return;
}
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ add_task(function* tabsSendMessageReply() {
} else if (msg == "respond-promise") {
return Promise.resolve(msg);
} else if (msg == "respond-never") {
return;
return undefined;
} else if (msg == "respond-error") {
return Promise.reject(new Error(msg));
} else if (msg == "throw-error") {
Expand Down
5 changes: 1 addition & 4 deletions toolkit/components/passwordmgr/test/test_prompt_async.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,8 @@
if (topic === "domwindowopened") {
this.windowsOpen++;
this.windowsRegistered++;
return;
}
if (topic === "domwindowclosed") {
} else if (topic === "domwindowclosed") {
this.windowsOpen--;
return;
}
},

Expand Down
1 change: 0 additions & 1 deletion toolkit/components/perfmonitoring/tests/browser/head.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ function AlertListener(accept, {register, unregister}) {
}
this.result = result;
this.triggered = true;
return;
};
this.triggered = false;
this.result = null;
Expand Down
1 change: 0 additions & 1 deletion toolkit/components/places/tests/history/test_remove.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ add_task(function* test_remove_single() {
} finally {
yield PlacesTestUtils.clearHistory();
}
return;
});

// Test removing a list of pages
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1023,7 +1023,6 @@
default:
ok(false, "Unexpected invocation of test #" + testNum);
SimpleTest.finish();
return;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,6 @@
default:
ok(false, "Unexpected invocation of test #" + testNum);
SimpleTest.finish();
return;
}
}

Expand Down
1 change: 0 additions & 1 deletion toolkit/components/viewsource/content/viewSourceUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,6 @@ var gViewSourceUtils = {
// we failed loading it with the external editor.
Components.utils.reportError(ex);
this.handleCallBack(aCallBack, false, data);
return;
}
},

Expand Down
1 change: 0 additions & 1 deletion toolkit/components/workerloader/tests/utils_mainthread.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ function worker_handler(worker) {
return;
default:
SimpleTest.ok(false, "test_osfile.xul: wrong message " + JSON.stringify(msg.data));
return;
}
};
}
1 change: 0 additions & 1 deletion toolkit/components/workerloader/tests/worker_handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ function worker_handler(worker) {
return;
default:
SimpleTest.ok(false, "test_osfile.xul: wrong message " + JSON.stringify(msg.data));
return;
}
};
}
1 change: 0 additions & 1 deletion toolkit/content/tests/widgets/popup_shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ function finish() {
return;
}
SimpleTest.finish();
return;
}

function ok(condition, message) {
Expand Down
1 change: 0 additions & 1 deletion toolkit/identity/Identity.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ IDService.prototype = {
}
self.RP._doLogin(rp, rpLoginOptions, assertion);
self.RP._cleanUpProvisionFlow(aRPId, aProvId);
return;
});
});
});
Expand Down
1 change: 0 additions & 1 deletion toolkit/mozapps/extensions/LightweightThemeManager.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,6 @@ function _persistProgressListener(successCallback) {
if (aRequest.QueryInterface(Ci.nsIHttpChannel).requestSucceeded) {
// success
successCallback();
return;
}
} catch (e) { }
// failure
Expand Down
1 change: 0 additions & 1 deletion toolkit/mozapps/extensions/content/extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -2061,7 +2061,6 @@ var gHeader = {
onKeyPress(aEvent) {
if (String.fromCharCode(aEvent.charCode) == "/") {
this.focusSearchBox();
return;
}
},

Expand Down
1 change: 0 additions & 1 deletion toolkit/mozapps/extensions/internal/XPIProvider.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -1941,7 +1941,6 @@ function removeAsync(aFile) {
if (!(e instanceof OS.File.Error) || !e.becauseNoSuchFile)
throw e;
// The file has already gone away
return;
}
});
}
Expand Down
1 change: 0 additions & 1 deletion toolkit/mozapps/extensions/nsBlocklistService.js
Original file line number Diff line number Diff line change
Expand Up @@ -936,7 +936,6 @@ Blocklist.prototype = {
}
} catch (e) {
LOG("Blocklist::_loadBlocklistFromFile: Error constructing blocklist " + e);
return;
}
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ add_task(function* canUndoUninstallDisabled() {
// Tests that uninstalling an enabled lightweight theme offers the option to undo
add_task(function* uninstallLWTOffersUndo() {
// skipped since lightweight themes don't support undoable uninstall yet
return;

/*
LightweightThemeManager.currentTheme = dummyLWTheme("theme1");
Expand Down
2 changes: 0 additions & 2 deletions toolkit/mozapps/preferences/changemp.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,6 @@ function setPasswordStrength() {

var mymeter = document.getElementById('pwmeter');
mymeter.value = pwstrength;

return;
}

function checkPasswords() {
Expand Down
Loading

0 comments on commit 8b4be4d

Please sign in to comment.