mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Fix lint errors
This commit is contained in:
parent
7d9acf30b6
commit
4730a30c3d
29 changed files with 53 additions and 23 deletions
|
@ -16,6 +16,7 @@ const MarkdownBox: FC<MarkdownBoxProps> = ({
|
|||
<Box
|
||||
dangerouslySetInnerHTML={
|
||||
markdown ?
|
||||
// eslint-disable-next-line sonarjs/disabled-auto-escaping
|
||||
{ __html: DOMPurify.sanitize(markdownIt({ html: true }).render(markdown)) } :
|
||||
undefined
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ interface CardTextProps {
|
|||
|
||||
const CardText: FC<CardTextProps> = ({ className, textLine }) => {
|
||||
const { title, titleAction } = textLine;
|
||||
// eslint-disable-next-line sonarjs/function-return-type
|
||||
const renderCardText = () => {
|
||||
if (titleAction) {
|
||||
return (
|
||||
|
|
|
@ -323,7 +323,7 @@ function shouldShowMediaTitle(
|
|||
}
|
||||
|
||||
function shouldShowExtraType(itemExtraType: NullableString) {
|
||||
return itemExtraType && itemExtraType !== 'Unknown';
|
||||
return !!(itemExtraType && itemExtraType !== 'Unknown');
|
||||
}
|
||||
|
||||
function shouldShowSeriesYearOrYear(
|
||||
|
@ -351,7 +351,7 @@ function shouldShowPersonRoleOrType(
|
|||
showPersonRoleOrType: boolean | undefined,
|
||||
item: ItemDto
|
||||
) {
|
||||
return showPersonRoleOrType && (item as BaseItemPerson).Role;
|
||||
return !!(showPersonRoleOrType && (item as BaseItemPerson).Role);
|
||||
}
|
||||
|
||||
function shouldShowParentTitle(
|
||||
|
|
|
@ -195,6 +195,7 @@ function buildCardsHtmlInternal(items, options) {
|
|||
if (isVertical) {
|
||||
html += '</div>';
|
||||
}
|
||||
// eslint-disable-next-line sonarjs/no-dead-store
|
||||
hasOpenSection = false;
|
||||
}
|
||||
|
||||
|
@ -215,6 +216,7 @@ function buildCardsHtmlInternal(items, options) {
|
|||
if (options.rows && itemsInRow === 0) {
|
||||
if (hasOpenRow) {
|
||||
html += '</div>';
|
||||
// eslint-disable-next-line sonarjs/no-dead-store
|
||||
hasOpenRow = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import globalize from '../../../lib/globalize';
|
|||
import IconButtonElement from '../../../elements/IconButtonElement';
|
||||
|
||||
type AccessScheduleListProps = {
|
||||
index: number;
|
||||
index?: number;
|
||||
DayOfWeek?: string;
|
||||
StartHour?: number ;
|
||||
EndHour?: number;
|
||||
|
|
|
@ -3,7 +3,6 @@ import globalize from 'lib/globalize';
|
|||
import { getBackdropShape, getPortraitShape, getSquareShape } from 'utils/card';
|
||||
import { getParameterByName } from 'utils/url';
|
||||
|
||||
import { appHost } from './apphost';
|
||||
import cardBuilder from './cardbuilder/cardBuilder';
|
||||
import imageLoader from './images/imageLoader';
|
||||
import layoutManager from './layoutManager';
|
||||
|
@ -160,8 +159,10 @@ function loadSection(elem, userId, topParentId, section, isSingleSection) {
|
|||
html += '<div is="emby-itemscontainer" class="itemsContainer vertical-wrap padded-left padded-right">';
|
||||
}
|
||||
|
||||
let cardLayout = appHost.preferVisualCards && section.autoCardLayout && section.showTitle;
|
||||
cardLayout = false;
|
||||
// NOTE: Why is card layout always disabled?
|
||||
// let cardLayout = appHost.preferVisualCards && section.autoCardLayout && section.showTitle;
|
||||
const cardLayout = false;
|
||||
|
||||
html += cardBuilder.getCardsHtml(result.Items, {
|
||||
preferThumb: section.preferThumb,
|
||||
shape: section.shape,
|
||||
|
|
|
@ -74,6 +74,7 @@ function fetchWithTimeout(url, options, timeoutMs) {
|
|||
*/
|
||||
function paramsToString(params) {
|
||||
return Object.entries(params)
|
||||
// eslint-disable-next-line sonarjs/different-types-comparison
|
||||
.filter(([, v]) => v !== null && v !== undefined && v !== '')
|
||||
.map(([k, v]) => `${encodeURIComponent(k)}=${encodeURIComponent(v)}`)
|
||||
.join('&');
|
||||
|
|
|
@ -389,6 +389,7 @@ function intersectsInternal(a1, a2, b1, b2) {
|
|||
}
|
||||
|
||||
function intersects(a1, a2, b1, b2) {
|
||||
// eslint-disable-next-line sonarjs/arguments-order
|
||||
return intersectsInternal(a1, a2, b1, b2) || intersectsInternal(b1, b2, a1, a2);
|
||||
}
|
||||
|
||||
|
|
|
@ -80,7 +80,7 @@ export function handleHlsJsMediaError(instance, reject) {
|
|||
let now = Date.now();
|
||||
|
||||
if (window.performance?.now) {
|
||||
now = performance.now(); // eslint-disable-line compat/compat
|
||||
now = performance.now();
|
||||
}
|
||||
|
||||
if (!recoverDecodingErrorDate || (now - recoverDecodingErrorDate) > 3000) {
|
||||
|
@ -373,6 +373,7 @@ export function getBufferedRanges(instance, elem) {
|
|||
start = 0;
|
||||
}
|
||||
if (!isValidDuration(end)) {
|
||||
// eslint-disable-next-line sonarjs/no-dead-store
|
||||
end = 0;
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -417,6 +417,7 @@ export function getListViewHtml(options) {
|
|||
}
|
||||
|
||||
if (enableOverview && item.Overview) {
|
||||
// eslint-disable-next-line sonarjs/disabled-auto-escaping
|
||||
const overview = DOMPurify.sanitize(markdownIt({ html: true }).render(item.Overview || ''));
|
||||
html += '<div class="secondary listItem-overview listItemBodyText">';
|
||||
html += '<bdi>' + overview + '</bdi>';
|
||||
|
|
|
@ -13,6 +13,7 @@ interface MediaInfoItemProps {
|
|||
const MediaInfoItem: FC<MediaInfoItemProps> = ({ className, miscInfo }) => {
|
||||
const { text, textAction, cssClass, type } = miscInfo;
|
||||
|
||||
// eslint-disable-next-line sonarjs/function-return-type
|
||||
const renderText = () => {
|
||||
if (textAction) {
|
||||
return (
|
||||
|
|
|
@ -208,6 +208,7 @@ function getMimeType(type, container) {
|
|||
}
|
||||
|
||||
function getParam(name, url) {
|
||||
// eslint-disable-next-line sonarjs/single-char-in-character-classes
|
||||
name = name.replace(/[[]/, '\\[').replace(/[\]]/, '\\]');
|
||||
const regexS = '[\\?&]' + name + '=([^&#]*)';
|
||||
const regex = new RegExp(regexS, 'i');
|
||||
|
@ -2115,6 +2116,7 @@ export class PlaybackManager {
|
|||
|
||||
if (!state) {
|
||||
playerStates[player.name] = {};
|
||||
// eslint-disable-next-line sonarjs/no-dead-store
|
||||
state = playerStates[player.name];
|
||||
}
|
||||
|
||||
|
|
|
@ -90,6 +90,7 @@ class SkipSegment extends PlaybackSubscriber {
|
|||
elem.classList.remove('no-transition');
|
||||
}
|
||||
|
||||
// eslint-disable-next-line sonarjs/void-use
|
||||
void elem.offsetWidth;
|
||||
|
||||
const hasFocus = document.activeElement && focusManager.isCurrentlyFocusable(document.activeElement);
|
||||
|
@ -111,6 +112,7 @@ class SkipSegment extends PlaybackSubscriber {
|
|||
const elem = this.skipElement;
|
||||
if (elem) {
|
||||
elem.classList.remove('no-transition');
|
||||
// eslint-disable-next-line sonarjs/void-use
|
||||
void elem.offsetWidth;
|
||||
|
||||
requestAnimationFrame(() => {
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
// TODO: Check if needed and move to external dependency
|
||||
// From https://github.com/parshap/node-sanitize-filename
|
||||
|
||||
// eslint-disable-next-line sonarjs/duplicates-in-character-class
|
||||
const illegalRe = /[/?<>\\:*|":]/g;
|
||||
// eslint-disable-next-line no-control-regex
|
||||
// eslint-disable-next-line no-control-regex, sonarjs/no-control-regex
|
||||
const controlRe = /[\x00-\x1f\x80-\x9f]/g;
|
||||
const reservedRe = /^\.+$/;
|
||||
// eslint-disable-next-line sonarjs/concise-regex
|
||||
const windowsReservedRe = /^(con|prn|aux|nul|com[0-9]|lpt[0-9])(\..*)?$/i;
|
||||
// eslint-disable-next-line sonarjs/slow-regex
|
||||
const windowsTrailingRe = /[. ]+$/;
|
||||
|
||||
function isHighSurrogate(codePoint) {
|
||||
|
@ -64,6 +67,7 @@ function truncate(string, byteLength) {
|
|||
segment = string[i];
|
||||
|
||||
if (isHighSurrogate(codePoint) && isLowSurrogate(string.charCodeAt(i + 1))) {
|
||||
// eslint-disable-next-line sonarjs/updated-loop-counter
|
||||
i += 1;
|
||||
segment += string[i];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue