Bug 1339559 - Enable no-mixed-operators ESLint rule r=kmag

MozReview-Commit-ID: LjuiizBh1OK

--HG--
extra : rebase_source : 0423cca6e47ed593ec79d56c96a16f63628b15d1
This commit is contained in:
Tomislav Jovanovic 2017-03-17 14:28:14 +01:00
parent 8dd875bed5
commit 6ec248d32c
7 changed files with 9 additions and 6 deletions

View File

@ -86,7 +86,7 @@ add_task(function* testExecuteScript() {
// If we have the earliest valid states for each script, we're done.
// Otherwise, try again.
success = (states[0] == "loading" || DEBUG &&
success = ((states[0] == "loading" || DEBUG) &&
states[1] == "interactive" &&
states[2] == "complete");
}

View File

@ -167,6 +167,9 @@ module.exports = { // eslint-disable-line no-undef
// No single if block inside an else block
"no-lonely-if": "warn",
// No mixing different operators without parens
"no-mixed-operators": ["error", {"groups": [["&&", "||"], ["==", "!=", "===", "!==", ">", ">=", "<", "<="], ["in", "instanceof"]]}],
// No mixing spaces and tabs in indent
"no-mixed-spaces-and-tabs": ["error", "smart-tabs"],

View File

@ -234,7 +234,7 @@ class BaseContext {
}
let message, fileName;
if (instanceOf(error, "Object") || error instanceof ExtensionError ||
typeof error == "object" && this.principal.subsumes(Cu.getObjectPrincipal(error))) {
(typeof error == "object" && this.principal.subsumes(Cu.getObjectPrincipal(error)))) {
message = error.message;
fileName = error.fileName;
} else {

View File

@ -14,7 +14,7 @@ function runtimeApiFactory(context) {
onMessageExternal: context.messenger.onMessageExternal("runtime.onMessageExternal"),
connect: function(extensionId, connectInfo) {
let name = connectInfo !== null && connectInfo.name || "";
let name = (connectInfo !== null && connectInfo.name) || "";
extensionId = extensionId || extension.id;
let recipient = {extensionId};

View File

@ -85,7 +85,7 @@ function background() {
let byteLength = parseInt(upload, 10);
if (byteLength) {
browser.test.assertTrue(!!requestBody.raw, `Binary upload ${details.url} #${details.requestId} ${upload} have a raw attribute`);
browser.test.assertEq(byteLength, requestBody.raw && requestBody.raw.map(r => r.bytes && r.bytes.byteLength || 0).reduce((a, b) => a + b), `Binary upload size matches`);
browser.test.assertEq(byteLength, requestBody.raw && requestBody.raw.map(r => r.bytes ? r.bytes.byteLength : 0).reduce((a, b) => a + b), `Binary upload size matches`);
return;
}
if ("raw" in requestBody) {

View File

@ -121,7 +121,7 @@ class KintoServer {
let body = JSON.parse(bodyStr);
let defaults = body.defaults;
for (let req of body.requests) {
let headers = Object.assign({}, defaults && defaults.headers || {}, req.headers);
let headers = Object.assign({}, (defaults && defaults.headers) || {}, req.headers);
// FIXME: assert auth is "Bearer ...token..."
this.posts.push(Object.assign({}, req, {headers}));
}

View File

@ -62,7 +62,7 @@ var RequestId = {
},
get(channel) {
return channel && getData(channel).requestId || this.create(channel);
return (channel && getData(channel).requestId) || this.create(channel);
},
};