Skip to content

Commit

Permalink
pacify es-lint 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Sky-High committed Sep 25, 2023
1 parent edbd063 commit a909ba9
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 30 deletions.
4 changes: 2 additions & 2 deletions src/components/__tests__/jellyfinApi.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { JellyfinApi } from '../jellyfinApi';

const setupMockCastSenders = (): void => {
const getSenders = (): Array<any> => [{ id: 'thisIsSenderId' }]; // eslint-disable-line no-explicit-any
const getInstance = (): any => ({ getSenders }); // eslint-disable-line no-explicit-any
const getSenders = (): Array<any> => [{ id: 'thisIsSenderId' }]; // eslint-disable-line @typescript-eslint/no-explicit-any
const getInstance = (): any => ({ getSenders }); // eslint-disable-line @typescript-eslint/no-explicit-any

// @ts-expect-error cast is already defined globally, however since we're mocking it we need to redefine it.
global.cast = {
Expand Down
4 changes: 2 additions & 2 deletions src/components/fetchhelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @param request - Custom request object, mostly modeled after RequestInit.
* @returns response promise
*/
function getFetchPromise(request: any): Promise<Response> { // eslint-disable-line no-explicit-any
function getFetchPromise(request: any): Promise<Response> { // eslint-disable-line @typescript-eslint/no-explicit-any
const headers = request.headers || {};

if (request.dataType === 'json') {
Expand Down Expand Up @@ -102,7 +102,7 @@ function paramsToString(params: Record<string, string>): string {
* @param request - RequestInit-like structure but with url/type/timeout parameters as well
* @returns response promise, may be automatically unpacked based on request datatype
*/
export async function ajax(request: any): Promise<Response | string> { // eslint-disable-line no-explicit-any
export async function ajax(request: any): Promise<Response | string> { // eslint-disable-line @typescript-eslint/no-explicit-any
if (!request) {
throw new Error('Request cannot be null');
}
Expand Down
6 changes: 3 additions & 3 deletions src/components/jellyfinActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function restartPingInterval(reportingParams: PlaybackProgressInfo): void {
stopPingInterval();

if (reportingParams.PlayMethod == 'Transcode') {
pingInterval = <any>setInterval(() => { // eslint-disable-line no-explicit-any
pingInterval = <any>setInterval(() => { // eslint-disable-line @typescript-eslint/no-explicit-any
pingTranscoder(reportingParams);
}, 1000);
}
Expand Down Expand Up @@ -183,7 +183,7 @@ export function pingTranscoder(
* @param customData - data to set on playback state.
* @param serverItem - item that is playing
*/
export function load(customData: any, serverItem: BaseItemDto): void { // eslint-disable-line no-explicit-any
export function load(customData: any, serverItem: BaseItemDto): void { // eslint-disable-line @typescript-eslint/no-explicit-any
PlaybackManager.resetPlaybackScope();

const state = PlaybackManager.playbackState;
Expand Down Expand Up @@ -255,7 +255,7 @@ export function getPlaybackInfo(
audioStreamIndex: number,
subtitleStreamIndex: number,
liveStreamId: string | null = null
): Promise<any> { // eslint-disable-line no-explicit-any
): Promise<any> { // eslint-disable-line @typescript-eslint/no-explicit-any
const postData = {
DeviceProfile: deviceProfile
};
Expand Down
4 changes: 2 additions & 2 deletions src/components/jellyfinApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export abstract class JellyfinApi {
}

// Authenticated ajax
public static authAjax(path: string, args: any): Promise<any> { // eslint-disable-line no-explicit-any
public static authAjax(path: string, args: any): Promise<any> { // eslint-disable-line @typescript-eslint/no-explicit-any
if (
this.userId === undefined ||
this.accessToken === undefined ||
Expand All @@ -146,7 +146,7 @@ export abstract class JellyfinApi {
}

// Authenticated ajax
public static authAjaxUser(path: string, args: any): Promise<any> { // eslint-disable-line no-explicit-any
public static authAjaxUser(path: string, args: any): Promise<any> { // eslint-disable-line @typescript-eslint/no-explicit-any
if (
this.userId === undefined ||
this.accessToken === undefined ||
Expand Down
28 changes: 14 additions & 14 deletions src/components/maincontroller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ export async function reportDeviceCapabilities(): Promise<void> {
* processMessage
* @param data - data
*/
export function processMessage(data: any): void { // eslint-disable-line no-explicit-any
export function processMessage(data: any): void { // eslint-disable-line @typescript-eslint/no-explicit-any
if (
!data.command ||
!data.serverAddress ||
Expand Down Expand Up @@ -385,7 +385,7 @@ export function setSubtitleStreamIndex(

// FIXME: Possible index error when MediaStreams is undefined.
const currentSubtitleStream = state.mediaSource?.MediaStreams?.filter(
(m: any) => { // eslint-disable-line no-explicit-any
(m: any) => { // eslint-disable-line @typescript-eslint/no-explicit-any
return m.Index == state.subtitleStreamIndex && m.Type == 'Subtitle';
}
)[0];
Expand Down Expand Up @@ -413,7 +413,7 @@ export function setSubtitleStreamIndex(
const mediaStreams = state.PlaybackMediaSource?.MediaStreams;

const subtitleStream = getStreamByIndex(
<any>mediaStreams, // eslint-disable-line no-explicit-any
<any>mediaStreams, // eslint-disable-line @typescript-eslint/no-explicit-any
'Subtitle',
index
);
Expand Down Expand Up @@ -488,7 +488,7 @@ export function seek(state: PlaybackState, ticks: number): Promise<void> {
export async function changeStream(
state: PlaybackState,
ticks: number,
params: any = undefined // eslint-disable-line no-explicit-any
params: any = undefined // eslint-disable-line @typescript-eslint/no-explicit-any
): Promise<void> {
if (
window.playerManager.getMediaInformation()?.customData.canClientSeek &&
Expand Down Expand Up @@ -534,8 +534,8 @@ export async function changeStream(
// TODO save namespace somewhere global?
window.castReceiverContext.addCustomMessageListener(
'urn:x-cast:com.connectsdk',
(evt: any) => { // eslint-disable-line no-explicit-any
let data: any = evt.data; // eslint-disable-line no-explicit-any
(evt: any) => { // eslint-disable-line @typescript-eslint/no-explicit-any
let data: any = evt.data; // eslint-disable-line @typescript-eslint/no-explicit-any

// Apparently chromium likes to pass it as json, not as object.
// chrome on android works fine
Expand All @@ -562,7 +562,7 @@ window.castReceiverContext.addCustomMessageListener(
* @returns promise
*/
export async function translateItems(
data: any, // eslint-disable-line no-explicit-any
data: any, // eslint-disable-line @typescript-eslint/no-explicit-any
options: PlayRequest,
method: string
): Promise<void> {
Expand Down Expand Up @@ -595,8 +595,8 @@ export async function translateItems(
* @returns promise
*/
export async function instantMix(
data: any, // eslint-disable-line no-explicit-any
options: any, // eslint-disable-line no-explicit-any
data: any, // eslint-disable-line @typescript-eslint/no-explicit-any
options: any, // eslint-disable-line @typescript-eslint/no-explicit-any
item: BaseItemDto
): Promise<void> {
const result = await getInstantMixItems(data.userId, item);
Expand All @@ -613,8 +613,8 @@ export async function instantMix(
* @returns promise
*/
export async function shuffle(
data: any, // eslint-disable-line no-explicit-any
options: any, // eslint-disable-line no-explicit-any
data: any, // eslint-disable-line @typescript-eslint/no-explicit-any
options: any, // eslint-disable-line @typescript-eslint/no-explicit-any
item: BaseItemDto
): Promise<void> {
const result = await getShuffleItems(data.userId, item);
Expand All @@ -633,7 +633,7 @@ export async function shuffle(
*/
export async function onStopPlayerBeforePlaybackDone(
item: BaseItemDto,
options: any // eslint-disable-line no-explicit-any
options: any // eslint-disable-line @typescript-eslint/no-explicit-any
): Promise<void> {
const data = await JellyfinApi.authAjaxUser(`Items/${item.Id}`, {
dataType: 'json',
Expand Down Expand Up @@ -697,7 +697,7 @@ export function showPlaybackInfoErrorMessage(error: string): void {
* @param versions - versions
* @returns stream
*/
export function getOptimalMediaSource(versions: Array<any>): any { // eslint-disable-line no-explicit-any
export function getOptimalMediaSource(versions: Array<any>): any { // eslint-disable-line @typescript-eslint/no-explicit-any
let optimalVersion = versions.filter((v) => {
checkDirectPlay(v);

Expand Down Expand Up @@ -830,7 +830,7 @@ export function setTextTrack(index: number | null): void {
export function createMediaInformation(
playSessionId: string,
item: BaseItemDto,
streamInfo: any // eslint-disable-line no-explicit-any
streamInfo: any // eslint-disable-line @typescript-eslint/no-explicit-any
): framework.messages.MediaInformation {
const mediaInfo = new cast.framework.messages.MediaInformation();

Expand Down
14 changes: 7 additions & 7 deletions src/components/playbackManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ export abstract class PlaybackManager {
return this.playerManager.getPlayerState() === cast.framework.messages.PlayerState.BUFFERING;
}

static async playFromOptions(options: any): Promise<void> { // eslint-disable-line no-explicit-any
static async playFromOptions(options: any): Promise<void> { // eslint-disable-line @typescript-eslint/no-explicit-any
const firstItem = options.items[0];

if (options.startPositionTicks || firstItem.MediaType !== 'Video') {
Expand All @@ -109,7 +109,7 @@ export abstract class PlaybackManager {
return this.playFromOptionsInternal(options);
}

private static playFromOptionsInternal(options: any): Promise<void> { // eslint-disable-line no-explicit-any
private static playFromOptionsInternal(options: any): Promise<void> { // eslint-disable-line @typescript-eslint/no-explicit-any
const stopPlayer =
this.activePlaylist && this.activePlaylist.length > 0;

Expand Down Expand Up @@ -143,7 +143,7 @@ export abstract class PlaybackManager {
return this.activePlaylistIndex > 0;
}

static playNextItem(options: any = {}, stopPlayer = false): boolean { // eslint-disable-line no-explicit-any
static playNextItem(options: any = {}, stopPlayer = false): boolean { // eslint-disable-line @typescript-eslint/no-explicit-any
const nextItemInfo = this.getNextPlaybackItemInfo();

if (nextItemInfo) {
Expand All @@ -155,7 +155,7 @@ export abstract class PlaybackManager {
return false;
}

static playPreviousItem(options: any = {}): boolean { // eslint-disable-line no-explicit-any
static playPreviousItem(options: any = {}): boolean { // eslint-disable-line @typescript-eslint/no-explicit-any
if (this.activePlaylist && this.activePlaylistIndex > 0) {
this.activePlaylistIndex--;
this.playItem(options, true);
Expand All @@ -167,7 +167,7 @@ export abstract class PlaybackManager {

// play item from playlist
private static async playItem(
options: any, // eslint-disable-line no-explicit-any
options: any, // eslint-disable-line @typescript-eslint/no-explicit-any
stopPlayer = false
): Promise<void> {
if (stopPlayer) {
Expand All @@ -182,7 +182,7 @@ export abstract class PlaybackManager {
// Would set private, but some refactorings need to happen first.
static async playItemInternal(
item: BaseItemDto,
options: any // eslint-disable-line no-explicit-any
options: any // eslint-disable-line @typescript-eslint/no-explicit-any
): Promise<void> {
this.playbackState.isChangingStream = false;
DocumentManager.setAppStatus(AppStatus.Loading);
Expand Down Expand Up @@ -247,7 +247,7 @@ export abstract class PlaybackManager {
playSessionId: string,
item: BaseItemDto,
mediaSource: MediaSourceInfo,
options: any // eslint-disable-line no-explicit-any
options: any // eslint-disable-line @typescript-eslint/no-explicit-any
): void {
DocumentManager.setAppStatus(AppStatus.Loading);

Expand Down

0 comments on commit a909ba9

Please sign in to comment.