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

Merge pull request #3509 from sancodes/eslint-novoid

add eslint novoid
This commit is contained in:
Bill Thornton 2022-04-13 00:44:30 -04:00 committed by GitHub
commit 13a70d3186
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 61 additions and 31 deletions

View file

@ -59,7 +59,8 @@ module.exports = {
'no-var': ['error'],
'space-before-blocks': ['error'],
'space-infix-ops': 'error',
'yoda': 'error'
'yoda': 'error',
'no-void': ['error', { "allowAsStatement": true }]
},
settings: {
react: {

View file

@ -51,7 +51,8 @@ import template from './accessSchedule.template.html';
};
if (parseFloat(updatedSchedule.StartHour) >= parseFloat(updatedSchedule.EndHour)) {
return void alert(globalize.translate('ErrorStartHourGreaterThanEnd'));
alert(globalize.translate('ErrorStartHourGreaterThanEnd'));
return;
}
context.submitted = true;

View file

@ -23,7 +23,8 @@ import ServerConnections from './ServerConnections';
if (!actionableParent || actionableParent.classList.contains('cardContent')) {
apiClient.getJSON(apiClient.getUrl('Users/' + userId + '/Items/Latest', options)).then(function (items) {
if (items.length === 1) {
return void appRouter.showItem(items[0]);
appRouter.showItem(items[0]);
return;
}
const url = 'details?id=' + itemId + '&serverId=' + serverId;

View file

@ -323,7 +323,8 @@ import template from './libraryoptionseditor.template.html';
function onImageFetchersContainerClick(e) {
const btnImageOptionsForType = dom.parentWithClass(e.target, 'btnImageOptionsForType');
if (btnImageOptionsForType) {
return void showImageOptionsForType(dom.parentWithClass(btnImageOptionsForType, 'imageFetcher').getAttribute('data-type'));
showImageOptionsForType(dom.parentWithClass(btnImageOptionsForType, 'imageFetcher').getAttribute('data-type'));
return;
}
onSortableContainerClick.call(this, e);
}

View file

@ -122,9 +122,10 @@ export default function (page, providerId, options) {
const selectedListingsId = $('#selectListing', page).val();
if (!selectedListingsId) {
return void Dashboard.alert({
Dashboard.alert({
message: globalize.translate('ErrorPleaseSelectLineup')
});
return;
}
loading.show();
@ -168,7 +169,8 @@ export default function (page, providerId, options) {
function refreshListings(value) {
if (!value) {
return void $('#selectListing', page).html('');
$('#selectListing', page).html('');
return;
}
loading.show();

View file

@ -175,7 +175,8 @@ import confirm from '../../components/confirm/confirm';
if (!result.Items.length) {
view.querySelector('.activeRecordingsSection').classList.add('hide');
return void(itemsContainer.innerHTML = '');
itemsContainer.innerHTML = '';
return;
}
view.querySelector('.activeRecordingsSection').classList.remove('hide');

View file

@ -140,7 +140,8 @@ function renderSeriesTimerSchedule(page, apiClient, seriesTimerId) {
function renderTimerEditor(page, item, apiClient, user) {
if (item.Type !== 'Recording' || !user.Policy.EnableLiveTvManagement || !item.TimerId || item.Status !== 'InProgress') {
return void hideAll(page, 'btnCancelTimer');
hideAll(page, 'btnCancelTimer');
return;
}
hideAll(page, 'btnCancelTimer', true);
@ -148,7 +149,8 @@ function renderTimerEditor(page, item, apiClient, user) {
function renderSeriesTimerEditor(page, item, apiClient, user) {
if (item.Type !== 'SeriesTimer') {
return void hideAll(page, 'btnCancelSeriesTimer');
hideAll(page, 'btnCancelSeriesTimer');
return;
}
if (user.Policy.EnableLiveTvManagement) {
@ -160,11 +162,13 @@ function renderSeriesTimerEditor(page, item, apiClient, user) {
page.querySelector('.seriesTimerScheduleSection').classList.remove('hide');
hideAll(page, 'btnCancelSeriesTimer', true);
return void renderSeriesTimerSchedule(page, apiClient, item.Id);
renderSeriesTimerSchedule(page, apiClient, item.Id);
return;
}
page.querySelector('.seriesTimerScheduleSection').classList.add('hide');
return void hideAll(page, 'btnCancelSeriesTimer');
hideAll(page, 'btnCancelSeriesTimer');
return;
}
function renderTrackSelections(page, instance, item, forceReload) {
@ -808,7 +812,8 @@ function renderNextUp(page, item, user) {
const section = page.querySelector('.nextUpSection');
if (item.Type != 'Series') {
return void section.classList.add('hide');
section.classList.add('hide');
return;
}
ServerConnections.getApiClient(item.ServerId).getNextUpEpisodes({
@ -1115,7 +1120,8 @@ function renderMoreFromSeason(view, item, apiClient) {
if (section) {
if (item.Type !== 'Episode' || !item.SeasonId || !item.SeriesId) {
return void section.classList.add('hide');
section.classList.add('hide');
return;
}
const userId = apiClient.getCurrentUserId();
@ -1125,7 +1131,8 @@ function renderMoreFromSeason(view, item, apiClient) {
Fields: 'ItemCounts,PrimaryImageAspectRatio,BasicSyncInfo,CanDelete,MediaSourceCount'
}).then(function (result) {
if (result.Items.length < 2) {
return void section.classList.add('hide');
section.classList.add('hide');
return;
}
section.classList.remove('hide');
@ -1160,10 +1167,12 @@ function renderMoreFromArtist(view, item, apiClient) {
if (section) {
if (item.Type === 'MusicArtist') {
if (!apiClient.isMinServerVersion('3.4.1.19')) {
return void section.classList.add('hide');
section.classList.add('hide');
return;
}
} else if (item.Type !== 'MusicAlbum' || !item.AlbumArtists || !item.AlbumArtists.length) {
return void section.classList.add('hide');
section.classList.add('hide');
return;
}
const query = {
@ -1182,7 +1191,8 @@ function renderMoreFromArtist(view, item, apiClient) {
apiClient.getItems(apiClient.getCurrentUserId(), query).then(function (result) {
if (!result.Items.length) {
return void section.classList.add('hide');
section.classList.add('hide');
return;
}
section.classList.remove('hide');
@ -1216,7 +1226,8 @@ function renderSimilarItems(page, item, context) {
if (similarCollapsible) {
if (item.Type != 'Movie' && item.Type != 'Trailer' && item.Type != 'Series' && item.Type != 'Program' && item.Type != 'Recording' && item.Type != 'MusicAlbum' && item.Type != 'MusicArtist' && item.Type != 'Playlist') {
return void similarCollapsible.classList.add('hide');
similarCollapsible.classList.add('hide');
return;
}
similarCollapsible.classList.remove('hide');
@ -1233,7 +1244,8 @@ function renderSimilarItems(page, item, context) {
apiClient.getSimilarItems(item.Id, options).then(function (result) {
if (!result.Items.length) {
return void similarCollapsible.classList.add('hide');
similarCollapsible.classList.add('hide');
return;
}
similarCollapsible.classList.remove('hide');
@ -1820,7 +1832,8 @@ function renderCast(page, item) {
});
if (!people.length) {
return void page.querySelector('#castCollapsible').classList.add('hide');
page.querySelector('#castCollapsible').classList.add('hide');
return;
}
page.querySelector('#castCollapsible').classList.remove('hide');
@ -1915,11 +1928,12 @@ export default function (view, params) {
if (item.Type === 'Program') {
const apiClient = ServerConnections.getApiClient(item.ServerId);
return void apiClient.getLiveTvChannel(item.ChannelId, apiClient.getCurrentUserId()).then(function (channel) {
apiClient.getLiveTvChannel(item.ChannelId, apiClient.getCurrentUserId()).then(function (channel) {
playbackManager.play({
items: [channel]
});
});
return;
}
playItem(item, item.UserData && mode === 'resume' ? item.UserData.PlaybackPositionTicks : 0);

View file

@ -721,7 +721,7 @@ class ItemsView {
return globalize.translate('Videos');
}
return void 0;
return;
}
function play() {

View file

@ -55,14 +55,16 @@ import LibraryMenu from '../../../scripts/libraryMenu';
recordingButtonManager = null;
}
return void view.querySelector('.btnRecord').classList.add('hide');
view.querySelector('.btnRecord').classList.add('hide');
return;
}
ServerConnections.getApiClient(item.ServerId).getCurrentUser().then(function (user) {
if (user.Policy.EnableLiveTvManagement) {
import('../../../components/recordingcreator/recordingbutton').then(({default: RecordingButton}) => {
if (recordingButtonManager) {
return void recordingButtonManager.refreshItem(item);
recordingButtonManager.refreshItem(item);
return;
}
recordingButtonManager = new RecordingButton({
@ -1450,7 +1452,8 @@ import LibraryMenu from '../../../scripts/libraryMenu';
/* eslint-disable-next-line compat/compat */
dom.addEventListener(view, window.PointerEvent ? 'pointerdown' : 'click', function (e) {
if (dom.parentWithClass(e.target, ['videoOsdBottom', 'upNextContainer'])) {
return void showOsd();
showOsd();
return;
}
const pointerType = e.pointerType || (layoutManager.mobile ? 'touch' : 'mouse');

View file

@ -5,17 +5,19 @@ import Dashboard from '../../../utils/dashboard';
function processForgotPasswordResult(result) {
if (result.Action == 'ContactAdmin') {
return void Dashboard.alert({
Dashboard.alert({
message: globalize.translate('MessageContactAdminToResetPassword'),
title: globalize.translate('ButtonForgotPassword')
});
return;
}
if (result.Action == 'InNetworkRequired') {
return void Dashboard.alert({
Dashboard.alert({
message: globalize.translate('MessageForgotPasswordInNetworkRequired'),
title: globalize.translate('ButtonForgotPassword')
});
return;
}
if (result.Action == 'PinCode') {
@ -26,13 +28,14 @@ import Dashboard from '../../../utils/dashboard';
msg += '<br/>';
msg += result.PinFile;
msg += '<br/>';
return void Dashboard.alert({
Dashboard.alert({
message: msg,
title: globalize.translate('ButtonForgotPassword'),
callback: function () {
Dashboard.navigate('forgotpasswordpin.html');
}
});
return;
}
}

View file

@ -9,13 +9,14 @@ import Dashboard from '../../../utils/dashboard';
msg += '<br/>';
msg += '<br/>';
msg += result.UsersReset.join('<br/>');
return void Dashboard.alert({
Dashboard.alert({
message: msg,
title: globalize.translate('HeaderPasswordReset'),
callback: function () {
window.location.href = 'index.html';
}
});
return;
}
Dashboard.alert({

View file

@ -646,7 +646,8 @@ import { getParameterByName } from '../utils/url.ts';
if (!user) {
showBySelector('.libraryMenuDownloads', false);
showBySelector('.lnkSyncToOtherDevices', false);
return void showBySelector('.userMenuOptions', false);
showBySelector('.userMenuOptions', false);
return;
}
if (user.Policy.EnableContentDownloading) {
@ -958,7 +959,8 @@ import { getParameterByName } from '../utils/url.ts';
function setTitle (title) {
if (title == null) {
return void LibraryMenu.setDefaultTitle();
LibraryMenu.setDefaultTitle();
return;
}
if (title === '-') {