Merge pull request #4014 from thornbill/eslint-no-small-switch
Fix sonarjs no-small-switch
This commit is contained in:
commit
8a9cdbfca3
8 changed files with 29 additions and 46 deletions
|
@ -76,7 +76,6 @@ module.exports = {
|
|||
'sonarjs/cognitive-complexity': ['warn'],
|
||||
// TODO: Enable the following rules and fix issues
|
||||
'sonarjs/no-duplicate-string': ['off'],
|
||||
'sonarjs/no-small-switch': ['off'],
|
||||
'sonarjs/prefer-object-literal': ['off'],
|
||||
'sonarjs/prefer-single-boolean-return': ['off']
|
||||
},
|
||||
|
|
|
@ -277,28 +277,23 @@ import { Events } from 'jellyfin-apiclient';
|
|||
hls.on(Hls.Events.ERROR, function (event, data) {
|
||||
console.error('HLS Error: Type: ' + data.type + ' Details: ' + (data.details || '') + ' Fatal: ' + (data.fatal || false));
|
||||
|
||||
switch (data.type) {
|
||||
case Hls.ErrorTypes.NETWORK_ERROR:
|
||||
// try to recover network error
|
||||
if (data.response && data.response.code && data.response.code >= 400) {
|
||||
console.debug('hls.js response error code: ' + data.response.code);
|
||||
// try to recover network error
|
||||
if (data.type === Hls.ErrorTypes.NETWORK_ERROR
|
||||
&& data.response?.code && data.response.code >= 400
|
||||
) {
|
||||
console.debug('hls.js response error code: ' + data.response.code);
|
||||
|
||||
// Trigger failure differently depending on whether this is prior to start of playback, or after
|
||||
hls.destroy();
|
||||
// Trigger failure differently depending on whether this is prior to start of playback, or after
|
||||
hls.destroy();
|
||||
|
||||
if (reject) {
|
||||
reject('servererror');
|
||||
reject = null;
|
||||
} else {
|
||||
onErrorInternal(instance, 'servererror');
|
||||
}
|
||||
if (reject) {
|
||||
reject('servererror');
|
||||
reject = null;
|
||||
} else {
|
||||
onErrorInternal(instance, 'servererror');
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
return;
|
||||
}
|
||||
|
||||
if (data.fatal) {
|
||||
|
|
|
@ -334,12 +334,8 @@ function showDownloadOptions(button, context, subtitleId) {
|
|||
positionTo: button
|
||||
|
||||
}).then(function (id) {
|
||||
switch (id) {
|
||||
case 'download':
|
||||
downloadRemoteSubtitles(context, subtitleId);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
if (id === 'download') {
|
||||
downloadRemoteSubtitles(context, subtitleId);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
|
@ -66,11 +66,9 @@ function renderRecordingFolders(context, promise) {
|
|||
|
||||
function onMoreClick() {
|
||||
const type = this.getAttribute('data-type');
|
||||
const serverId = ApiClient.serverId();
|
||||
|
||||
switch (type) {
|
||||
case 'latest':
|
||||
Dashboard.navigate('list.html?type=Recordings&serverId=' + serverId);
|
||||
if (type === 'latest') {
|
||||
Dashboard.navigate('list.html?type=Recordings&serverId=' + ApiClient.serverId());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -374,10 +374,9 @@ import Dashboard from '../../utils/dashboard';
|
|||
}
|
||||
|
||||
function onInputCommand(e) {
|
||||
switch (e.detail.command) {
|
||||
case 'search':
|
||||
e.preventDefault();
|
||||
Dashboard.navigate('search.html?collectionType=movies&parentId=' + params.topParentId);
|
||||
if (e.detail.command === 'search') {
|
||||
e.preventDefault();
|
||||
Dashboard.navigate('search.html?collectionType=movies&parentId=' + params.topParentId);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -348,10 +348,9 @@ import Dashboard from '../../utils/dashboard';
|
|||
}
|
||||
|
||||
function onInputCommand(e) {
|
||||
switch (e.detail.command) {
|
||||
case 'search':
|
||||
e.preventDefault();
|
||||
Dashboard.navigate('search.html?collectionType=music&parentId=' + params.topParentId);
|
||||
if (e.detail.command === 'search') {
|
||||
e.preventDefault();
|
||||
Dashboard.navigate('search.html?collectionType=music&parentId=' + params.topParentId);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -333,10 +333,9 @@ import autoFocuser from '../../components/autoFocuser';
|
|||
}
|
||||
|
||||
function onInputCommand(e) {
|
||||
switch (e.detail.command) {
|
||||
case 'search':
|
||||
e.preventDefault();
|
||||
Dashboard.navigate('search.html?collectionType=tv&parentId=' + params.topParentId);
|
||||
if (e.detail.command === 'search') {
|
||||
e.preventDefault();
|
||||
Dashboard.navigate('search.html?collectionType=tv&parentId=' + params.topParentId);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -172,10 +172,8 @@ export class ComicsPlayer {
|
|||
|
||||
onWindowKeyUp(e) {
|
||||
const key = keyboardnavigation.getKeyName(e);
|
||||
switch (key) {
|
||||
case 'Escape':
|
||||
this.stop();
|
||||
break;
|
||||
if (key === 'Escape') {
|
||||
this.stop();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue