Fix eslint no-lonely-if in es5 files

[MAILPOET-1145]
This commit is contained in:
Pavel Dohnal
2018-02-19 15:54:19 +00:00
parent 704e4e40f7
commit 426a72c557
5 changed files with 22 additions and 36 deletions

View File

@ -33,7 +33,6 @@
"wrap-iife": 0, "wrap-iife": 0,
"no-plusplus": 0, "no-plusplus": 0,
"default-case": 0, "default-case": 0,
"no-lonely-if": 0,
"brace-style": 0, "brace-style": 0,
"space-infix-ops": 0 "space-infix-ops": 0
} }

View File

@ -155,16 +155,14 @@ define('date',
if (escapeToken === true) { if (escapeToken === true) {
convertedFormat.push('[' + token + ']'); convertedFormat.push('[' + token + ']');
escapeToken = false; escapeToken = false;
} else { } else if (token === '\\') {
if (token === '\\') {
// Slash escapes the next symbol to be treated as literal // Slash escapes the next symbol to be treated as literal
escapeToken = true; escapeToken = true;
continue; continue;
} else if (replacements[token] !== undefined) { } else if (replacements[token] !== undefined) {
convertedFormat.push(replacements[token]); convertedFormat.push(replacements[token]);
} else { } else {
convertedFormat.push('[' + token + ']'); convertedFormat.push('[' + token + ']');
}
} }
} }

View File

@ -582,11 +582,9 @@ WysijaForm = {
if (window.isRtl) { if (window.isRtl) {
if (WysijaForm.toolbar.left === null) WysijaForm.toolbar.left = 0; if (WysijaForm.toolbar.left === null) WysijaForm.toolbar.left = 0;
} else { } else if (WysijaForm.toolbar.left === null) {
if (WysijaForm.toolbar.left === null) { WysijaForm.toolbar.left =
WysijaForm.toolbar.left =
parseInt(window.$(WysijaForm.options.container).positionedOffset().left); parseInt(window.$(WysijaForm.options.container).positionedOffset().left);
}
} }
if (WysijaForm.toolbar.x === null) { if (WysijaForm.toolbar.x === null) {
WysijaForm.toolbar.x = WysijaForm.toolbar.x =

View File

@ -80,21 +80,16 @@ define(
: val; : val;
cur = cur[key]; cur = cur[key];
} }
} else if ($.isArray(obj[key])) {
// val is already an array, so push on the next value.
obj[key].push(val);
} else if (obj[key] !== undefined) {
// val isn't an array, but since a second value has been specified,
// convert val into an array.
obj[key] = [obj[key], val];
} else { } else {
// Simple key, even simpler rules, since only scalars and shallow // val is a scalar.
// arrays are allowed. obj[key] = val;
if ($.isArray(obj[key])) {
// val is already an array, so push on the next value.
obj[key].push(val);
} else if (obj[key] !== undefined) {
// val isn't an array, but since a second value has been specified,
// convert val into an array.
obj[key] = [obj[key], val];
} else {
// val is a scalar.
obj[key] = val;
}
} }
}); });

View File

@ -559,10 +559,8 @@ define('modal', ['mailpoet', 'jquery'],
.subpanels[(this.subpanels.length - 1)] .subpanels[(this.subpanels.length - 1)]
.onSuccess(this.subpanels[(this.subpanels.length - 1)].data); .onSuccess(this.subpanels[(this.subpanels.length - 1)].data);
} }
} else { } else if (this.options.onSuccess !== null) {
if (this.options.onSuccess !== null) { this.options.onSuccess(this.options.data);
this.options.onSuccess(this.options.data);
}
} }
this.close(); this.close();
@ -575,10 +573,8 @@ define('modal', ['mailpoet', 'jquery'],
.subpanels[(this.subpanels.length - 1)] .subpanels[(this.subpanels.length - 1)]
.onCancel(this.subpanels[(this.subpanels.length - 1)].data); .onCancel(this.subpanels[(this.subpanels.length - 1)].data);
} }
} else { } else if (this.options.onCancel !== null) {
if (this.options.onCancel !== null) { this.options.onCancel(this.options.data);
this.options.onCancel(this.options.data);
}
} }
this.close(); this.close();