1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Merge pull request #4025 from thornbill/eslint-array-callback-return-foreach

Enable eslint array-callback-return foreach checking
This commit is contained in:
Bill Thornton 2022-10-11 03:02:07 -04:00 committed by GitHub
commit 2d0ca949b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 7 deletions

View file

@ -34,7 +34,7 @@ module.exports = {
'plugin:sonarjs/recommended' 'plugin:sonarjs/recommended'
], ],
rules: { rules: {
'array-callback-return': ['error'], 'array-callback-return': ['error', { 'checkForEach': true }],
'block-spacing': ['error'], 'block-spacing': ['error'],
'brace-style': ['error', '1tbs', { 'allowSingleLine': true }], 'brace-style': ['error', '1tbs', { 'allowSingleLine': true }],
'comma-dangle': ['error', 'never'], 'comma-dangle': ['error', 'never'],

View file

@ -159,11 +159,15 @@ import { Events } from 'jellyfin-apiclient';
// (but rewinding cannot happen as the first event with media of non-empty duration) // (but rewinding cannot happen as the first event with media of non-empty duration)
console.debug(`seeking to ${seconds} on ${e.type} event`); console.debug(`seeking to ${seconds} on ${e.type} event`);
setCurrentTimeIfNeeded(element, seconds); setCurrentTimeIfNeeded(element, seconds);
events.forEach(name => element.removeEventListener(name, onMediaChange)); events.forEach(name => {
element.removeEventListener(name, onMediaChange);
});
if (onMediaReady) onMediaReady(); if (onMediaReady) onMediaReady();
} }
}; };
events.forEach(name => element.addEventListener(name, onMediaChange)); events.forEach(name => {
element.addEventListener(name, onMediaChange);
});
} }
} }
} }

View file

@ -205,8 +205,12 @@ function renderTrackSelections(page, instance, item, forceReload) {
}); });
mediaSources = []; mediaSources = [];
resolutionNames.forEach(v => mediaSources.push(v)); resolutionNames.forEach(v => {
sourceNames.forEach(v => mediaSources.push(v)); mediaSources.push(v);
});
sourceNames.forEach(v => {
mediaSources.push(v);
});
instance._currentPlaybackMediaSources = mediaSources; instance._currentPlaybackMediaSources = mediaSources;

View file

@ -56,7 +56,8 @@ export default function (urls) {
urls.forEach(function (url) { urls.forEach(function (url) {
// the download init has to be sequential for firefox if the urls are not on the same domain // the download init has to be sequential for firefox if the urls are not on the same domain
if (browser.firefox && !sameDomain(url)) { if (browser.firefox && !sameDomain(url)) {
return setTimeout(download.bind(null, url), 100 * ++delay); setTimeout(download.bind(null, url), 100 * ++delay);
return;
} }
download(url); download(url);

View file

@ -43,7 +43,9 @@ export default {
*/ */
downloadFiles(items) { downloadFiles(items) {
if (window.NativeShell?.downloadFile) { if (window.NativeShell?.downloadFile) {
items.forEach(item => window.NativeShell.downloadFile(item)); items.forEach(item => {
window.NativeShell.downloadFile(item);
});
return true; return true;
} }
return false; return false;