diff --git a/.eslintrc.js b/.eslintrc.js
index d9080d1ac4..765db89daa 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -28,7 +28,7 @@ module.exports = {
],
rules: {
'block-spacing': ['error'],
- 'brace-style': ['error'],
+ 'brace-style': ['error', "1tbs", { "allowSingleLine": true }],
'comma-dangle': ['error', 'never'],
'comma-spacing': ['error'],
'eol-last': ['error'],
@@ -42,6 +42,7 @@ module.exports = {
'no-unused-expressions': ['error', { 'allowShortCircuit': true, 'allowTernary': true, 'allowTaggedTemplates': true }],
"no-unused-vars": ["error", { "vars": "all", "args": "none", "ignoreRestSiblings": true }],
'one-var': ['error', 'never'],
+ 'padded-blocks': ['error', 'never'],
'quotes': ['error', 'single', { 'avoidEscape': true, 'allowTemplateLiterals': false }],
'semi': ['error'],
'space-before-blocks': ['error'],
diff --git a/src/components/actionSheet/actionSheet.js b/src/components/actionSheet/actionSheet.js
index 3f772250e1..937cd2afe5 100644
--- a/src/components/actionSheet/actionSheet.js
+++ b/src/components/actionSheet/actionSheet.js
@@ -9,7 +9,6 @@ import 'scrollStyles';
import 'listViewStyle';
function getOffsets(elems) {
-
let results = [];
if (!document) {
@@ -31,7 +30,6 @@ function getOffsets(elems) {
}
function getPosition(options, dlg) {
-
const windowSize = dom.getWindowSize();
const windowHeight = windowSize.innerHeight;
const windowWidth = windowSize.innerWidth;
@@ -80,7 +78,6 @@ function centerFocus(elem, horiz, on) {
}
export function show(options) {
-
// items
// positionTo
// showCancel
@@ -98,7 +95,6 @@ export function show(options) {
isFullscreen = true;
dialogOptions.autoFocus = true;
} else {
-
dialogOptions.modal = false;
dialogOptions.entryAnimation = options.entryAnimation;
dialogOptions.exitAnimation = options.exitAnimation;
@@ -136,7 +132,6 @@ export function show(options) {
let icons = [];
let itemIcon;
for (const item of options.items) {
-
itemIcon = item.icon || (item.selected ? 'check' : null);
if (itemIcon) {
@@ -161,7 +156,6 @@ export function show(options) {
}
if (options.title) {
-
html += '
' + options.title + '
';
}
if (options.text) {
@@ -197,7 +191,6 @@ export function show(options) {
const item = options.items[i];
if (item.divider) {
-
html += '';
continue;
}
@@ -265,26 +258,20 @@ export function show(options) {
}
return new Promise(function (resolve, reject) {
-
let isResolved;
dlg.addEventListener('click', function (e) {
-
const actionSheetMenuItem = dom.parentWithClass(e.target, 'actionSheetMenuItem');
if (actionSheetMenuItem) {
selectedId = actionSheetMenuItem.getAttribute('data-id');
if (options.resolveOnClick) {
-
if (options.resolveOnClick.indexOf) {
-
if (options.resolveOnClick.indexOf(selectedId) !== -1) {
-
resolve(selectedId);
isResolved = true;
}
-
} else {
resolve(selectedId);
isResolved = true;
@@ -293,11 +280,9 @@ export function show(options) {
dialogHelper.close(dlg);
}
-
});
dlg.addEventListener('close', function () {
-
if (layoutManager.tv) {
centerFocus(dlg.querySelector('.actionSheetScroller'), false, false);
}
diff --git a/src/components/alert.js b/src/components/alert.js
index 5d396e3a62..1420c7f428 100644
--- a/src/components/alert.js
+++ b/src/components/alert.js
@@ -10,7 +10,6 @@ import globalize from 'globalize';
}
export default function (text, title) {
-
let options;
if (typeof text === 'string') {
options = {
diff --git a/src/components/alphaPicker/alphaPicker.js b/src/components/alphaPicker/alphaPicker.js
index 4bc8af56f0..95b5881677 100644
--- a/src/components/alphaPicker/alphaPicker.js
+++ b/src/components/alphaPicker/alphaPicker.js
@@ -26,7 +26,6 @@ import 'material-icons';
}
function getAlphaPickerButtonClassName(vertical) {
-
let alphaPickerButtonClassName = 'alphaPickerButton';
if (layoutManager.tv) {
@@ -45,14 +44,12 @@ import 'material-icons';
}
function mapLetters(letters, vertical) {
-
return letters.map(l => {
return getLetterButton(l, vertical);
});
}
function render(element, options) {
-
element.classList.add('alphaPicker');
if (layoutManager.tv) {
@@ -137,7 +134,6 @@ import 'material-icons';
}
function onAlphaPickerInKeyboardModeClick(e) {
-
const alphaPickerButton = dom.parentWithClass(e.target, 'alphaPickerButton');
if (alphaPickerButton) {
@@ -153,7 +149,6 @@ import 'material-icons';
}
function onAlphaPickerClick(e) {
-
const alphaPickerButton = dom.parentWithClass(e.target, 'alphaPickerButton');
if (alphaPickerButton) {
@@ -167,7 +162,6 @@ import 'material-icons';
}
function onAlphaPickerFocusIn(e) {
-
if (alphaFocusTimeout) {
clearTimeout(alphaFocusTimeout);
alphaFocusTimeout = null;
@@ -182,13 +176,11 @@ import 'material-icons';
}
function onItemsFocusIn(e) {
-
const item = dom.parentWithClass(e.target, itemClass);
if (item) {
const prefix = item.getAttribute('data-prefix');
if (prefix && prefix.length) {
-
itemFocusValue = prefix[0];
if (itemFocusTimeout) {
clearTimeout(itemFocusTimeout);
@@ -199,9 +191,7 @@ import 'material-icons';
}
this.enabled = function (enabled) {
-
if (enabled) {
-
if (itemsContainer) {
itemsContainer.addEventListener('focus', onItemsFocusIn, true);
}
@@ -215,9 +205,7 @@ import 'material-icons';
} else {
element.addEventListener('click', onAlphaPickerClick.bind(this));
}
-
} else {
-
if (itemsContainer) {
itemsContainer.removeEventListener('focus', onItemsFocusIn, true);
}
@@ -235,14 +223,12 @@ import 'material-icons';
}
value(value, applyValue) {
-
const element = this.options.element;
let btn;
let selected;
if (value !== undefined) {
if (value != null) {
-
value = value.toUpperCase();
this._currentValue = value;
@@ -295,33 +281,27 @@ import 'material-icons';
}
visible(visible) {
-
const element = this.options.element;
element.style.visibility = visible ? 'visible' : 'hidden';
}
values() {
-
const element = this.options.element;
const elems = element.querySelectorAll('.alphaPickerButton');
const values = [];
for (let i = 0, length = elems.length; i < length; i++) {
-
values.push(elems[i].getAttribute('data-value'));
-
}
return values;
}
focus() {
-
const element = this.options.element;
focusManager.autoFocus(element, true);
}
destroy() {
-
const element = this.options.element;
this.enabled(false);
element.classList.remove('focuscontainer-x');
diff --git a/src/components/appRouter.js b/src/components/appRouter.js
index a86c585759..138d58e5c0 100644
--- a/src/components/appRouter.js
+++ b/src/components/appRouter.js
@@ -161,7 +161,6 @@ define(['loading', 'globalize', 'events', 'viewManager', 'skinManager', 'backdro
route: route,
path: ctx.path
};
-
}).catch(function (result) {
if (!result || !result.cancelled) {
onNewViewNeeded();
@@ -192,12 +191,10 @@ define(['loading', 'globalize', 'events', 'viewManager', 'skinManager', 'backdro
}
function onRequestFail(e, data) {
-
var apiClient = this;
if (data.status === 403) {
if (data.errorCode === 'ParentalControl') {
-
var isCurrentAllowed = currentRouteInfo ? (currentRouteInfo.route.anonymous || currentRouteInfo.route.startup) : true;
// Bounce to the login screen, but not if a password entry fails, obviously
@@ -205,7 +202,6 @@ define(['loading', 'globalize', 'events', 'viewManager', 'skinManager', 'backdro
showForcedLogoutMessage(globalize.translate('AccessRestrictedTryAgainLater'));
appRouter.showLocalLogin(apiClient.serverId());
}
-
}
}
}
@@ -232,7 +228,6 @@ define(['loading', 'globalize', 'events', 'viewManager', 'skinManager', 'backdro
if (navigator.connection) {
var max = navigator.connection.downlinkMax;
if (max && max > 0 && max < Number.POSITIVE_INFINITY) {
-
max /= 8;
max *= 1000000;
max *= 0.7;
@@ -250,7 +245,6 @@ define(['loading', 'globalize', 'events', 'viewManager', 'skinManager', 'backdro
}
function onApiClientCreated(e, newApiClient) {
-
newApiClient.normalizeImageOptions = normalizeImageOptions;
if (browser.iOS) {
@@ -264,12 +258,10 @@ define(['loading', 'globalize', 'events', 'viewManager', 'skinManager', 'backdro
}
function initApiClient(apiClient) {
-
onApiClientCreated({}, apiClient);
}
function initApiClients() {
-
connectionManager.getApiClients().forEach(initApiClient);
events.on(connectionManager, 'apiclientcreated', onApiClientCreated);
@@ -285,7 +277,6 @@ define(['loading', 'globalize', 'events', 'viewManager', 'skinManager', 'backdro
var firstConnectionResult;
function start(options) {
-
loading.show();
initApiClients();
@@ -297,7 +288,6 @@ define(['loading', 'globalize', 'events', 'viewManager', 'skinManager', 'backdro
enableAutoLogin: appSettings.enableAutoLogin()
}).then(function (result) {
-
firstConnectionResult = result;
options = options || {};
@@ -316,14 +306,11 @@ define(['loading', 'globalize', 'events', 'viewManager', 'skinManager', 'backdro
}
function authenticate(ctx, route, callback) {
-
var firstResult = firstConnectionResult;
if (firstResult) {
-
firstConnectionResult = null;
if (firstResult.State !== 'SignedIn' && !route.anonymous) {
-
handleConnectionResult(firstResult);
return;
}
@@ -352,7 +339,6 @@ define(['loading', 'globalize', 'events', 'viewManager', 'skinManager', 'backdro
}
if (apiClient && apiClient.isLoggedIn()) {
-
console.debug('appRouter - user is authenticated');
if (route.isDefaultRoute) {
@@ -360,11 +346,8 @@ define(['loading', 'globalize', 'events', 'viewManager', 'skinManager', 'backdro
loadUserSkinWithOptions(ctx);
return;
} else if (route.roles) {
-
validateRoles(apiClient, route.roles).then(function () {
-
callback();
-
}, beginConnectionWizard);
return;
}
@@ -406,7 +389,6 @@ define(['loading', 'globalize', 'events', 'viewManager', 'skinManager', 'backdro
var isDummyBackToHome;
function loadContent(ctx, route, html, request) {
-
html = globalize.translateHtml(html, route.dictionary);
request.view = html;
@@ -466,7 +448,6 @@ define(['loading', 'globalize', 'events', 'viewManager', 'skinManager', 'backdro
}
function getWindowLocationSearch(win) {
-
var currentPath = currentRouteInfo ? (currentRouteInfo.path || '') : '';
var index = currentPath.indexOf('?');
@@ -617,7 +598,6 @@ define(['loading', 'globalize', 'events', 'viewManager', 'skinManager', 'backdro
function pushState(state, title, url) {
state.navigate = false;
history.pushState(state, title, url);
-
}
function setBaseRoute() {
diff --git a/src/components/cardbuilder/cardBuilder.js b/src/components/cardbuilder/cardBuilder.js
index 4c64c5e06b..edb9db28ba 100644
--- a/src/components/cardbuilder/cardBuilder.js
+++ b/src/components/cardbuilder/cardBuilder.js
@@ -291,12 +291,10 @@ import 'programStyles';
const primaryImageAspectRatio = imageLoader.getPrimaryImageAspectRatio(items);
if (['auto', 'autohome', 'autooverflow', 'autoVertical'].includes(options.shape)) {
-
const requestedShape = options.shape;
options.shape = null;
if (primaryImageAspectRatio) {
-
if (primaryImageAspectRatio >= 3) {
options.shape = 'banner';
options.coverImage = true;
@@ -394,7 +392,6 @@ import 'programStyles';
}
if (newIndexValue !== currentIndexValue) {
-
if (hasOpenRow) {
html += '';
hasOpenRow = false;
@@ -402,7 +399,6 @@ import 'programStyles';
}
if (hasOpenSection) {
-
html += '';
if (isVertical) {
@@ -426,7 +422,6 @@ import 'programStyles';
}
if (options.rows && itemsInRow === 0) {
-
if (hasOpenRow) {
html += '';
hasOpenRow = false;
@@ -686,7 +681,6 @@ import 'programStyles';
let valid = 0;
for (let i = 0; i < lines.length; i++) {
-
let currentCssClass = cssClass;
let text = lines[i];
@@ -713,7 +707,6 @@ import 'programStyles';
}
if (forceLines) {
-
let linesLength = maxLines || Math.min(lines.length, maxLines || lines.length);
while (valid < linesLength) {
@@ -745,7 +738,6 @@ import 'programStyles';
let airTimeText = '';
if (item.StartDate) {
-
try {
let date = datetime.parseISO8601Date(item.StartDate);
@@ -792,7 +784,6 @@ import 'programStyles';
const showOtherText = isOuterFooter ? !overlayText : overlayText;
if (isOuterFooter && options.cardLayout && layoutManager.mobile) {
-
if (options.cardFooterAside !== 'none') {
html += '';
}
@@ -807,9 +798,7 @@ import 'programStyles';
if (showOtherText) {
if ((options.showParentTitle || options.showParentTitleOrTitle) && !parentTitleUnderneath) {
-
if (isOuterFooter && item.Type === 'Episode' && item.SeriesName) {
-
if (item.SeriesId) {
lines.push(getTextActionButton({
Id: item.SeriesId,
@@ -822,15 +811,12 @@ import 'programStyles';
lines.push(item.SeriesName);
}
} else {
-
if (isUsingLiveTvNaming(item)) {
-
lines.push(item.Name);
if (!item.EpisodeTitle) {
titleAdded = true;
}
-
} else {
const parentTitle = item.SeriesName || item.Series || item.Album || item.AlbumArtist || '';
@@ -848,7 +834,6 @@ import 'programStyles';
}
if (showMediaTitle) {
-
const name = options.showTitle === 'auto' && !item.IsFolder && item.MediaType === 'Photo' ? '' : itemHelper.getDisplayName(item, {
includeParentInfo: options.includeParentInfoInTitle
});
@@ -865,7 +850,6 @@ import 'programStyles';
if (showOtherText) {
if (options.showParentTitle && parentTitleUnderneath) {
-
if (isOuterFooter && item.AlbumArtists && item.AlbumArtists.length) {
item.AlbumArtists[0].Type = 'MusicArtist';
item.AlbumArtists[0].IsFolder = true;
@@ -899,7 +883,6 @@ import 'programStyles';
}
if (options.showPremiereDate) {
-
if (item.PremiereDate) {
try {
lines.push(datetime.toLocaleDateString(
@@ -908,7 +891,6 @@ import 'programStyles';
));
} catch (err) {
lines.push('');
-
}
} else {
lines.push('');
@@ -916,14 +898,10 @@ import 'programStyles';
}
if (options.showYear || options.showSeriesYear) {
-
if (item.Type === 'Series') {
if (item.Status === 'Continuing') {
-
lines.push(globalize.translate('SeriesYearToPresent', item.ProductionYear || ''));
-
} else {
-
if (item.EndDate && item.ProductionYear) {
const endYear = datetime.parseISO8601Date(item.EndDate).getFullYear();
lines.push(item.ProductionYear + ((endYear === item.ProductionYear) ? '' : (' - ' + endYear)));
@@ -937,9 +915,7 @@ import 'programStyles';
}
if (options.showRuntime) {
-
if (item.RunTimeTicks) {
-
lines.push(datetime.getDisplayRunningTime(item.RunTimeTicks));
} else {
lines.push('');
@@ -947,14 +923,11 @@ import 'programStyles';
}
if (options.showAirTime) {
-
lines.push(getAirTimeText(item, options.showAirDateTime, options.showAirEndTime) || '');
}
if (options.showChannelName) {
-
if (item.ChannelId) {
-
lines.push(getTextActionButton({
Id: item.ChannelId,
@@ -971,7 +944,6 @@ import 'programStyles';
}
if (options.showCurrentProgram && item.Type === 'TvChannel') {
-
if (item.CurrentProgram) {
lines.push(item.CurrentProgram.Name);
} else {
@@ -980,7 +952,6 @@ import 'programStyles';
}
if (options.showCurrentProgramTime && item.Type === 'TvChannel') {
-
if (item.CurrentProgram) {
lines.push(getAirTimeText(item.CurrentProgram, false, true) || '');
} else {
@@ -990,7 +961,6 @@ import 'programStyles';
if (options.showSeriesTimerTime) {
if (item.RecordAnyTime) {
-
lines.push(globalize.translate('Anytime'));
} else {
lines.push(datetime.getDisplayTime(item.StartDate));
@@ -1025,7 +995,6 @@ import 'programStyles';
}
if (html) {
-
if (!isOuterFooter || logoUrl || options.cardLayout) {
html = '