Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Commit

Permalink
Enable consistent-return. (#3977)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenba committed Feb 2, 2018
1 parent 2c96506 commit ed632d6
Show file tree
Hide file tree
Showing 14 changed files with 20 additions and 14 deletions.
1 change: 0 additions & 1 deletion .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ plugins:
root: true

rules:
consistent-return: off # TODO: remove, and default to mozilla/recommended of "error"
no-console: [error, {allow: [debug, error, info, trace, warn]}]
no-var: off # TODO: change to "error"
prefer-const: off # TODO: change to "error"
Expand Down
4 changes: 2 additions & 2 deletions addon/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,9 @@ function handleStartup() {
});

if (!shouldDisable() && !webExtension.started) {
return start(webExtension);
start(webExtension);
} else if (shouldDisable()) {
return stop(webExtension, ADDON_DISABLE);
stop(webExtension, ADDON_DISABLE);
}
}

Expand Down
2 changes: 1 addition & 1 deletion addon/webextension/background/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ this.auth = (function() {
} else {
registrationInfo = generateRegistrationInfo();
log.info("Generating new device authentication ID", registrationInfo);
return browser.storage.local.set({registrationInfo});
browser.storage.local.set({registrationInfo});
}
}));

Expand Down
2 changes: 1 addition & 1 deletion addon/webextension/background/communication.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ this.communication = (function() {
log.error(`Promise error in ${req.funcName}:`, errorResult, errorResult && errorResult.stack);
sendResponse({type: "error", message: errorResult + "", errorCode: errorResult.errorCode, popupMessage: errorResult.popupMessage});
});
return true;
return;
}
sendResponse({type: "success", value: result});
});
Expand Down
1 change: 1 addition & 0 deletions addon/webextension/background/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ this.main = (function() {
message: browser.i18n.getMessage("notificationLinkCopiedDetails", pasteSymbol)
});
}
return null;
});

communication.register("copyShotToClipboard", (sender, blob) => {
Expand Down
3 changes: 2 additions & 1 deletion server/src/middleware/csrf.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ exports.csrfProtection = function(req, res, next) {
let exc = new Error("Duplicate CSRF cookies");
exc.headerValue = rawCookies;
captureRavenException(exc, req);
return simpleResponse(res, "Bad request", 400);
simpleResponse(res, "Bad request", 400);
return
}
req.cookies._csrf = req.cookies.get("_csrf"); // csurf expects a property

Expand Down
1 change: 1 addition & 0 deletions server/src/pages/metrics/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ function safeStoreQueries() {
mozlog.info("updated-metrics", {msg: "Updated metrics"});
});
}
return null;
}).catch((error) => {
mozlog.error("metrics-update-error", {msg: "Error running metrics queries", error});
captureRavenException(error);
Expand Down
2 changes: 1 addition & 1 deletion server/src/pages/shot/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ exports.Editor = class Editor extends React.Component {

draw(e) {
if (e.buttons !== 1) {
return null;
return;
}
this.drawContext.beginPath();

Expand Down
6 changes: 3 additions & 3 deletions server/src/reactruntime.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,10 @@ exports.Page = class Page {
}

if (model.userLocales && model.userLocales.length && !model.messages) {
return tryGetL10nMessages(model.userLocales);
tryGetL10nMessages(model.userLocales);
} else {
renderBody();
}

renderBody();
}

get dir() {
Expand Down
4 changes: 2 additions & 2 deletions server/src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,7 @@ app.post("/api/set-title/:id/:domain", function(req, res) {
Shot.get(req.backend, shotId, req.deviceId, req.accountId).then((shot) => {
if (!shot) {
simpleResponse(res, "No such shot", 404);
return;
return null;
}
shot.userTitle = userTitle;
return shot.update();
Expand Down Expand Up @@ -862,7 +862,7 @@ app.post("/api/save-edit", function(req, res) {
if (!shot) {
sendRavenMessage(req, "Attempt to edit shot that does not exist");
simpleResponse(res, "No such shot", 404);
return;
return null;
}
let name = shot.clipNames()[0];
shot.getClip(name).image.url = url;
Expand Down
5 changes: 3 additions & 2 deletions server/src/servershot.js
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,7 @@ Shot.upgradeSearch = function() {
`,
[SEARCHABLE_VERSION, batchSize]).then((rows) => {
if (!rows.length) {
return;
return null;
}
let index = 0;
return new Promise((resolve, reject) => {
Expand All @@ -960,13 +960,14 @@ Shot.upgradeSearch = function() {
Shot.get("upgrade_search_only", rows[index].id).then((shot) => {
// This shouldn't really happen, but apparently can...
if (!shot) {
return;
return null;
}
return shot.upgradeSearch();
}).then(() => {
index++;
run();
}).catch(reject);
return null;
}
run();
}).then(() => {
Expand Down
1 change: 1 addition & 0 deletions server/src/share-buttons.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ class ShareButtonPanel extends React.Component {
}

this.props.closePanel();
return null;
}

onClickCopyButton(e) {
Expand Down
1 change: 1 addition & 0 deletions server/src/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,5 +245,6 @@ exports.retrieveAccount = function(deviceId) {
if (rows[0].accountid) {
return rows[0].accountid;
}
return null;
});
}
1 change: 1 addition & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ describe("Test Screenshots", function() {
return driver.quit();
}
console.info("Note: leaving browser open");
return null;
});

it("should find the add-on button", function() {
Expand Down

0 comments on commit ed632d6

Please sign in to comment.