diff --git a/src/apps/dashboard/routes/users/add.tsx b/src/apps/dashboard/routes/users/add.tsx index 920d38691f..05b1001629 100644 --- a/src/apps/dashboard/routes/users/add.tsx +++ b/src/apps/dashboard/routes/users/add.tsx @@ -12,7 +12,7 @@ import AccessContainer from '../../../../components/dashboard/users/AccessContai import CheckBoxElement from '../../../../elements/CheckBoxElement'; import Page from '../../../../components/Page'; -type userInput = { +type UserInput = { Name?: string; Password?: string; }; @@ -110,7 +110,7 @@ const UserNew = () => { loadUser(); const saveUser = () => { - const userInput: userInput = {}; + const userInput: UserInput = {}; userInput.Name = (page.querySelector('#txtUsername') as HTMLInputElement).value; userInput.Password = (page.querySelector('#txtPassword') as HTMLInputElement).value; window.ApiClient.createUser(userInput).then(function (user) { diff --git a/src/controllers/playback/video/index.js b/src/controllers/playback/video/index.js index b6439216ce..a1abf780fe 100644 --- a/src/controllers/playback/video/index.js +++ b/src/controllers/playback/video/index.js @@ -1941,47 +1941,47 @@ export default function (view) { // Register to SyncPlay playback events and show big animated icon const showIcon = (action) => { - let primary_icon_name = ''; - let secondary_icon_name = ''; - let animation_class = 'oneShotPulse'; + let primaryIconName = ''; + let secondaryIconName = ''; + let animationClass = 'oneShotPulse'; let iconVisibilityTime = 1500; const syncPlayIcon = view.querySelector('#syncPlayIcon'); switch (action) { case 'schedule-play': - primary_icon_name = 'sync spin'; - secondary_icon_name = 'play_arrow centered'; - animation_class = 'infinitePulse'; + primaryIconName = 'sync spin'; + secondaryIconName = 'play_arrow centered'; + animationClass = 'infinitePulse'; iconVisibilityTime = -1; hideOsd(); break; case 'unpause': - primary_icon_name = 'play_circle_outline'; + primaryIconName = 'play_circle_outline'; break; case 'pause': - primary_icon_name = 'pause_circle_outline'; + primaryIconName = 'pause_circle_outline'; showOsd(); break; case 'seek': - primary_icon_name = 'update'; - animation_class = 'infinitePulse'; + primaryIconName = 'update'; + animationClass = 'infinitePulse'; iconVisibilityTime = -1; break; case 'buffering': - primary_icon_name = 'schedule'; - animation_class = 'infinitePulse'; + primaryIconName = 'schedule'; + animationClass = 'infinitePulse'; iconVisibilityTime = -1; break; case 'wait-pause': - primary_icon_name = 'schedule'; - secondary_icon_name = 'pause shifted'; - animation_class = 'infinitePulse'; + primaryIconName = 'schedule'; + secondaryIconName = 'pause shifted'; + animationClass = 'infinitePulse'; iconVisibilityTime = -1; break; case 'wait-unpause': - primary_icon_name = 'schedule'; - secondary_icon_name = 'play_arrow shifted'; - animation_class = 'infinitePulse'; + primaryIconName = 'schedule'; + secondaryIconName = 'play_arrow shifted'; + animationClass = 'infinitePulse'; iconVisibilityTime = -1; break; default: { @@ -1990,13 +1990,13 @@ export default function (view) { } } - syncPlayIcon.setAttribute('class', 'syncPlayIconCircle ' + animation_class); + syncPlayIcon.setAttribute('class', 'syncPlayIconCircle ' + animationClass); const primaryIcon = syncPlayIcon.querySelector('.primary-icon'); - primaryIcon.setAttribute('class', 'primary-icon material-icons ' + primary_icon_name); + primaryIcon.setAttribute('class', 'primary-icon material-icons ' + primaryIconName); const secondaryIcon = syncPlayIcon.querySelector('.secondary-icon'); - secondaryIcon.setAttribute('class', 'secondary-icon material-icons ' + secondary_icon_name); + secondaryIcon.setAttribute('class', 'secondary-icon material-icons ' + secondaryIconName); const clone = syncPlayIcon.cloneNode(true); clone.style.visibility = 'visible'; diff --git a/src/lib/legacy/domParserTextHtml.js b/src/lib/legacy/domParserTextHtml.js index f5a03ae442..cea84c79f6 100644 --- a/src/lib/legacy/domParserTextHtml.js +++ b/src/lib/legacy/domParserTextHtml.js @@ -12,8 +12,8 @@ (function (DOMParser) { 'use strict'; - const DOMParser_proto = DOMParser.prototype; - const real_parseFromString = DOMParser_proto.parseFromString; + const DOMParserPrototype = DOMParser.prototype; + const realParseFromString = DOMParserPrototype.parseFromString; // Firefox/Opera/IE throw errors on unsupported types try { @@ -24,13 +24,13 @@ } } catch (ex) { /* noop */ } - DOMParser_proto.parseFromString = function (markup, type) { + DOMParserPrototype.parseFromString = function (markup, type) { if (/^\s*text\/html\s*(?:;|$)/i.test(type)) { const doc = document.implementation.createHTMLDocument(''); doc.documentElement.innerHTML = markup; return doc; } else { - return real_parseFromString.apply(this, arguments); + return realParseFromString.apply(this, arguments); } }; }(DOMParser)); diff --git a/src/lib/legacy/htmlMediaElement.js b/src/lib/legacy/htmlMediaElement.js index b7a2c70825..b01389fded 100644 --- a/src/lib/legacy/htmlMediaElement.js +++ b/src/lib/legacy/htmlMediaElement.js @@ -7,12 +7,12 @@ (function (HTMLMediaElement) { 'use strict'; - const HTMLMediaElement_proto = HTMLMediaElement.prototype; - const real_play = HTMLMediaElement_proto.play; + const HTMLMediaElementPrototype = HTMLMediaElement.prototype; + const realPlay = HTMLMediaElementPrototype.play; - HTMLMediaElement_proto.play = function () { + HTMLMediaElementPrototype.play = function () { try { - const promise = real_play.apply(this, arguments); + const promise = realPlay.apply(this, arguments); if (typeof promise?.then === 'function') { return promise; diff --git a/src/scripts/browser.js b/src/scripts/browser.js index 2a55df8d99..e2f593e70b 100644 --- a/src/scripts/browser.js +++ b/src/scripts/browser.js @@ -204,7 +204,7 @@ const uaMatch = function (ua) { const versionMatch = /(version)[ /]([\w.]+)/.exec(ua); - let platform_match = /(ipad)/.exec(ua) + let platformMatch = /(ipad)/.exec(ua) || /(iphone)/.exec(ua) || /(windows)/.exec(ua) || /(android)/.exec(ua) @@ -213,7 +213,7 @@ const uaMatch = function (ua) { let browser = match[1] || ''; if (browser === 'edge') { - platform_match = ['']; + platformMatch = ['']; } if (browser === 'opr') { @@ -236,7 +236,7 @@ const uaMatch = function (ua) { return { browser: browser, version: version, - platform: platform_match[0] || '', + platform: platformMatch[0] || '', versionMajor: versionMajor }; }; diff --git a/src/scripts/editorsidebar.js b/src/scripts/editorsidebar.js index 28fb861917..37094e5d03 100644 --- a/src/scripts/editorsidebar.js +++ b/src/scripts/editorsidebar.js @@ -6,6 +6,8 @@ import globalize from 'lib/globalize'; import Dashboard from 'utils/dashboard'; import { getParameterByName } from 'utils/url'; +// Disable the naming rules since jstree requires snake_case variables +/* eslint-disable @typescript-eslint/naming-convention */ function getNode(item, folderState, selected) { const htmlName = getNodeInnerHtml(item); const node = { @@ -336,4 +338,4 @@ window.MetadataEditor = { getCurrentItemId: getCurrentItemId, setCurrentItemId: setCurrentItemId }; - +/* eslint-enable @typescript-eslint/naming-convention */ diff --git a/src/utils/events.ts b/src/utils/events.ts index 97d8852151..6e56510df5 100644 --- a/src/utils/events.ts +++ b/src/utils/events.ts @@ -3,9 +3,9 @@ export interface Event { type: string; } -type callback = (e: Event, ...args: any[]) => void; +type Callback = (e: Event, ...args: any[]) => void; -function getCallbacks(obj: any, type: string): callback[] { +function getCallbacks(obj: any, type: string): Callback[] { if (!obj) { throw new Error('obj cannot be null!'); } @@ -23,13 +23,13 @@ function getCallbacks(obj: any, type: string): callback[] { } export default { - on(obj: any, type: string, fn: callback): void { + on(obj: any, type: string, fn: Callback): void { const callbacks = getCallbacks(obj, type); callbacks.push(fn); }, - off(obj: any, type: string, fn: callback): void { + off(obj: any, type: string, fn: Callback): void { const callbacks = getCallbacks(obj, type); const i = callbacks.indexOf(fn);