diff --git a/.eslintrc.js b/.eslintrc.js index 5f8cce7e5d..3928729cb4 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -35,9 +35,15 @@ module.exports = { 'indent': ['error', 4, { 'SwitchCase': 1 }], 'jsx-quotes': ['error', 'prefer-single'], 'keyword-spacing': ['error'], - 'no-throw-literal': ['error'], 'max-statements-per-line': ['error'], 'max-params': ['error', 7], + 'new-cap': [ + 'error', + { + 'capIsNewExceptions': ['jQuery.Deferred'], + 'newIsCapExceptionPattern': '\\.default$' + } + ], 'no-duplicate-imports': ['error'], 'no-empty-function': ['error'], 'no-floating-decimal': ['error'], @@ -52,6 +58,7 @@ module.exports = { 'no-sequences': ['error', { 'allowInParentheses': false }], 'no-shadow': ['off'], '@typescript-eslint/no-shadow': ['error'], + 'no-throw-literal': ['error'], 'no-trailing-spaces': ['error'], 'no-unused-expressions': ['off'], '@typescript-eslint/no-unused-expressions': ['error', { 'allowShortCircuit': true, 'allowTernary': true, 'allowTaggedTemplates': true }], diff --git a/src/apps/experimental/routes/home.tsx b/src/apps/experimental/routes/home.tsx index bf52b82137..3ab9c8bed7 100644 --- a/src/apps/experimental/routes/home.tsx +++ b/src/apps/experimental/routes/home.tsx @@ -65,12 +65,12 @@ const Home: FunctionComponent = () => { depends = 'favorites'; } - return import(/* webpackChunkName: "[request]" */ `../../../controllers/${depends}`).then(({ default: controllerFactory }) => { + return import(/* webpackChunkName: "[request]" */ `../../../controllers/${depends}`).then(({ default: ControllerFactory }) => { let controller = tabControllers[index]; if (!controller) { const tabContent = element.current?.querySelector(".tabContent[data-index='" + index + "']"); - controller = new controllerFactory(tabContent, null); + controller = new ControllerFactory(tabContent, null); tabControllers[index] = controller; } diff --git a/src/components/appFooter/appFooter.js b/src/components/appFooter/appFooter.js index 3aaab8fe54..f599a0e0ea 100644 --- a/src/components/appFooter/appFooter.js +++ b/src/components/appFooter/appFooter.js @@ -9,7 +9,7 @@ function render() { return elem; } -class appFooter { +class AppFooter { constructor() { const self = this; @@ -33,4 +33,4 @@ class appFooter { } } -export default new appFooter(); +export default new AppFooter(); diff --git a/src/components/channelMapper/channelMapper.js b/src/components/channelMapper/channelMapper.js index 819fbfc3e6..a513d4ac03 100644 --- a/src/components/channelMapper/channelMapper.js +++ b/src/components/channelMapper/channelMapper.js @@ -12,7 +12,7 @@ import 'material-design-icons-iconfont'; import '../formdialog.scss'; import ServerConnections from '../ServerConnections'; -export default class channelMapper { +export default class ChannelMapper { constructor(options) { function mapChannel(button, channelId, providerChannelId) { loading.show(); diff --git a/src/components/itemContextMenu.js b/src/components/itemContextMenu.js index b96ac14780..0ec982f15a 100644 --- a/src/components/itemContextMenu.js +++ b/src/components/itemContextMenu.js @@ -345,8 +345,8 @@ function executeCommand(item, id, options) { }); break; case 'addtoplaylist': - import('./playlisteditor/playlisteditor').then(({ default: playlistEditor }) => { - new playlistEditor({ + import('./playlisteditor/playlisteditor').then(({ default: PlaylistEditor }) => { + new PlaylistEditor({ items: [itemId], serverId: serverId }).then(getResolveFunction(resolve, id, true), getResolveFunction(resolve, id)); @@ -630,8 +630,8 @@ function deleteItem(apiClient, item) { } function refresh(apiClient, item) { - import('./refreshdialog/refreshdialog').then(({ default: refreshDialog }) => { - new refreshDialog({ + import('./refreshdialog/refreshdialog').then(({ default: RefreshDialog }) => { + new RefreshDialog({ itemIds: [item.Id], serverId: apiClient.serverInfo().Id, mode: item.Type === 'CollectionFolder' ? 'scan' : null diff --git a/src/components/mediaLibraryCreator/mediaLibraryCreator.js b/src/components/mediaLibraryCreator/mediaLibraryCreator.js index 8fe961ce5a..6694e5b9a4 100644 --- a/src/components/mediaLibraryCreator/mediaLibraryCreator.js +++ b/src/components/mediaLibraryCreator/mediaLibraryCreator.js @@ -188,7 +188,7 @@ function initLibraryOptions(dlg) { }); } -export class showEditor { +export class MediaLibraryCreator { constructor(options) { return new Promise((resolve) => { currentOptions = options; @@ -224,4 +224,4 @@ let currentOptions; let hasChanges = false; let isCreating = false; -export default showEditor; +export default MediaLibraryCreator; diff --git a/src/components/mediaLibraryEditor/mediaLibraryEditor.js b/src/components/mediaLibraryEditor/mediaLibraryEditor.js index b1389552a8..5a4b3727ab 100644 --- a/src/components/mediaLibraryEditor/mediaLibraryEditor.js +++ b/src/components/mediaLibraryEditor/mediaLibraryEditor.js @@ -197,7 +197,7 @@ function onDialogClosed() { currentDeferred.resolveWith(null, [hasChanges]); } -export class showEditor { +export class MediaLibraryEditor { constructor(options) { const deferred = jQuery.Deferred(); currentOptions = options; @@ -231,4 +231,4 @@ let currentOptions; let hasChanges = false; let isCreating = false; -export default showEditor; +export default MediaLibraryEditor; diff --git a/src/components/multiSelect/multiSelect.js b/src/components/multiSelect/multiSelect.js index 989a421cdb..48cbce0e1f 100644 --- a/src/components/multiSelect/multiSelect.js +++ b/src/components/multiSelect/multiSelect.js @@ -6,7 +6,7 @@ import dom from '../../scripts/dom'; import './multiSelect.scss'; import ServerConnections from '../ServerConnections'; import alert from '../alert'; -import playlistEditor from '../playlisteditor/playlisteditor'; +import PlaylistEditor from '../playlisteditor/playlisteditor'; import confirm from '../confirm/confirm'; import itemHelper from '../itemHelper'; import datetime from '../../scripts/datetime'; @@ -269,7 +269,7 @@ function showMenuForSelectedItems(e) { dispatchNeedsRefresh(); break; case 'playlist': - new playlistEditor({ + new PlaylistEditor({ items: items, serverId: serverId }); @@ -299,8 +299,8 @@ function showMenuForSelectedItems(e) { dispatchNeedsRefresh(); break; case 'refresh': - import('../refreshdialog/refreshdialog').then(({ default: refreshDialog }) => { - new refreshDialog({ + import('../refreshdialog/refreshdialog').then(({ default: RefreshDialog }) => { + new RefreshDialog({ itemIds: items, serverId: serverId }).show(); diff --git a/src/components/playlisteditor/playlisteditor.js b/src/components/playlisteditor/playlisteditor.js index f0fef99aec..ee7cd2b41a 100644 --- a/src/components/playlisteditor/playlisteditor.js +++ b/src/components/playlisteditor/playlisteditor.js @@ -221,7 +221,7 @@ function centerFocus(elem, horiz, on) { }); } -export class showEditor { +export class PlaylistEditor { constructor(options) { const items = options.items || {}; currentServerId = options.serverId; @@ -280,4 +280,4 @@ export class showEditor { } } -export default showEditor; +export default PlaylistEditor; diff --git a/src/components/pluginManager.js b/src/components/pluginManager.js index d8aea5293c..948912cbd8 100644 --- a/src/components/pluginManager.js +++ b/src/components/pluginManager.js @@ -72,13 +72,13 @@ class PluginManager { throw new TypeError('Plugin definitions in window have to be an (async) function returning the plugin class'); } - const pluginClass = await pluginDefinition(); - if (typeof pluginClass !== 'function') { + const PluginClass = await pluginDefinition(); + if (typeof PluginClass !== 'function') { throw new TypeError(`Plugin definition doesn't return a class for '${pluginSpec}'`); } // init plugin and pass basic dependencies - plugin = new pluginClass({ + plugin = new PluginClass({ events: Events, loading, appSettings, diff --git a/src/components/recordingcreator/recordingcreator.js b/src/components/recordingcreator/recordingcreator.js index ac07e200b5..7fd8b5fc5a 100644 --- a/src/components/recordingcreator/recordingcreator.js +++ b/src/components/recordingcreator/recordingcreator.js @@ -6,7 +6,7 @@ import loading from '../loading/loading'; import scrollHelper from '../../scripts/scrollHelper'; import datetime from '../../scripts/datetime'; import imageLoader from '../images/imageLoader'; -import recordingFields from './recordingfields'; +import RecordingFields from './recordingfields'; import Events from '../../utils/events.ts'; import '../../elements/emby-button/emby-button'; import '../../elements/emby-button/paper-icon-button-light'; @@ -185,7 +185,7 @@ function showEditor(itemId, serverId) { reload(dlg, itemId, serverId); - currentRecordingFields = new recordingFields({ + currentRecordingFields = new RecordingFields({ parent: dlg.querySelector('.recordingFields'), programId: itemId, serverId: serverId diff --git a/src/components/remotecontrol/remotecontrol.js b/src/components/remotecontrol/remotecontrol.js index f6af1a864f..9f8822405b 100644 --- a/src/components/remotecontrol/remotecontrol.js +++ b/src/components/remotecontrol/remotecontrol.js @@ -691,10 +691,10 @@ export default function () { } function savePlaylist() { - import('../playlisteditor/playlisteditor').then(({ default: playlistEditor }) => { + import('../playlisteditor/playlisteditor').then(({ default: PlaylistEditor }) => { getSaveablePlaylistItems().then(function (items) { const serverId = items.length ? items[0].ServerId : ApiClient.serverId(); - new playlistEditor({ + new PlaylistEditor({ items: items.map(function (i) { return i.Id; }), diff --git a/src/components/shortcuts.js b/src/components/shortcuts.js index 4dfbce8c5d..3b308b06d9 100644 --- a/src/components/shortcuts.js +++ b/src/components/shortcuts.js @@ -270,8 +270,8 @@ function executeAction(card, target, action) { } function addToPlaylist(item) { - import('./playlisteditor/playlisteditor').then(({ default: playlistEditor }) => { - new playlistEditor().show({ + import('./playlisteditor/playlisteditor').then(({ default: PlaylistEditor }) => { + new PlaylistEditor().show({ items: [item.Id], serverId: item.ServerId diff --git a/src/components/tunerPicker.js b/src/components/tunerPicker.js index 68c6644092..5cb34addc7 100644 --- a/src/components/tunerPicker.js +++ b/src/components/tunerPicker.js @@ -120,7 +120,7 @@ function discoverDevices(view) { }); } -function tunerPicker() { +function TunerPicker() { this.show = function () { const dialogOptions = { removeOnClose: true, @@ -182,4 +182,4 @@ function tunerPicker() { let currentDevices = []; -export default tunerPicker; +export default TunerPicker; diff --git a/src/components/viewManager/viewManager.js b/src/components/viewManager/viewManager.js index 12a5f1a9d6..9f02fe3042 100644 --- a/src/components/viewManager/viewManager.js +++ b/src/components/viewManager/viewManager.js @@ -21,6 +21,7 @@ viewContainer.setOnBeforeChange(function (newView, isRestored, options) { newView.initComplete = true; if (typeof options.controllerFactory === 'function') { + // eslint-disable-next-line new-cap new options.controllerFactory(newView, eventDetail.detail.params); } else if (options.controllerFactory && typeof options.controllerFactory.default === 'function') { new options.controllerFactory.default(newView, eventDetail.detail.params); diff --git a/src/controllers/dashboard/library.js b/src/controllers/dashboard/library.js index f9d80fa3fc..08203b76f6 100644 --- a/src/controllers/dashboard/library.js +++ b/src/controllers/dashboard/library.js @@ -13,8 +13,8 @@ import confirm from '../../components/confirm/confirm'; import cardBuilder from '../../components/cardbuilder/cardBuilder'; function addVirtualFolder(page) { - import('../../components/mediaLibraryCreator/mediaLibraryCreator').then(({ default: medialibrarycreator }) => { - new medialibrarycreator({ + import('../../components/mediaLibraryCreator/mediaLibraryCreator').then(({ default: MediaLibraryCreator }) => { + new MediaLibraryCreator({ collectionTypeOptions: getCollectionTypeOptions().filter(function (f) { return !f.hidden; }), @@ -28,8 +28,8 @@ function addVirtualFolder(page) { } function editVirtualFolder(page, virtualFolder) { - import('../../components/mediaLibraryEditor/mediaLibraryEditor').then(({ default: medialibraryeditor }) => { - new medialibraryeditor({ + import('../../components/mediaLibraryEditor/mediaLibraryEditor').then(({ default: MediaLibraryEditor }) => { + new MediaLibraryEditor({ refresh: shouldRefreshLibraryAfterChanges(page), library: virtualFolder }).then(function (hasChanges) { @@ -62,8 +62,8 @@ function deleteVirtualFolder(page, virtualFolder) { } function refreshVirtualFolder(page, virtualFolder) { - import('../../components/refreshdialog/refreshdialog').then(({ default: refreshDialog }) => { - new refreshDialog({ + import('../../components/refreshdialog/refreshdialog').then(({ default: RefreshDialog }) => { + new RefreshDialog({ itemIds: [virtualFolder.ItemId], serverId: ApiClient.serverId(), mode: 'scan' diff --git a/src/controllers/home.js b/src/controllers/home.js index 657d406f67..e85d4eb83a 100644 --- a/src/controllers/home.js +++ b/src/controllers/home.js @@ -49,11 +49,11 @@ class HomeView extends TabbedView { } const instance = this; - return import(/* webpackChunkName: "[request]" */ `../controllers/${depends}`).then(({ default: controllerFactory }) => { + return import(/* webpackChunkName: "[request]" */ `../controllers/${depends}`).then(({ default: ControllerFactory }) => { let controller = instance.tabControllers[index]; if (!controller) { - controller = new controllerFactory(instance.view.querySelector(".tabContent[data-index='" + index + "']"), instance.params); + controller = new ControllerFactory(instance.view.querySelector(".tabContent[data-index='" + index + "']"), instance.params); instance.tabControllers[index] = controller; } diff --git a/src/controllers/itemDetails/index.js b/src/controllers/itemDetails/index.js index 68d431b0c4..ee1703bd15 100644 --- a/src/controllers/itemDetails/index.js +++ b/src/controllers/itemDetails/index.js @@ -691,8 +691,8 @@ function showRecordingFields(instance, page, item, user) { const recordingFieldsElement = page.querySelector('.recordingFields'); if (item.Type == 'Program' && user.Policy.EnableLiveTvManagement) { - import('../../components/recordingcreator/recordingfields').then(({ default: recordingFields }) => { - instance.currentRecordingFields = new recordingFields({ + import('../../components/recordingcreator/recordingfields').then(({ default: RecordingFields }) => { + instance.currentRecordingFields = new RecordingFields({ parent: recordingFieldsElement, programId: item.Id, serverId: item.ServerId @@ -1826,7 +1826,7 @@ function renderCast(page, item) { }); } -function itemDetailPage() { +function ItemDetailPage() { const self = this; self.setInitialCollapsibleState = setInitialCollapsibleState; self.renderDetails = renderDetails; @@ -1846,7 +1846,7 @@ function onTrackSelectionsSubmit(e) { return false; } -window.ItemDetailPage = new itemDetailPage(); +window.ItemDetailPage = new ItemDetailPage(); export default function (view, params) { function getApiClient() { diff --git a/src/controllers/list.js b/src/controllers/list.js index 62ef3c12cb..0378a1025c 100644 --- a/src/controllers/list.js +++ b/src/controllers/list.js @@ -399,8 +399,8 @@ function showSortMenu() { function onNewItemClick() { const instance = this; - import('../components/playlisteditor/playlisteditor').then(({ default: playlistEditor }) => { - new playlistEditor({ + import('../components/playlisteditor/playlisteditor').then(({ default: PlaylistEditor }) => { + new PlaylistEditor({ items: [], serverId: instance.params.serverId }); diff --git a/src/controllers/livetv/livetvguide.js b/src/controllers/livetv/livetvguide.js index c56d4ebd04..2d109b6bef 100644 --- a/src/controllers/livetv/livetvguide.js +++ b/src/controllers/livetv/livetvguide.js @@ -1,4 +1,4 @@ -import tvguide from '../../components/guide/guide'; +import Guide from '../../components/guide/guide'; export default function (view, params, tabContent) { let guideInstance; @@ -6,7 +6,7 @@ export default function (view, params, tabContent) { self.renderTab = function () { if (!guideInstance) { - guideInstance = new tvguide({ + guideInstance = new Guide({ element: tabContent, serverId: ApiClient.serverId() }); diff --git a/src/controllers/livetv/livetvsuggested.js b/src/controllers/livetv/livetvsuggested.js index eb604b2d29..f06508611f 100644 --- a/src/controllers/livetv/livetvsuggested.js +++ b/src/controllers/livetv/livetvsuggested.js @@ -274,7 +274,7 @@ export default function (view, params) { break; } - import(`../livetv/${depends}`).then(({ default: controllerFactory }) => { + import(`../livetv/${depends}`).then(({ default: ControllerFactory }) => { let tabContent; if (index === 0) { @@ -290,7 +290,7 @@ export default function (view, params) { if (index === 0) { controller = self; } else { - controller = new controllerFactory(view, params, tabContent); + controller = new ControllerFactory(view, params, tabContent); } tabControllers[index] = controller; diff --git a/src/controllers/livetvguideprovider.js b/src/controllers/livetvguideprovider.js index fbc77cc7b6..7a133945f2 100644 --- a/src/controllers/livetvguideprovider.js +++ b/src/controllers/livetvguideprovider.js @@ -9,8 +9,8 @@ function onListingsSubmitted() { } function init(page, type, providerId) { - import(`../components/tvproviders/${type}`).then(({ default: factory }) => { - const instance = new factory(page, providerId, {}); + import(`../components/tvproviders/${type}`).then(({ default: ProviderFactory }) => { + const instance = new ProviderFactory(page, providerId, {}); Events.on(instance, 'submitted', onListingsSubmitted); instance.init(); }); diff --git a/src/controllers/livetvstatus.js b/src/controllers/livetvstatus.js index 5eb13c9793..3c0e304939 100644 --- a/src/controllers/livetvstatus.js +++ b/src/controllers/livetvstatus.js @@ -165,8 +165,8 @@ function showProviderOptions(page, providerId, button) { } function mapChannels(page, providerId) { - import('../components/channelMapper/channelMapper').then(({ default: channelMapper }) => { - new channelMapper({ + import('../components/channelMapper/channelMapper').then(({ default: ChannelMapper }) => { + new ChannelMapper({ serverId: ApiClient.serverInfo().Id, providerId: providerId }).show(); diff --git a/src/controllers/livetvtuner.js b/src/controllers/livetvtuner.js index b15eea9d8a..7f6ec20270 100644 --- a/src/controllers/livetvtuner.js +++ b/src/controllers/livetvtuner.js @@ -106,8 +106,8 @@ function submitForm(page) { } function getDetectedDevice() { - return import('../components/tunerPicker').then(({ default: tunerPicker }) => { - return new tunerPicker().show({ + return import('../components/tunerPicker').then(({ default: TunerPicker }) => { + return new TunerPicker().show({ serverId: ApiClient.serverId() }); }); diff --git a/src/controllers/movies/movies.js b/src/controllers/movies/movies.js index 6ec5243715..0d89706cf8 100644 --- a/src/controllers/movies/movies.js +++ b/src/controllers/movies/movies.js @@ -289,8 +289,8 @@ export default function (view, params, tabContent, options) { query = userSettings.loadQuerySettings(savedQueryKey, query); this.showFilterMenu = function () { - import('../../components/filterdialog/filterdialog').then(({ default: filterDialogFactory }) => { - const filterDialog = new filterDialogFactory({ + import('../../components/filterdialog/filterdialog').then(({ default: FilterDialog }) => { + const filterDialog = new FilterDialog({ query: query, mode: 'movies', serverId: ApiClient.serverId() diff --git a/src/controllers/movies/moviesrecommended.js b/src/controllers/movies/moviesrecommended.js index 2d6aa223cb..1dc60c30e1 100644 --- a/src/controllers/movies/moviesrecommended.js +++ b/src/controllers/movies/moviesrecommended.js @@ -314,7 +314,7 @@ export default function (view, params) { break; } - import(`../movies/${depends}`).then(({ default: controllerFactory }) => { + import(`../movies/${depends}`).then(({ default: ControllerFactory }) => { let tabContent; if (index === suggestionsTabIndex) { @@ -330,11 +330,11 @@ export default function (view, params) { if (index === suggestionsTabIndex) { controller = this; } else if (index == 0 || index == 3) { - controller = new controllerFactory(view, params, tabContent, { + controller = new ControllerFactory(view, params, tabContent, { mode: index ? 'favorites' : 'movies' }); } else { - controller = new controllerFactory(view, params, tabContent); + controller = new ControllerFactory(view, params, tabContent); } tabControllers[index] = controller; diff --git a/src/controllers/movies/movietrailers.js b/src/controllers/movies/movietrailers.js index a96d7e51aa..81f9f8b149 100644 --- a/src/controllers/movies/movietrailers.js +++ b/src/controllers/movies/movietrailers.js @@ -182,8 +182,8 @@ export default function (view, params, tabContent) { let isLoading = false; this.showFilterMenu = function () { - import('../../components/filterdialog/filterdialog').then(({ default: filterDialogFactory }) => { - const filterDialog = new filterDialogFactory({ + import('../../components/filterdialog/filterdialog').then(({ default: FilterDialog }) => { + const filterDialog = new FilterDialog({ query: getQuery(), mode: 'movies', serverId: ApiClient.serverId() diff --git a/src/controllers/music/musicalbums.js b/src/controllers/music/musicalbums.js index 04ea17a983..6c0c45a0f0 100644 --- a/src/controllers/music/musicalbums.js +++ b/src/controllers/music/musicalbums.js @@ -189,8 +189,8 @@ export default function (view, params, tabContent) { let isLoading = false; this.showFilterMenu = function () { - import('../../components/filterdialog/filterdialog').then(({ default: filterDialogFactory }) => { - const filterDialog = new filterDialogFactory({ + import('../../components/filterdialog/filterdialog').then(({ default: FilterDialog }) => { + const filterDialog = new FilterDialog({ query: getQuery(), mode: 'albums', serverId: ApiClient.serverId() diff --git a/src/controllers/music/musicartists.js b/src/controllers/music/musicartists.js index 084f092db3..4126086ade 100644 --- a/src/controllers/music/musicartists.js +++ b/src/controllers/music/musicartists.js @@ -170,8 +170,8 @@ export default function (view, params, tabContent) { let isLoading = false; this.showFilterMenu = function () { - import('../../components/filterdialog/filterdialog').then(({ default: filterDialogFactory }) => { - const filterDialog = new filterDialogFactory({ + import('../../components/filterdialog/filterdialog').then(({ default: FilterDialog }) => { + const filterDialog = new FilterDialog({ query: getQuery(tabContent), mode: this.mode, serverId: ApiClient.serverId() diff --git a/src/controllers/music/musicrecommended.js b/src/controllers/music/musicrecommended.js index 3599ecedc8..dc32aca6f6 100644 --- a/src/controllers/music/musicrecommended.js +++ b/src/controllers/music/musicrecommended.js @@ -290,7 +290,7 @@ export default function (view, params) { break; } - import(`../music/${depends}`).then(({ default: controllerFactory }) => { + import(`../music/${depends}`).then(({ default: ControllerFactory }) => { let tabContent; if (index == 1) { @@ -306,7 +306,7 @@ export default function (view, params) { if (index === 1) { controller = this; } else { - controller = new controllerFactory(view, params, tabContent); + controller = new ControllerFactory(view, params, tabContent); } if (index == 2) { diff --git a/src/controllers/music/songs.js b/src/controllers/music/songs.js index 06af0b3081..5e5337d032 100644 --- a/src/controllers/music/songs.js +++ b/src/controllers/music/songs.js @@ -135,8 +135,8 @@ export default function (view, params, tabContent) { let isLoading = false; self.showFilterMenu = function () { - import('../../components/filterdialog/filterdialog').then(({ default: filterDialogFactory }) => { - const filterDialog = new filterDialogFactory({ + import('../../components/filterdialog/filterdialog').then(({ default: FilterDialog }) => { + const filterDialog = new FilterDialog({ query: getQuery(tabContent), mode: 'songs', serverId: ApiClient.serverId() diff --git a/src/controllers/playback/queue/index.js b/src/controllers/playback/queue/index.js index cf39aa145b..602135a794 100644 --- a/src/controllers/playback/queue/index.js +++ b/src/controllers/playback/queue/index.js @@ -1,9 +1,9 @@ -import remotecontrolFactory from '../../../components/remotecontrol/remotecontrol'; +import RemoteControl from '../../../components/remotecontrol/remotecontrol'; import libraryMenu from '../../../scripts/libraryMenu'; import '../../../elements/emby-button/emby-button'; export default function (view) { - const remoteControl = new remotecontrolFactory(); + const remoteControl = new RemoteControl(); remoteControl.init(view, view.querySelector('.remoteControlContent')); view.addEventListener('viewshow', function () { libraryMenu.setTransparentMenu(true); diff --git a/src/controllers/shows/episodes.js b/src/controllers/shows/episodes.js index 38b7d077c3..f2f6c605d7 100644 --- a/src/controllers/shows/episodes.js +++ b/src/controllers/shows/episodes.js @@ -171,8 +171,8 @@ export default function (view, params, tabContent) { let isLoading = false; self.showFilterMenu = function () { - import('../../components/filterdialog/filterdialog').then(({ default: filterDialogFactory }) => { - const filterDialog = new filterDialogFactory({ + import('../../components/filterdialog/filterdialog').then(({ default: FilterDialog }) => { + const filterDialog = new FilterDialog({ query: getQuery(tabContent), mode: 'episodes', serverId: ApiClient.serverId() diff --git a/src/controllers/shows/tvrecommended.js b/src/controllers/shows/tvrecommended.js index 68019511ba..d3673bf6ae 100644 --- a/src/controllers/shows/tvrecommended.js +++ b/src/controllers/shows/tvrecommended.js @@ -268,7 +268,7 @@ export default function (view, params) { break; } - import(`../shows/${depends}`).then(({ default: controllerFactory }) => { + import(`../shows/${depends}`).then(({ default: ControllerFactory }) => { let tabContent; if (index === 1) { @@ -284,7 +284,7 @@ export default function (view, params) { if (index === 1) { controller = self; } else { - controller = new controllerFactory(view, params, tabContent); + controller = new ControllerFactory(view, params, tabContent); } tabControllers[index] = controller; diff --git a/src/controllers/shows/tvshows.js b/src/controllers/shows/tvshows.js index d378cd34d5..3dea00f1b8 100644 --- a/src/controllers/shows/tvshows.js +++ b/src/controllers/shows/tvshows.js @@ -199,8 +199,8 @@ export default function (view, params, tabContent) { let isLoading = false; this.showFilterMenu = function () { - import('../../components/filterdialog/filterdialog').then(({ default: filterDialogFactory }) => { - const filterDialog = new filterDialogFactory({ + import('../../components/filterdialog/filterdialog').then(({ default: FilterDialog }) => { + const filterDialog = new FilterDialog({ query: getQuery(tabContent), mode: 'series', serverId: ApiClient.serverId() diff --git a/src/elements/emby-scroller/Scroller.tsx b/src/elements/emby-scroller/Scroller.tsx index 57349bad4c..cb3d5b75b4 100644 --- a/src/elements/emby-scroller/Scroller.tsx +++ b/src/elements/emby-scroller/Scroller.tsx @@ -5,7 +5,7 @@ import layoutManager from '../../components/layoutManager'; import dom from '../../scripts/dom'; import browser from '../../scripts/browser'; import focusManager from '../../components/focusManager'; -import scrollerFactory from '../../libraries/scroller'; +import ScrollerFactory from '../../libraries/scroller'; import ScrollButtons from '../emby-scrollbuttons/ScrollButtons'; import './emby-scroller.scss'; @@ -41,7 +41,7 @@ const Scroller: FC = ({ scrollPos: 0, scrollWidth: 0 }); - const scrollerFactoryRef = useRef(null); + const scrollerFactoryRef = useRef(null); const getScrollSlider = useCallback(() => { if (scrollerFactoryRef.current) { @@ -126,7 +126,7 @@ const Scroller: FC = ({ }); }, [getScrollPosition, getScrollSize, getScrollWidth]); - const initCenterFocus = useCallback((elem, scrollerInstance: scrollerFactory) => { + const initCenterFocus = useCallback((elem, scrollerInstance: ScrollerFactory) => { dom.addEventListener(elem, 'focus', function (e: FocusEvent) { const focused = focusManager.focusableParent(e.target); if (focused) { @@ -179,7 +179,7 @@ const Scroller: FC = ({ }; // If just inserted it might not have any height yet - yes this is a hack - scrollerFactoryRef.current = new scrollerFactory(scrollRef.current, options); + scrollerFactoryRef.current = new ScrollerFactory(scrollRef.current, options); scrollerFactoryRef.current.init(); scrollerFactoryRef.current.reload(); diff --git a/src/elements/emby-scroller/emby-scroller.js b/src/elements/emby-scroller/emby-scroller.js index eb5f3abfe4..cf716bed41 100644 --- a/src/elements/emby-scroller/emby-scroller.js +++ b/src/elements/emby-scroller/emby-scroller.js @@ -1,4 +1,4 @@ -import scroller from '../../libraries/scroller'; +import ScrollerFactory from '../../libraries/scroller'; import dom from '../../scripts/dom'; import layoutManager from '../../components/layoutManager'; import inputManager from '../../scripts/inputManager'; @@ -140,7 +140,7 @@ ScrollerPrototype.attachedCallback = function () { }; // If just inserted it might not have any height yet - yes this is a hack - this.scroller = new scroller(scrollFrame, options); + this.scroller = new ScrollerFactory(scrollFrame, options); this.scroller.init(); this.scroller.reload(); diff --git a/src/elements/emby-tabs/emby-tabs.js b/src/elements/emby-tabs/emby-tabs.js index 22d12e75af..b4b541a3dd 100644 --- a/src/elements/emby-tabs/emby-tabs.js +++ b/src/elements/emby-tabs/emby-tabs.js @@ -1,6 +1,6 @@ import 'webcomponents.js/webcomponents-lite'; import dom from '../../scripts/dom'; -import scroller from '../../libraries/scroller'; +import ScrollerFactory from '../../libraries/scroller'; import browser from '../../scripts/browser'; import focusManager from '../../components/focusManager'; import layoutManager from '../../components/layoutManager'; @@ -124,7 +124,7 @@ function initScroller(tabs) { const contentScrollSlider = tabs.querySelector('.emby-tabs-slider'); if (contentScrollSlider) { - tabs.scroller = new scroller(tabs, { + tabs.scroller = new ScrollerFactory(tabs, { horizontal: 1, itemNav: 0, mouseDragging: 1, diff --git a/src/elements/emby-textarea/emby-textarea.js b/src/elements/emby-textarea/emby-textarea.js index 04ce1a42d9..5f0ddba73e 100644 --- a/src/elements/emby-textarea/emby-textarea.js +++ b/src/elements/emby-textarea/emby-textarea.js @@ -19,7 +19,7 @@ function calculateOffset(textarea) { return offset; } -function autoGrow(textarea, maxLines) { +function AutoGrow(textarea, maxLines) { const self = this; if (maxLines === undefined) { @@ -125,7 +125,7 @@ EmbyTextAreaPrototype.attachedCallback = function () { label.innerText = text; }; - new autoGrow(this); + new AutoGrow(this); }; document.registerElement('emby-textarea', { diff --git a/src/libraries/scroller.js b/src/libraries/scroller.js index abfa30cdf0..01038fa0b4 100644 --- a/src/libraries/scroller.js +++ b/src/libraries/scroller.js @@ -904,6 +904,7 @@ scrollerFactory.prototype.toCenter = function (item, immediate) { }; scrollerFactory.create = function (frame, options) { + // eslint-disable-next-line new-cap const instance = new scrollerFactory(frame, options); return Promise.resolve(instance); }; diff --git a/src/plugins/chromecastPlayer/plugin.js b/src/plugins/chromecastPlayer/plugin.js index deb479c4b4..693836b172 100644 --- a/src/plugins/chromecastPlayer/plugin.js +++ b/src/plugins/chromecastPlayer/plugin.js @@ -2,7 +2,7 @@ import appSettings from '../../scripts/settings/appSettings'; import * as userSettings from '../../scripts/settings/userSettings'; import { playbackManager } from '../../components/playback/playbackmanager'; import globalize from '../../scripts/globalize'; -import castSenderApiLoader from './castSenderApi'; +import CastSenderApi from './castSenderApi'; import ServerConnections from '../../components/ServerConnections'; import alert from '../../components/alert'; import { PluginType } from '../../types/plugin.ts'; @@ -576,7 +576,7 @@ class ChromecastPlayer { this.isLocalPlayer = false; this.lastPlayerData = {}; - new castSenderApiLoader().load().then(initializeChromecast.bind(this)); + new CastSenderApi().load().then(initializeChromecast.bind(this)); } tryPair() { diff --git a/src/plugins/htmlVideoPlayer/plugin.js b/src/plugins/htmlVideoPlayer/plugin.js index 0ec83d6363..c2a1e9d002 100644 --- a/src/plugins/htmlVideoPlayer/plugin.js +++ b/src/plugins/htmlVideoPlayer/plugin.js @@ -1490,8 +1490,8 @@ export class HtmlVideoPlayer { // add some cues to show the text // in safari, the cues need to be added before setting the track mode to showing for (const trackEvent of data.TrackEvents) { - const trackCueObject = window.VTTCue || window.TextTrackCue; - const cue = new trackCueObject(trackEvent.StartPositionTicks / 10000000, trackEvent.EndPositionTicks / 10000000, normalizeTrackEventText(trackEvent.Text, false)); + const TrackCue = window.VTTCue || window.TextTrackCue; + const cue = new TrackCue(trackEvent.StartPositionTicks / 10000000, trackEvent.EndPositionTicks / 10000000, normalizeTrackEventText(trackEvent.Text, false)); if (cue.line === 'auto') { cue.line = cueLine; diff --git a/src/scripts/playlists.js b/src/scripts/playlists.js index eb3fac9ece..aba0c389ae 100644 --- a/src/scripts/playlists.js +++ b/src/scripts/playlists.js @@ -189,9 +189,9 @@ export default function (view) { reloadItems(); }); view.querySelector('.btnNewPlaylist').addEventListener('click', function () { - import('../components/playlisteditor/playlisteditor').then(({ default: playlistEditor }) => { + import('../components/playlisteditor/playlisteditor').then(({ default: PlaylistEditor }) => { const serverId = ApiClient.serverInfo().Id; - new playlistEditor({ + new PlaylistEditor({ items: [], serverId: serverId });