From a48d466e6a2b99efe967bad8d48dac20d78c2d14 Mon Sep 17 00:00:00 2001 From: vitorsemeano Date: Mon, 19 Oct 2020 20:25:58 +0100 Subject: [PATCH] fixes for lint errors added missing packages for lint removed unecessary babel/polyfill --- package.json | 2 +- src/components/ServerConnections.js | 2 +- src/components/apphost.js | 2 +- src/components/filtermenu/filtermenu.js | 2 +- src/components/playback/mediasession.js | 2 ++ src/components/playback/playersettingsmenu.js | 2 +- src/components/playerstats/playerstats.js | 2 +- .../quickConnectSettings/quickConnectSettings.js | 1 + src/components/remotecontrol/remotecontrol.js | 2 +- src/components/tvproviders/schedulesdirect.js | 1 + src/components/tvproviders/xmltv.js | 1 + src/components/viewManager/viewManager.js | 1 + src/plugins/bookPlayer/plugin.js | 3 ++- src/plugins/comicsPlayer/plugin.js | 3 ++- src/plugins/photoPlayer/plugin.js | 6 +++--- src/scripts/globalize.js | 2 +- src/scripts/site.js | 2 +- src/scripts/themeManager.js | 2 +- webpack.dev.js | 2 +- webpack.prod.js | 2 +- yarn.lock | 15 +-------------- 21 files changed, 26 insertions(+), 31 deletions(-) diff --git a/package.json b/package.json index 8b815aa642..f58a9b346a 100644 --- a/package.json +++ b/package.json @@ -10,13 +10,13 @@ "@babel/eslint-plugin": "^7.12.1", "@babel/plugin-proposal-class-properties": "^7.10.1", "@babel/plugin-proposal-private-methods": "^7.12.1", - "@babel/polyfill": "^7.11.5", "@babel/preset-env": "^7.12.1", "autoprefixer": "^9.8.6", "babel-loader": "^8.0.6", "browser-sync": "^2.26.13", "confusing-browser-globals": "^1.0.10", "clean-webpack-plugin": "^3.0.0", + "confusing-browser-globals": "^1.0.9", "copy-webpack-plugin": "^6.0.3", "css-loader": "^5.0.0", "cssnano": "^4.1.10", diff --git a/src/components/ServerConnections.js b/src/components/ServerConnections.js index c7ff87f428..316f42558d 100644 --- a/src/components/ServerConnections.js +++ b/src/components/ServerConnections.js @@ -18,7 +18,7 @@ class ServerConnections extends ConnectionManager { if (!AppInfo.isNativeApp) { console.debug('creating ApiClient singleton'); - var apiClient = new ApiClient( + const apiClient = new ApiClient( Dashboard.serverAddress(), appHost.appName(), appHost.appVersion(), diff --git a/src/components/apphost.js b/src/components/apphost.js index e90b5a787a..c2e3a33708 100644 --- a/src/components/apphost.js +++ b/src/components/apphost.js @@ -311,7 +311,7 @@ function askForExit() { }); } -let deviceId = getDeviceId(); +const deviceId = getDeviceId(); const deviceName = getDeviceName(); const appName = 'Jellyfin Web'; const appVersion = '10.7.0'; diff --git a/src/components/filtermenu/filtermenu.js b/src/components/filtermenu/filtermenu.js index 5f8856dbc4..78d3d14b19 100644 --- a/src/components/filtermenu/filtermenu.js +++ b/src/components/filtermenu/filtermenu.js @@ -194,7 +194,7 @@ function initEditor(context, settings) { } } function loadDynamicFilters(context, options) { - var apiClient = ServerConnections.getApiClient(options.serverId); + const apiClient = ServerConnections.getApiClient(options.serverId); const filterMenuOptions = Object.assign(options.filterMenuOptions, { diff --git a/src/components/playback/mediasession.js b/src/components/playback/mediasession.js index 5f0f6f482c..9cfb9f3b0b 100644 --- a/src/components/playback/mediasession.js +++ b/src/components/playback/mediasession.js @@ -2,6 +2,8 @@ import { playbackManager } from '../playback/playbackmanager'; import nowPlayingHelper from '../playback/nowplayinghelper'; import { Events } from 'jellyfin-apiclient'; import ServerConnections from '../ServerConnections'; +import shell from '../../scripts/shell'; + /* eslint-disable indent */ // Reports media playback to the device for lock screen control diff --git a/src/components/playback/playersettingsmenu.js b/src/components/playback/playersettingsmenu.js index 0e9fbcd120..8057c4310d 100644 --- a/src/components/playback/playersettingsmenu.js +++ b/src/components/playback/playersettingsmenu.js @@ -251,7 +251,7 @@ export function show(options) { return showWithUser(options, player, null); } - var apiClient = ServerConnections.getApiClient(currentItem.ServerId); + const apiClient = ServerConnections.getApiClient(currentItem.ServerId); return apiClient.getCurrentUser().then(function (user) { return showWithUser(options, player, user); }); diff --git a/src/components/playerstats/playerstats.js b/src/components/playerstats/playerstats.js index 9a90e4ab91..b4969c62e0 100644 --- a/src/components/playerstats/playerstats.js +++ b/src/components/playerstats/playerstats.js @@ -414,7 +414,7 @@ import ServerConnections from '../ServerConnections'; name: 'Original Media Info' }); - var apiClient = ServerConnections.getApiClient(playbackManager.currentItem(player).ServerId); + const apiClient = ServerConnections.getApiClient(playbackManager.currentItem(player).ServerId); if (syncPlayManager.isSyncPlayEnabled() && apiClient.isMinServerVersion('10.6.0')) { categories.push({ stats: getSyncPlayStats(), diff --git a/src/components/quickConnectSettings/quickConnectSettings.js b/src/components/quickConnectSettings/quickConnectSettings.js index 11d8e2d663..d91bc07295 100644 --- a/src/components/quickConnectSettings/quickConnectSettings.js +++ b/src/components/quickConnectSettings/quickConnectSettings.js @@ -1,5 +1,6 @@ import globalize from '../../scripts/globalize'; import toast from '../toast/toast'; +import Dashboard from '../../scripts/clientUtils'; export class QuickConnectSettings { constructor() { } diff --git a/src/components/remotecontrol/remotecontrol.js b/src/components/remotecontrol/remotecontrol.js index 9b49acb422..007f8a3eb2 100644 --- a/src/components/remotecontrol/remotecontrol.js +++ b/src/components/remotecontrol/remotecontrol.js @@ -17,7 +17,7 @@ import './remotecontrol.css'; import '../../elements/emby-ratingbutton/emby-ratingbutton'; import ServerConnections from '../ServerConnections'; import toast from '../toast/toast'; -import { appRouter } from "../appRouter"; +import { appRouter } from '../appRouter'; /*eslint prefer-const: "error"*/ diff --git a/src/components/tvproviders/schedulesdirect.js b/src/components/tvproviders/schedulesdirect.js index 6346594fda..20ae447216 100644 --- a/src/components/tvproviders/schedulesdirect.js +++ b/src/components/tvproviders/schedulesdirect.js @@ -9,6 +9,7 @@ import '../../elements/emby-select/emby-select'; import '../../elements/emby-button/emby-button'; import '../../assets/css/flexstyles.css'; import Dashboard from '../../scripts/clientUtils'; +import { Events } from 'jellyfin-apiclient'; export default function (page, providerId, options) { function reload() { diff --git a/src/components/tvproviders/xmltv.js b/src/components/tvproviders/xmltv.js index 3b2efb3214..b71c19cb26 100644 --- a/src/components/tvproviders/xmltv.js +++ b/src/components/tvproviders/xmltv.js @@ -6,6 +6,7 @@ import '../../elements/emby-input/emby-input'; import '../listview/listview.css'; import '../../elements/emby-button/paper-icon-button-light'; import Dashboard from '../../scripts/clientUtils'; +import { Events } from 'jellyfin-apiclient'; export default function (page, providerId, options) { function getListingProvider(config, id) { diff --git a/src/components/viewManager/viewManager.js b/src/components/viewManager/viewManager.js index b0d8b37f2e..22faa3a3bd 100644 --- a/src/components/viewManager/viewManager.js +++ b/src/components/viewManager/viewManager.js @@ -99,6 +99,7 @@ function dispatchViewEvent(view, eventInfo, eventName, isCancellable) { function getViewEventDetail(view, {state, url, options = {}}, isRestored) { const index = url.indexOf('?'); + // eslint-disable-next-line compat/compat const searchParams = new URLSearchParams(url.substring(index + 1)); const params = {}; diff --git a/src/plugins/bookPlayer/plugin.js b/src/plugins/bookPlayer/plugin.js index 73c98a57c5..7d7a8b89be 100644 --- a/src/plugins/bookPlayer/plugin.js +++ b/src/plugins/bookPlayer/plugin.js @@ -1,13 +1,14 @@ import loading from '../../components/loading/loading'; import keyboardnavigation from '../../scripts/keyboardNavigation'; import dialogHelper from '../../components/dialogHelper/dialogHelper'; -import dom from '../../scripts/dom'; +import '../../scripts/dom'; import { Events } from 'jellyfin-apiclient'; import './style.css'; import 'material-design-icons-iconfont'; import '../../elements/emby-button/paper-icon-button-light'; import ServerConnections from '../../components/ServerConnections'; import TableOfContents from './tableOfContents'; +import browser from '../../scripts/browser'; export class BookPlayer { constructor() { diff --git a/src/plugins/comicsPlayer/plugin.js b/src/plugins/comicsPlayer/plugin.js index ab5822b1b0..89e110cec3 100644 --- a/src/plugins/comicsPlayer/plugin.js +++ b/src/plugins/comicsPlayer/plugin.js @@ -1,4 +1,5 @@ -import { Archive } from 'libarchive.js/main.js'; +// eslint-disable-next-line import/named, import/namespace +import { Archive } from 'libarchive.js'; import loading from '../../components/loading/loading'; import dialogHelper from '../../components/dialogHelper/dialogHelper'; import keyboardnavigation from '../../scripts/keyboardNavigation'; diff --git a/src/plugins/photoPlayer/plugin.js b/src/plugins/photoPlayer/plugin.js index 4f7c5cbb25..2324ef8932 100644 --- a/src/plugins/photoPlayer/plugin.js +++ b/src/plugins/photoPlayer/plugin.js @@ -11,11 +11,11 @@ export default class PhotoPlayer { play(options) { return new Promise(function (resolve, reject) { import('../../components/slideshow/slideshow').then(({default: Slideshow}) => { - var index = options.startIndex || 0; + const index = options.startIndex || 0; - var apiClient = ServerConnections.currentApiClient(); + const apiClient = ServerConnections.currentApiClient(); apiClient.getCurrentUser().then(function(result) { - var newSlideShow = new Slideshow({ + const newSlideShow = new Slideshow({ showTitle: false, cover: false, items: options.items, diff --git a/src/scripts/globalize.js b/src/scripts/globalize.js index 2d990b6099..0d7c137f73 100644 --- a/src/scripts/globalize.js +++ b/src/scripts/globalize.js @@ -163,7 +163,7 @@ import { Events } from 'jellyfin-apiclient'; return; } - let url = filtered[0].path; + const url = filtered[0].path; import(`../strings/${url}`).then((fileContent) => { resolve(fileContent); diff --git a/src/scripts/site.js b/src/scripts/site.js index abaece67e2..8f42ca60e0 100644 --- a/src/scripts/site.js +++ b/src/scripts/site.js @@ -73,7 +73,7 @@ window.pageIdOn = function(eventName, id, fn) { }); }; -if (self.appMode === 'cordova' || self.appMode === 'android' || self.appMode === 'standalone') { +if (window.appMode === 'cordova' || window.appMode === 'android' || window.appMode === 'standalone') { AppInfo.isNativeApp = true; } diff --git a/src/scripts/themeManager.js b/src/scripts/themeManager.js index 294fc81f6e..ddaa9c4562 100644 --- a/src/scripts/themeManager.js +++ b/src/scripts/themeManager.js @@ -17,7 +17,7 @@ function getThemes() { function getThemeStylesheetInfo(id) { return getThemes().then(themes => { - const theme = themes.find(theme => { + let theme = themes.find(theme => { return id ? theme.id === id : theme.default; }); diff --git a/webpack.dev.js b/webpack.dev.js index ba9963411d..6619b6b17a 100644 --- a/webpack.dev.js +++ b/webpack.dev.js @@ -13,7 +13,7 @@ module.exports = merge(common, { test: /\.js$/, enforce: 'pre', use: ['source-map-loader'] - }, + } ] }, plugins: [ diff --git a/webpack.prod.js b/webpack.prod.js index c4e17ea9dc..7d2dbc1295 100644 --- a/webpack.prod.js +++ b/webpack.prod.js @@ -3,5 +3,5 @@ const merge = require('webpack-merge'); module.exports = merge(common, { mode: 'production', - entry: './scripts/site.js', + entry: './scripts/site.js' }); diff --git a/yarn.lock b/yarn.lock index 172587ab49..2ac097bc00 100644 --- a/yarn.lock +++ b/yarn.lock @@ -717,14 +717,6 @@ "@babel/helper-create-regexp-features-plugin" "^7.12.1" "@babel/helper-plugin-utils" "^7.10.4" -"@babel/polyfill@^7.11.5": - version "7.12.1" - resolved "https://registry.yarnpkg.com/@babel/polyfill/-/polyfill-7.12.1.tgz#1f2d6371d1261bbd961f3c5d5909150e12d0bd96" - integrity sha512-X0pi0V6gxLi6lFZpGmeNa4zxtwEmCs42isWLNjZZDE0Y8yVfgu0T2OAHlzBbdYlqbW/YXVvoBHpATEM+goCj8g== - dependencies: - core-js "^2.6.5" - regenerator-runtime "^0.13.4" - "@babel/preset-env@^7.12.1": version "7.12.1" resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.12.1.tgz#9c7e5ca82a19efc865384bb4989148d2ee5d7ac2" @@ -2934,7 +2926,7 @@ config-chain@^1.1.11: ini "^1.3.4" proto-list "~1.2.1" -confusing-browser-globals@^1.0.10: +confusing-browser-globals@^1.0.9: version "1.0.10" resolved "https://registry.yarnpkg.com/confusing-browser-globals/-/confusing-browser-globals-1.0.10.tgz#30d1e7f3d1b882b25ec4933d1d1adac353d20a59" integrity sha512-gNld/3lySHwuhaVluJUKLePYirM3QNCKzVxqAdhJII9/WXKVX5PURzMVJspS1jTslSqjeuG4KMVTSouit5YPHA== @@ -3063,11 +3055,6 @@ core-js-compat@^3.6.2: browserslist "^4.8.5" semver "7.0.0" -core-js@^2.6.5: - version "2.6.11" - resolved "https://registry.yarnpkg.com/core-js/-/core-js-2.6.11.tgz#38831469f9922bded8ee21c9dc46985e0399308c" - integrity sha512-5wjnpaT/3dV+XB4borEsnAYQchn00XSgTAWKDkEqv+K8KevjbzmofK6hfJ9TZIlpj2N0xQpazy7PiRQiWHqzWg== - core-js@^3.6.5: version "3.6.5" resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.6.5.tgz#7395dc273af37fb2e50e9bd3d9fe841285231d1a"