1
0
mirror of https://github.com/bpatrik/pigallery2.git synced 2025-01-08 04:03:48 +02:00

improving linting

This commit is contained in:
Patrik J. Braun 2023-09-11 23:47:41 +02:00
parent 81068b6d66
commit 3383e155bf
9 changed files with 34 additions and 33 deletions

View File

@ -87,9 +87,9 @@ export class DirectoryEntity
@Column({type: 'boolean', default: false})
validCover: boolean;
@OneToMany((type) => MediaEntity, (media) => media.directory)
@OneToMany(() => MediaEntity, (media) => media.directory)
public media: MediaEntity[];
@OneToMany((type) => FileEntity, (file) => file.directory)
@OneToMany(() => FileEntity, (file) => file.directory)
public metaFile: FileEntity[];
}

View File

@ -5,8 +5,8 @@ import {JobProgress} from './JobProgress';
import {IJobListener} from './IJobListener';
import {JobProgressStates} from '../../../../common/entities/job/JobProgressDTO';
declare const process: any;
declare const global: any;
declare const process: { nextTick: (_: unknown) => void };
declare const global: { gc: () => void };
const LOG_TAG = '[JOB]';

View File

@ -79,7 +79,8 @@ export class JobProgress {
return this.logs;
}
onChange = (progress: JobProgress): void => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
onChange = (_: JobProgress): void => {
// abstract function
};

View File

@ -54,6 +54,7 @@ export class ThumbnailGenerationJob extends FileJob<{
return files;
}
// eslint-disable-next-line @typescript-eslint/no-unused-vars
protected async filterMetaFiles(files: FileDTO[]): Promise<FileDTO[]> {
return undefined;
}

View File

@ -38,7 +38,7 @@ export class MetadataLoader {
// ignoring errors
}
try {
ffmpeg(fullPath).ffprobe((err: any, data: FfprobeData) => {
ffmpeg(fullPath).ffprobe((err: unknown, data: FfprobeData) => {
if (!!err || data === null || !data.streams[0]) {
return resolve(metadata);
}
@ -346,11 +346,9 @@ export class MetadataLoader {
if (Config.Faces.enabled) {
const faces: FaceRegion[] = [];
if (
((exif.Regions as any)?.value?.RegionList)?.value
) {
for (const regionRoot of (exif.Regions as any).value.RegionList
.value as any[]) {
const regionListVal = ((exif.Regions?.value as any)?.RegionList)?.value;
if (regionListVal) {
for (const regionRoot of regionListVal) {
let type;
let name;
let box;

View File

@ -20,7 +20,7 @@ export class NetworkService {
) {
}
public static buildUrl(url: string, data?: { [key: string]: any }): string {
public static buildUrl(url: string, data?: { [key: string]: unknown }): string {
if (data) {
const keys = Object.getOwnPropertyNames(data);
if (keys.length > 0) {
@ -36,7 +36,7 @@ export class NetworkService {
return url;
}
public getXML<T>(url: string): Promise<Document> {
public getXML(url: string): Promise<Document> {
this.loadingBarService.useRef().start();
const process = (res: string): Document => {
@ -45,7 +45,7 @@ export class NetworkService {
return parser.parseFromString(res, 'text/xml');
};
const err = (error: any) => {
const err = <T>(error: T) => {
this.loadingBarService.useRef().complete();
return this.handleError(error);
};
@ -57,7 +57,7 @@ export class NetworkService {
.catch(err);
}
public getText<T>(url: string): Promise<string> {
public getText(url: string): Promise<string> {
this.loadingBarService.useRef().start();
const process = (res: string): string => {
@ -65,7 +65,7 @@ export class NetworkService {
return res;
};
const err = (error: Error) => {
const err = <T>(error: T) => {
this.loadingBarService.useRef().complete();
return this.handleError(error);
};
@ -123,7 +123,7 @@ export class NetworkService {
return msg.result;
};
const err = (error: Error) => {
const err = <T>(error: T) => {
this.loadingBarService.useRef().complete();
return this.handleError(error);
};
@ -160,10 +160,10 @@ export class NetworkService {
}
}
private handleError(error: any): Promise<any> {
if (typeof error.code !== 'undefined') {
private handleError<T>(error: T): Promise<T> {
if (typeof (error as ErrorDTO).code !== 'undefined') {
for (const item of this.globalErrorHandlers) {
if (item(error) === true) {
if (item(error as ErrorDTO) === true) {
return;
}
}
@ -171,6 +171,6 @@ export class NetworkService {
}
// instead of just logging it to the console
console.error('error:', error);
return Promise.reject(error.message || error || 'Server error');
return Promise.reject((error as ErrorDTO).message || error || 'Server error');
}
}

View File

@ -1,10 +1,11 @@
import {Injectable} from '@angular/core';
import {Event} from '../../../../common/event/Event';
declare const document: {
fullscreenElement: any;
mozFullScreenElement: any;
webkitFullscreenElement: any;
fullscreenElement: boolean;
mozFullScreenElement: boolean;
webkitFullscreenElement: boolean;
exitFullscreen: () => void;
mozCancelFullScreen: () => void;
webkitExitFullscreen: () => void;
@ -29,12 +30,12 @@ export class FullScreenService {
if (element.requestFullscreen) {
element.requestFullscreen().catch(console.error);
} else if ((element as any).mozRequestFullScreen) {
(element as any).mozRequestFullScreen();
} else if ((element as any).webkitRequestFullscreen) {
(element as any).webkitRequestFullscreen();
} else if ((element as any).msRequestFullscreen) {
(element as any).msRequestFullscreen();
} else if ((element as unknown as Record<string, () => void>).mozRequestFullScreen) {
(element as unknown as Record<string, () => void>).mozRequestFullScreen();
} else if ((element as unknown as Record<string, () => void>).webkitRequestFullscreen) {
(element as unknown as Record<string, () => void>).webkitRequestFullscreen();
} else if ((element as unknown as Record<string, () => void>).msRequestFullscreen) {
(element as unknown as Record<string, () => void>).msRequestFullscreen();
}
this.OnFullScreenChange.trigger(true);
}

View File

@ -62,7 +62,7 @@ describe('GalleryGridComponent', () => {
setGridPhotoQL: () => {
// mock
}
} as any;
} as unknown;
fixture.detectChanges();
});
@ -73,7 +73,7 @@ describe('GalleryGridComponent', () => {
const phs: PhotoDTO[] = [];
const gPhs: GridMedia[] = [];
for (let i = 0; i < 10; ++i) {
const p = {name: i + '.jpg', directory: {name: 'd' + i, path: 'p' + i}} as any;
const p = {name: i + '.jpg', directory: {name: 'd' + i, path: 'p' + i}} as unknown;
phs.push(p);
gPhs.push(new GridMedia(p, 1, 1, i));
}

View File

@ -177,7 +177,7 @@ export class ControlsLightboxComponent implements OnDestroy, OnInit, OnChanges {
this.prevZoom = this.zoom;
}
tap($event: any): void {
tap($event: { tapCount: number }): void {
if (!this.activePhoto || this.activePhoto.gridMedia.isVideo()) {
return;
}