mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-17 02:48:19 -07:00
Merge pull request #856 from thornbill/lint-licker
Add eslint:recommended to eslint config
This commit is contained in:
commit
e5a978feeb
@ -3,6 +3,52 @@ env:
|
||||
browser: true
|
||||
amd: true
|
||||
|
||||
globals:
|
||||
# New browser globals
|
||||
DataView: readonly
|
||||
MediaMetadata: readonly
|
||||
Promise: readonly
|
||||
# Deprecated browser globals
|
||||
DocumentTouch: readonly
|
||||
# Tizen globals
|
||||
tizen: readonly
|
||||
webapis: readonly
|
||||
# WebOS globals
|
||||
webOS: readonly
|
||||
# Dependency globals
|
||||
$: readonly
|
||||
jQuery: readonly
|
||||
queryString: readonly
|
||||
requirejs: readonly
|
||||
# Jellyfin globals
|
||||
ApiClient: writable
|
||||
AppInfo: writable
|
||||
chrome: writable
|
||||
ConnectionManager: writable
|
||||
DlnaProfilePage: writable
|
||||
Dashboard: writable
|
||||
DashboardPage: writable
|
||||
Emby: readonly
|
||||
Events: writable
|
||||
getParameterByName: writable
|
||||
getWindowLocationSearch: writable
|
||||
Globalize: writable
|
||||
Hls: writable
|
||||
humaneDate: writable
|
||||
humaneElapsed: writable
|
||||
LibraryMenu: writable
|
||||
LinkParser: writable
|
||||
LiveTvHelpers: writable
|
||||
MetadataEditor: writable
|
||||
pageClassOn: writable
|
||||
pageIdOn: writable
|
||||
PlaylistViewer: writable
|
||||
UserParentalControlPage: writable
|
||||
Windows: readonly
|
||||
|
||||
extends:
|
||||
- eslint:recommended
|
||||
|
||||
rules:
|
||||
block-spacing: ["error"]
|
||||
brace-style: ["error"]
|
||||
@ -11,17 +57,15 @@ rules:
|
||||
eol-last: ["error"]
|
||||
indent: ["error", 4, { "SwitchCase": 1 }]
|
||||
keyword-spacing: ["error"]
|
||||
line-comment-position: ["off"]
|
||||
max-statements-per-line: ["error"]
|
||||
no-empty: ["error"]
|
||||
no-extra-semi: ["error"]
|
||||
no-floating-decimal: ["error"]
|
||||
no-multi-spaces: ["error"]
|
||||
no-multiple-empty-lines: ["error", { "max": 1 }]
|
||||
no-trailing-spaces: ["error"]
|
||||
no-void: ["off"]
|
||||
one-var: ["error", "never"]
|
||||
padding-line-between-statements: ["off"]
|
||||
semi: ["off"]
|
||||
semi: ["warn"]
|
||||
space-before-blocks: ["error"]
|
||||
yoda: ["off"]
|
||||
# TODO: Fix warnings and remove these rules
|
||||
no-redeclare: ["warn"]
|
||||
no-unused-vars: ["warn"]
|
||||
no-useless-escape: ["warn"]
|
||||
|
@ -10,7 +10,7 @@ define(['dom', 'focusManager'], function (dom, focusManager) {
|
||||
if (e.ctrlKey) {
|
||||
return;
|
||||
}
|
||||
if (!!e.shiftKey) {
|
||||
if (e.shiftKey) {
|
||||
return;
|
||||
}
|
||||
if (e.altKey) {
|
||||
|
@ -324,7 +324,7 @@ define(["appSettings", "browser", "events", "htmlMediaHelper"], function (appSet
|
||||
* Ask user for exit
|
||||
*/
|
||||
function askForExit() {
|
||||
if (!!exitPromise) {
|
||||
if (exitPromise) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -140,7 +140,6 @@ define(['datetime', 'imageLoader', 'connectionManager', 'itemHelper', 'focusMana
|
||||
}
|
||||
return 100 / 72;
|
||||
}
|
||||
break;
|
||||
case 'overflowPortrait':
|
||||
|
||||
if (layoutManager.tv) {
|
||||
@ -166,7 +165,6 @@ define(['datetime', 'imageLoader', 'connectionManager', 'itemHelper', 'focusMana
|
||||
}
|
||||
return 100 / 42;
|
||||
}
|
||||
break;
|
||||
case 'overflowSquare':
|
||||
if (layoutManager.tv) {
|
||||
return 100 / 15.5;
|
||||
@ -191,7 +189,6 @@ define(['datetime', 'imageLoader', 'connectionManager', 'itemHelper', 'focusMana
|
||||
}
|
||||
return 100 / 42;
|
||||
}
|
||||
break;
|
||||
case 'overflowBackdrop':
|
||||
if (layoutManager.tv) {
|
||||
return 100 / 23.3;
|
||||
@ -216,7 +213,6 @@ define(['datetime', 'imageLoader', 'connectionManager', 'itemHelper', 'focusMana
|
||||
}
|
||||
return 100 / 72;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return 4;
|
||||
}
|
||||
@ -870,9 +866,10 @@ define(['datetime', 'imageLoader', 'connectionManager', 'itemHelper', 'focusMana
|
||||
|
||||
if (item.PremiereDate) {
|
||||
try {
|
||||
|
||||
lines.push(getPremiereDateText(item));
|
||||
|
||||
lines.push(datetime.toLocaleDateString(
|
||||
datetime.parseISO8601Date(item.PremiereDate),
|
||||
{ weekday: 'long', month: 'long', day: 'numeric' }
|
||||
));
|
||||
} catch (err) {
|
||||
lines.push('');
|
||||
|
||||
@ -1383,7 +1380,7 @@ define(['datetime', 'imageLoader', 'connectionManager', 'itemHelper', 'focusMana
|
||||
}
|
||||
|
||||
if (item.Type === 'CollectionFolder' || item.CollectionType) {
|
||||
var refreshClass = item.RefreshProgress || (item.RefreshStatus && virtualFolder.item !== 'Idle') ? '' : ' class="hide"';
|
||||
var refreshClass = item.RefreshProgress ? '' : ' class="hide"';
|
||||
indicatorsHtml += '<div is="emby-itemrefreshindicator"' + refreshClass + ' data-progress="' + (item.RefreshProgress || 0) + '" data-status="' + item.RefreshStatus + '"></div>';
|
||||
requireRefreshIndicator();
|
||||
}
|
||||
|
@ -131,8 +131,9 @@ define(['events'], function (events) {
|
||||
var links = [];
|
||||
var match;
|
||||
|
||||
// eslint-disable-next-line no-cond-assign
|
||||
while (match = linkRegExp.exec(text)) {
|
||||
console.debug(matches);
|
||||
console.debug(match);
|
||||
var txt = match[0];
|
||||
var pos = match.index;
|
||||
var len = txt.length;
|
||||
|
@ -63,6 +63,7 @@ define([], function () {
|
||||
var supportsCaptureOption = false;
|
||||
try {
|
||||
var opts = Object.defineProperty({}, 'capture', {
|
||||
// eslint-disable-next-line getter-return
|
||||
get: function () {
|
||||
supportsCaptureOption = true;
|
||||
}
|
||||
|
@ -89,20 +89,6 @@ define(['dialogHelper', 'globalize', 'userSettings', 'layoutManager', 'connectio
|
||||
}
|
||||
}
|
||||
|
||||
function onSortByChange() {
|
||||
var newValue = this.value;
|
||||
if (this.checked) {
|
||||
var changed = options.query.SortBy !== newValue;
|
||||
|
||||
options.query.SortBy = newValue.replace('_', ',');
|
||||
options.query.StartIndex = 0;
|
||||
|
||||
if (options.callback && changed) {
|
||||
options.callback();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function showEditor(options) {
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
@ -1,5 +1,6 @@
|
||||
define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackManager', 'appRouter', 'appSettings', 'connectionManager', 'htmlMediaHelper', 'itemHelper', 'fullscreenManager', 'globalize'], function (browser, require, events, appHost, loading, dom, playbackManager, appRouter, appSettings, connectionManager, htmlMediaHelper, itemHelper, fullscreenManager, globalize) {
|
||||
"use strict";
|
||||
/* globals cast */
|
||||
|
||||
var mediaManager;
|
||||
|
||||
@ -357,6 +358,7 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
require(['shaka'], function () {
|
||||
/* globals shaka */
|
||||
|
||||
var player = new shaka.Player(elem);
|
||||
|
||||
@ -739,10 +741,6 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
||||
elemAudioTracks[i].enabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
setTimeout(function () {
|
||||
elem.currentTime = elem.currentTime;
|
||||
}, 100);
|
||||
};
|
||||
|
||||
self.stop = function (destroyPlayer) {
|
||||
@ -1349,38 +1347,6 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
||||
}
|
||||
}
|
||||
|
||||
function updateTextStreamUrls(startPositionTicks) {
|
||||
|
||||
if (!supportsTextTracks()) {
|
||||
return;
|
||||
}
|
||||
|
||||
var allTracks = self._mediaElement.textTracks; // get list of tracks
|
||||
var i;
|
||||
var track;
|
||||
|
||||
for (i = 0; i < allTracks.length; i++) {
|
||||
|
||||
track = allTracks[i];
|
||||
|
||||
// This throws an error in IE, but is fine in chrome
|
||||
// In IE it's not necessary anyway because changing the src seems to be enough
|
||||
try {
|
||||
while (track.cues.length) {
|
||||
track.removeCue(track.cues[0]);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('error removing cue from textTrack');
|
||||
}
|
||||
}
|
||||
|
||||
var tracks = self._mediaElement.querySelectorAll('track');
|
||||
for (i = 0; i < tracks.length; i++) {
|
||||
track = tracks[i];
|
||||
track.src = replaceQueryString(track.src, 'startPositionTicks', startPositionTicks);
|
||||
}
|
||||
}
|
||||
|
||||
function createMediaElement(options) {
|
||||
|
||||
if (browser.tv || browser.iOS || browser.mobile) {
|
||||
@ -1652,9 +1618,13 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
||||
if (document.AirPlayEnabled) {
|
||||
if (video) {
|
||||
if (isEnabled) {
|
||||
video.requestAirPlay().catch(onAirPlayError);
|
||||
video.requestAirPlay().catch(function(err) {
|
||||
console.error("Error requesting AirPlay", err)
|
||||
});
|
||||
} else {
|
||||
document.exitAirPLay().catch(onAirPlayError);
|
||||
document.exitAirPLay().catch(function(err) {
|
||||
console.error("Error exiting AirPlay", err)
|
||||
});
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -25,6 +25,7 @@ define(["datetime"], function (datetime) {
|
||||
if (seconds < 0) {
|
||||
seconds = Math.abs(seconds);
|
||||
}
|
||||
// eslint-disable-next-line no-cond-assign
|
||||
for (; format = time_formats[i++];) {
|
||||
if (seconds < format[0]) {
|
||||
if (2 == format.length) {
|
||||
|
@ -463,7 +463,7 @@ define(["globalize", "dom", "emby-checkbox", "emby-select", "emby-input"], funct
|
||||
|
||||
if (!typeOptions) {
|
||||
typeOptions = {
|
||||
Type: type
|
||||
Type: originalTypeOption.Type
|
||||
};
|
||||
options.TypeOptions.push(typeOptions);
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ if (HTMLElement.prototype.nativeFocus === undefined) {
|
||||
}, true);
|
||||
|
||||
var opts = Object.defineProperty({}, "preventScroll", {
|
||||
// eslint-disable-next-line getter-return
|
||||
get: function () {
|
||||
supportsPreventScrollOption = true;
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ if (typeof Object.assign != 'function') {
|
||||
var source = arguments[index];
|
||||
if (source !== undefined && source !== null) {
|
||||
for (var nextKey in source) {
|
||||
// eslint-disable-next-line no-prototype-builtins
|
||||
if (source.hasOwnProperty(nextKey)) {
|
||||
output[nextKey] = source[nextKey];
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ define([], function () {
|
||||
'use strict';
|
||||
|
||||
var illegalRe = /[\/\?<>\\:\*\|":]/g;
|
||||
// eslint-disable-next-line no-control-regex
|
||||
var controlRe = /[\x00-\x1f\x80-\x9f]/g;
|
||||
var reservedRe = /^\.+$/;
|
||||
var windowsReservedRe = /^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i;
|
||||
|
@ -33,6 +33,7 @@ define(["dom", "browser", "layoutManager"], function (dom, browser, layoutManage
|
||||
var elem = document.createElement("div");
|
||||
|
||||
var opts = Object.defineProperty({}, "behavior", {
|
||||
// eslint-disable-next-line getter-return
|
||||
get: function () {
|
||||
supportsScrollToOptions = true;
|
||||
}
|
||||
|
@ -1,3 +1,4 @@
|
||||
/* eslint-env serviceworker */
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
|
@ -162,6 +162,7 @@ define(['apphost', 'userSettings', 'browser', 'events', 'pluginManager', 'backdr
|
||||
function playSound(path, volume) {
|
||||
lastSound = new Date().getTime();
|
||||
require(['howler'], function (howler) {
|
||||
/* globals Howl */
|
||||
try {
|
||||
var sound = new Howl({
|
||||
src: [path],
|
||||
|
@ -130,7 +130,7 @@ define(['playbackManager', 'text!./subtitlesync.template.html', 'css!./subtitles
|
||||
SubtitleSync.prototype.toggle = function(action) {
|
||||
|
||||
if (player && playbackManager.supportSubtitleOffset(player)) {
|
||||
|
||||
/* eslint-disable no-fallthrough */
|
||||
switch (action) {
|
||||
case undefined:
|
||||
// if showing subtitle sync is enabled
|
||||
@ -157,7 +157,7 @@ define(['playbackManager', 'text!./subtitlesync.template.html', 'css!./subtitles
|
||||
subtitleSyncContainer.classList.add("hide");
|
||||
break;
|
||||
}
|
||||
|
||||
/* eslint-enable no-fallthrough */
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
define(["dialogHelper", "dom", "layoutManager", "connectionManager", "globalize", "loading", "browser", "material-icons", "formDialogStyle", "emby-button", "emby-itemscontainer", "cardStyle"], function (dialogHelper, dom, layoutManager, connectionManager, globalize, loading, browser) {
|
||||
define(["dialogHelper", "dom", "layoutManager", "connectionManager", "globalize", "loading", "browser", "focusManager", "scrollHelper", "material-icons", "formDialogStyle", "emby-button", "emby-itemscontainer", "cardStyle"], function (dialogHelper, dom, layoutManager, connectionManager, globalize, loading, browser, focusManager, scrollHelper) {
|
||||
"use strict";
|
||||
|
||||
var enableFocusTransform = !browser.slow && !browser.edge;
|
||||
@ -152,14 +152,14 @@ define(["dialogHelper", "dom", "layoutManager", "connectionManager", "globalize"
|
||||
});
|
||||
|
||||
if (layoutManager.tv) {
|
||||
centerFocus(dlg.querySelector(".formDialogContent"), false, true);
|
||||
scrollHelper.centerFocus.on(dlg.querySelector(".formDialogContent"), false);
|
||||
}
|
||||
|
||||
var apiClient = connectionManager.getApiClient(options.serverId);
|
||||
discoverDevices(dlg, apiClient);
|
||||
|
||||
if (layoutManager.tv) {
|
||||
centerFocus(dlg.querySelector(".formDialogContent"), false, false);
|
||||
scrollHelper.centerFocus.off(dlg.querySelector(".formDialogContent"), false);
|
||||
}
|
||||
|
||||
return dialogHelper.open(dlg).then(function () {
|
||||
|
@ -1,5 +1,6 @@
|
||||
define(['require', 'events', 'browser', 'appRouter', 'loading'], function (require, events, browser, appRouter, loading) {
|
||||
"use strict";
|
||||
/* globals YT */
|
||||
|
||||
function zoomIn(elem, iterations) {
|
||||
var keyframes = [
|
||||
|
@ -741,21 +741,15 @@ define(["datetime", "events", "itemHelper", "serverNotifications", "dom", "globa
|
||||
};
|
||||
return function (view, params) {
|
||||
function onRestartRequired(evt, apiClient) {
|
||||
if (apiClient.serverId() === serverId) {
|
||||
renderHasPendingRestart(view, apiClient, true);
|
||||
}
|
||||
console.debug('onRestartRequired not implemented', evt, apiClient);
|
||||
}
|
||||
|
||||
function onServerShuttingDown(evt, apiClient) {
|
||||
if (apiClient.serverId() === serverId) {
|
||||
renderHasPendingRestart(view, apiClient, true);
|
||||
}
|
||||
console.debug('onServerShuttingDown not implemented', evt, apiClient);
|
||||
}
|
||||
|
||||
function onServerRestarting(evt, apiClient) {
|
||||
if (apiClient.serverId() === serverId) {
|
||||
renderHasPendingRestart(view, apiClient, true);
|
||||
}
|
||||
console.debug('onServerRestarting not implemented', evt, apiClient);
|
||||
}
|
||||
|
||||
function onPackageInstalling(evt, apiClient) {
|
||||
|
@ -58,7 +58,7 @@ define(["jQuery", "loading", "fnchecked", "emby-checkbox", "emby-textarea", "emb
|
||||
});
|
||||
}, function () {
|
||||
require(["alert"], function (alert) {
|
||||
alert(globalize.translate("DefaultErrorMessage"));
|
||||
alert(Globalize.translate("DefaultErrorMessage"));
|
||||
});
|
||||
|
||||
Dashboard.processServerConfigurationUpdateResult();
|
||||
|
@ -647,7 +647,7 @@ define(["loading", "appRouter", "layoutManager", "connectionManager", "cardBuild
|
||||
function setTitle(item, apiClient) {
|
||||
var url = logoImageUrl(item, apiClient, {});
|
||||
|
||||
if (url = null) {
|
||||
if (url != null) {
|
||||
var pageTitle = document.querySelector(".pageTitle");
|
||||
pageTitle.style.backgroundImage = "url('" + url + "')";
|
||||
pageTitle.classList.add("pageTitleWithLogo");
|
||||
@ -1661,7 +1661,7 @@ define(["loading", "appRouter", "layoutManager", "connectionManager", "cardBuild
|
||||
function canPlaySomeItemInCollection(items) {
|
||||
var i = 0;
|
||||
|
||||
for (length = items.length; i < length; i++) {
|
||||
for (var length = items.length; i < length; i++) {
|
||||
if (playbackManager.canPlay(items[i])) {
|
||||
return true;
|
||||
}
|
||||
|
@ -92,7 +92,7 @@ define(['browser'], function (browser) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!!videoTestElement.canPlayType) {
|
||||
if (videoTestElement.canPlayType) {
|
||||
return videoTestElement.canPlayType('application/x-mpegurl; codecs="avc1.42E01E, ac-3"').replace(/no/, '') ||
|
||||
videoTestElement.canPlayType('application/vnd.apple.mpegURL; codecs="avc1.42E01E, ac-3"').replace(/no/, '');
|
||||
}
|
||||
|
@ -1,30 +0,0 @@
|
||||
define(["jQuery", "loading", "libraryMenu"], function ($, loading, libraryMenu) {
|
||||
"use strict";
|
||||
|
||||
function loadUser(page, user) {
|
||||
libraryMenu.setTitle(user.Name);
|
||||
|
||||
if ("Guest" == user.ConnectLinkType) {
|
||||
$(".connectMessage", page).show();
|
||||
} else {
|
||||
$(".connectMessage", page).hide();
|
||||
}
|
||||
|
||||
loading.hide();
|
||||
}
|
||||
|
||||
function loadData(page) {
|
||||
loading.show();
|
||||
var userId = getParameterByName("userId");
|
||||
ApiClient.getUser(userId).then(function (user) {
|
||||
loadUser(page, user);
|
||||
});
|
||||
}
|
||||
|
||||
$(document).on("pageinit", "#userPasswordPage", function () {
|
||||
$(".adminUpdatePasswordForm").off("submit", UpdatePasswordPage.onSubmit).on("submit", UpdatePasswordPage.onSubmit);
|
||||
$(".adminLocalAccessForm").off("submit", UpdatePasswordPage.onLocalAccessSubmit).on("submit", UpdatePasswordPage.onLocalAccessSubmit);
|
||||
}).on("pagebeforeshow", "#userPasswordPage", function () {
|
||||
loadData(this);
|
||||
});
|
||||
});
|
@ -1 +1,2 @@
|
||||
/* eslint-env serviceworker */
|
||||
importScripts("components/serviceworker/notifications.js");
|
||||
|
Loading…
Reference in New Issue
Block a user