[chore] fix lint errors

This commit is contained in:
MathieuG-P
2023-07-01 03:01:38 +02:00
parent 7addb57613
commit d62727c3f9
55 changed files with 176 additions and 181 deletions
@@ -1,11 +1,9 @@
import { UninstallAllModsModal } from "renderer/components/modal/modal-types/uninstall-all-mods-modal.component";
import { UninstallModModal } from "renderer/components/modal/modal-types/uninstall-mod-modal.component";
import { Observable } from "rxjs";
import { BehaviorSubject } from "rxjs";
import { Observable, BehaviorSubject } from "rxjs";
import { map } from "rxjs/operators";
import { BSVersion } from "shared/bs-version.interface";
import { InstallModsResult, UninstallModsResult } from "shared/models/mods";
import { Mod, ModInstallProgression } from "shared/models/mods";
import { InstallModsResult, UninstallModsResult, Mod, ModInstallProgression } from "shared/models/mods";
import { ProgressionInterface } from "shared/models/progress-bar";
import { IpcService } from "./ipc.service";
import { ModalExitCode, ModalService } from "./modale.service";
@@ -57,10 +55,10 @@ export class BsModsManagerService {
title: "notifications.shared.errors.titles.no-internet",
desc: "notifications.shared.errors.msg.no-internet"
});
return new Promise(res => res());
return Promise.resolve();
}
if(!this.progressBar.require()){ return new Promise(res => res()); }
if(!this.progressBar.require()){ return Promise.resolve(); }
const progress$: Observable<ProgressionInterface> = this.ipcService.watch<ModInstallProgression>("mod-installed").pipe(map(res => {
return {progression: res.data.progression, label: res.data.name} as ProgressionInterface
@@ -1,11 +1,10 @@
import { BSVersion } from 'shared/bs-version.interface';
import { BehaviorSubject } from "rxjs";
import { BehaviorSubject, Observable } from "rxjs";
import { IpcService } from "./ipc.service";
import { ModalExitCode, ModalService } from './modale.service';
import { NotificationService } from './notification.service';
import { ProgressBarService } from './progress-bar.service';
import { EditVersionModal } from 'renderer/components/modal/modal-types/edit-version-modal.component';
import { Observable } from 'rxjs';
export class BSVersionManagerService {
@@ -1,13 +1,13 @@
import { BehaviorSubject, Observable, shareReplay } from "rxjs";
import { BehaviorSubject, Observable } from "rxjs";
import { DefaultConfigKey, defaultConfiguration } from "renderer/config/default-configuration.config";
export class ConfigurationService {
private static instance: ConfigurationService;
private observers: Map<string, BehaviorSubject<any>>;
private observers: Map<string, BehaviorSubject<unknown>>;
private constructor(){
this.observers = new Map<string, BehaviorSubject<any>>();
this.observers = new Map<string, BehaviorSubject<unknown>>();
}
private emitChange(key: string){
if(this.observers.has(key)){
@@ -29,7 +29,7 @@ export class ConfigurationService {
return t;
}
public set(key: string, value: any, persistant = true){
public set(key: string, value: unknown, persistant = true){
this.getPropperStorage(persistant).setItem(key, JSON.stringify(value));
this.emitChange(key);
}
@@ -41,8 +41,8 @@ export class ConfigurationService {
}
public watch<T>(key: DefaultConfigKey | string): Observable<T>{
if(this.observers.has(key)){ return this.observers.get(key); }
if(this.observers.has(key)){ return this.observers.get(key).asObservable() as Observable<T>; }
this.observers.set(key, new BehaviorSubject(this.get(key)));
return this.observers.get(key).asObservable();
return this.observers.get(key).asObservable() as Observable<T>;
}
}
+1 -1
View File
@@ -16,7 +16,7 @@ export class I18nService {
private readonly configService: ConfigurationService;
private dictionary: Object;
private dictionary = {};
public static getInstance(): I18nService{
if(!I18nService.instance){ I18nService.instance = new I18nService(); }
+3 -4
View File
@@ -1,7 +1,6 @@
import { defaultIfEmpty, share, shareReplay } from "rxjs/operators";
import { Observable } from "rxjs";
import { defaultIfEmpty, shareReplay } from "rxjs/operators";
import { Observable, identity } from "rxjs";
import { IpcRequest, IpcResponse } from "shared/models/ipc";
import { identity } from "rxjs";
export class IpcService{
@@ -31,7 +30,7 @@ export class IpcService{
return promise;
}
public sendLazy<T = any>(channel: string, request?: IpcRequest<T>): void{
public sendLazy<T = unknown>(channel: string, request?: IpcRequest<T>): void{
window.electron.ipcRenderer.sendMessage(channel, request);
}
+1 -2
View File
@@ -1,5 +1,4 @@
import { Observable } from "rxjs";
import { Subject } from "rxjs";
import { Observable, Subject } from "rxjs";
import { IpcService } from "./ipc.service";
export class LinkOpenerService{
+8 -9
View File
@@ -1,5 +1,4 @@
import { Observable } from "rxjs";
import { BehaviorSubject } from "rxjs";
import { Observable, BehaviorSubject } from "rxjs";
import { timeout } from "rxjs/operators";
export class ModalService{
@@ -7,8 +6,8 @@ export class ModalService{
private static instance: ModalService;
private _modalToShow$: BehaviorSubject<ModalComponent> = new BehaviorSubject(null);
private modalData: any = null;
private resolver: any;
private modalData: unknown = null;
private resolver: (value: ModalResponse| PromiseLike<ModalResponse>) => void = null;;
private constructor(){}
@@ -23,7 +22,7 @@ export class ModalService{
}
public getModalData<Type>(): Type{
return this.modalData;
return this.modalData as Type;
}
public getResolver(): any{
@@ -36,9 +35,9 @@ export class ModalService{
public async openModal<T, K>(modal: ModalComponent<T, K>, data?: K): Promise<ModalResponse<T>>{
this.close();
await timeout(100); //Must wait resolve
const promise = new Promise<ModalResponse<T>>((resolve) => { this.resolver = resolve; });
this._modalToShow$.next(modal);
await timeout(100); // Must wait resolve
const promise = new Promise<ModalResponse<T>>((resolve) => { this.resolver = resolve as (value: ModalResponse| PromiseLike<ModalResponse>) => void; });
this._modalToShow$.next(modal as ModalComponent);
promise.then(() => this.close());
if(data){ this.modalData = data; }
else{ this.modalData = null; }
@@ -51,7 +50,7 @@ export class ModalService{
}
export type ModalComponent<Return = unknown, Receive = any> = ({resolver, data}: {resolver : (x: ModalResponse<Return>) => void, data?: Receive}) => JSX.Element;
export type ModalComponent<Return = unknown, Receive = unknown> = ({resolver, data}: {resolver : (x: ModalResponse<Return>) => void, data?: Receive}) => JSX.Element;
export const enum ModalExitCode {
NO_CHOICE = -1,
@@ -2,7 +2,7 @@ import { MSModelType } from "shared/models/models/model-saber.model";
import { IpcService } from "../ipc.service";
import { VersionFolderLinkerService, VersionLinkerActionListener, VersionLinkerActionType } from "../version-folder-linker.service";
import { MODEL_TYPE_FOLDERS } from "shared/models/models/constants";
import { Observable, distinctUntilChanged, lastValueFrom, map, mergeMap, share } from "rxjs";
import { Observable, lastValueFrom, map } from "rxjs";
import { BSVersion } from "shared/bs-version.interface";
import { ModalExitCode, ModalService } from "../modale.service";
import { LinkModelsModal } from "renderer/components/modal/modal-types/models/link-models-modal.component";
@@ -12,7 +12,6 @@ import { BsmLocalModel } from "shared/models/models/bsm-local-model.interface";
import { ProgressBarService } from "../progress-bar.service";
import { OpenSaveDialogOption } from "shared/models/os/dialog.model";
import { ProgressionInterface } from "shared/models/progress-bar";
import { ArchiveProgress } from "shared/models/archive.interface";
import { NotificationService } from "../notification.service";
import { ConfigurationService } from "../configuration.service";
import { DeleteModelsModal } from "renderer/components/modal/modal-types/models/delete-models-modal.component";
@@ -120,7 +119,7 @@ export class ModelsManagerService {
lastValueFrom(exportProgress$).then(() => {
this.notifications.notifySuccess({title: "models.notifications.export-success.title", duration: 3000});
}).catch(e => {
}).catch(() => {
this.notifications.notifyError({title: "notifications.types.error", desc: "notifications.common.msg.error-occurred", duration: 3000});
}).finally(() => {
this.progressBar.hide(true);
@@ -24,7 +24,7 @@ export class NotificationService{
// TODO : Make actions work and adapt with "watch" remork
this.ipc.watch<Notification>("show-notification").subscribe(notification => {
this.notify(notification as any as Notification);
this.notify(notification as unknown as Notification);
});
}
@@ -1,5 +1,5 @@
import { BsvMapDetail } from "shared/models/maps";
import { BsvPlaylist, BsvPlaylistPage, SearchParams } from "shared/models/maps/beat-saver.model";
import { BsvPlaylist, SearchParams } from "shared/models/maps/beat-saver.model";
import { IpcService } from "../ipc.service";
export class BeatSaverService {
@@ -1,5 +1,5 @@
import { LinkOptions, UnlinkOptions } from "main/services/folder-linker.service";
import { map, distinctUntilChanged, filter, mergeMap, share, shareReplay } from "rxjs/operators";
import { map, distinctUntilChanged, filter, mergeMap, shareReplay } from "rxjs/operators";
import { BehaviorSubject, Observable } from "rxjs";
import { BSVersion } from "shared/bs-version.interface";
import { IpcService } from "./ipc.service";