diff --git a/.eslintrc.js b/.eslintrc.js index 677c2e08..714be484 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -28,7 +28,9 @@ module.exports = { "no-underscore-dangle": "off", "no-restricted-syntax": "off", "@typescript-eslint/no-throw-literal": "off", - "@typescript-eslint/no-unused-expressions": "off" + "@typescript-eslint/no-unused-expressions": "off", + "no-param-reassign": "off", + "no-useless-escape": "off" }, parserOptions: { ecmaVersion: 2020, diff --git a/src/main/services/bs-installer.service.ts b/src/main/services/bs-installer.service.ts index 01de6cbc..87ebd07e 100644 --- a/src/main/services/bs-installer.service.ts +++ b/src/main/services/bs-installer.service.ts @@ -39,14 +39,14 @@ export class BSInstallerService{ return path.join(this.utils.getAssetsScriptsPath(), 'depot-downloader', 'DepotDownloader.exe'); } - private sendDownloadEvent(event: DownloadEventType, data?: string|number, success: boolean = true): void{ + private sendDownloadEvent(event: DownloadEventType, data?: string|number, success = true): void{ if(typeof data === "string"){ data = data.replaceAll(/\[|\]/g, ""); } - this.utils.ipcSend(`bs-download.${event}`, { success: success, data: data }); + this.utils.ipcSend(`bs-download.${event}`, { success, data }); } public sendInputProcess(input: string){ if(this.downloadProcess.stdin.writable){ - this.downloadProcess.stdin.write(input+"\n"); + this.downloadProcess.stdin.write(`${input}\n`); } } @@ -64,7 +64,7 @@ export class BSInstallerService{ public async downloadBsVersion(downloadInfos: DownloadInfo): Promise{ if(this.downloadProcess && !this.downloadProcess?.killed){ return {type: "[AlreadyDownloading]"}; } - const bsVersion = downloadInfos.bsVersion; + const {bsVersion} = downloadInfos; if(!bsVersion){ return {type: "[Error]"}; } if(!(await isOnline({timeout: 1500}))){ throw "no-internet"; } @@ -82,7 +82,7 @@ export class BSInstallerService{ {shell: true, cwd: this.installLocationService.versionsDirectory} ); - return await new Promise((resolve, reject) => { + return new Promise((resolve, reject) => { this.downloadProcess.stdout.on('data', data => { const matched = (data.toString() as string).match(/(?:\[(.*?)\])\|(?:\[(.*?)\]\|)?(.*?)(?=$|\[)/gm) ?? []; @@ -103,7 +103,7 @@ export class BSInstallerService{ else if(out[0] === "[Progress]" as DownloadEventType || (out[0] === "[Validated]" as DownloadEventType && parseFloat(out[1]) < 100)){ this.sendDownloadEvent("[Progress]", parseFloat(out[1].replaceAll(",", "."))); } - else if(out[0] === "[Finished]" as DownloadEventType || (out[0] === "[Validated]" as DownloadEventType && parseFloat(out[1]) == 100)){ + else if(out[0] === "[Finished]" as DownloadEventType || (out[0] === "[Validated]" as DownloadEventType && parseFloat(out[1]) === 100)){ resolve({type: "[Finished]"}); this.killDownloadProcess(); } diff --git a/src/main/services/bs-local-version.service.ts b/src/main/services/bs-local-version.service.ts index 5b39fce9..73cb8b10 100644 --- a/src/main/services/bs-local-version.service.ts +++ b/src/main/services/bs-local-version.service.ts @@ -41,7 +41,7 @@ export class BSLocalVersionService{ const versionFilePath = path.join(bsPath, 'Beat Saber_Data', 'globalgamemanagers'); if(!this.utilsService.pathExist(versionFilePath)){ return null; } const versionsAvailable = await this.remoteVersionService.getAvailableVersions(); - return new Promise((resolve, reject) => { + return new Promise(resolve => { const readLine = createInterface({ input: createReadStream(versionFilePath) }); let findVersion: string = null; readLine.on('line', (line) => {