Fix no-else-return eslint rule in ES5 files

[MAILPOET-1144]
This commit is contained in:
Pavel Dohnal
2017-11-29 15:04:38 +00:00
parent 3d2a433df1
commit 159e946093
9 changed files with 51 additions and 52 deletions

View File

@@ -41,7 +41,6 @@
"no-throw-literal": 0,
"no-extra-bind": 0,
"brace-style": 0,
"no-else-return": 0,
"no-use-before-define": 0,
"camelcase": 0,
"padded-blocks": 0,

View File

@@ -798,9 +798,9 @@ WysijaForm.Block = window.Class.create({
var block_placeholder = this.getBlockDroppable();
if (block_placeholder === null) {
return this.createBlockDroppable().hasClassName('enabled');
} else {
return block_placeholder.hasClassName('enabled');
}
return block_placeholder.hasClassName('enabled');
},
createBlockDroppable: function () {
info('block -> createBlockDroppable');
@@ -812,9 +812,9 @@ WysijaForm.Block = window.Class.create({
getBlockDroppable: function () {
if (this.element.previous() === undefined || this.element.previous().hasClassName('block_placeholder') === false) {
return null;
} else {
return this.element.previous();
}
return this.element.previous();
},
getControls: function () {
return this.element.down('.wysija_controls');

View File

@@ -25,12 +25,12 @@ define('handlebars_helpers', ['handlebars'], function (Handlebars) {
// check if we passed a timestamp
if (parseInt(timestamp, 10) == timestamp) {
return window.moment.unix(timestamp).format(f);
} else {
}
return window.moment.utc(timestamp).format(f);
}
} else {
return timestamp;
}
});
Handlebars.registerHelper('cycle', function (value, block) {
@@ -87,9 +87,9 @@ define('handlebars_helpers', ['handlebars'], function (Handlebars) {
var mailtoMatchingRegex = /^mailto\:/i;
if (typeof value === 'string' && value.match(mailtoMatchingRegex)) {
return value.replace(mailtoMatchingRegex, '');
} else {
return value;
}
return value;
});
Handlebars.registerHelper('lookup', function (obj, field) {
return obj && obj[field];
@@ -134,9 +134,9 @@ define('handlebars_helpers', ['handlebars'], function (Handlebars) {
}
if (sanitized.length > limit) {
return sanitized.substr(0, limit - strAppend.length) + strAppend;
} else {
return sanitized;
}
return sanitized;
});
Handlebars.registerHelper('getNumber', function (string) {

View File

@@ -111,9 +111,9 @@ define('modal', ['mailpoet', 'jquery'],
compileTemplate: function (template) {
if (this.renderer === 'html') {
return function () { return template; };
} else {
return window.Handlebars.compile(template);
}
return window.Handlebars.compile(template);
},
init: function (options) {
var modal;

View File

@@ -398,13 +398,13 @@ define([
index: index,
position: 'before'
};
} else {
}
// Second half of the element
return {
index: index,
position: 'after'
};
}
},
_computeSpecialIndex: function (eventX, eventY) {
return this._computeCellIndex(eventX, eventY);

View File

@@ -33,16 +33,16 @@ define([
Module.getBlockTypeModel = function (type) {
if (type in Module._blockTypes) {
return Module._blockTypes[type].blockModel;
} else {
throw 'Block type not supported: ' + type;
}
throw 'Block type not supported: ' + type;
};
Module.getBlockTypeView = function (type) {
if (type in Module._blockTypes) {
return Module._blockTypes[type].blockView;
} else {
throw 'Block type not supported: ' + type;
}
throw 'Block type not supported: ' + type;
};
Module.getBody = function () {

View File

@@ -115,9 +115,9 @@ define('notice', ['mailpoet', 'jquery'], function (mp, jQuery) {
formatMessage: function (message) {
if (Array.isArray(message)) {
return message.join('<br />');
} else {
return message;
}
return message;
},
show: function (options) {
// initialize

View File

@@ -35,7 +35,7 @@ function (
if (isSameDomain(window.MailPoetForm.ajax_url) === false) {
// non ajax post request
return true;
} else {
}
// ajax request
MailPoet.Ajax.post({
url: window.MailPoetForm.ajax_url,
@@ -77,7 +77,7 @@ function (
MailPoet.Iframe.autoSize(window.frameElement);
}
});
}
return false;
});
});

View File

@@ -729,9 +729,9 @@ define(
// if we're on the last line, show the total count of subscribers data
else if (index === (subscribers.subscribers.length - 1)) {
return subscribers.subscribersCount.toLocaleString();
} else {
return index + 1;
}
return index + 1;
});
// reduce subscribers object if the total length is greater than the