From d38f3ef49b9cd2044ce7e700f42f7b0a0d3a2e7a Mon Sep 17 00:00:00 2001 From: Eli Bosley Date: Fri, 31 Jan 2025 16:56:04 -0500 Subject: [PATCH] fix: lint --- .../modifications/__test__/generic-modification.spec.ts | 6 +++--- .../modifications/default-page-layout.modification.ts | 4 +--- .../modifications/sso.modification.ts | 9 +++++++-- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/api/src/unraid-api/unraid-file-modifier/modifications/__test__/generic-modification.spec.ts b/api/src/unraid-api/unraid-file-modifier/modifications/__test__/generic-modification.spec.ts index d8c98fabb..e2b015aec 100644 --- a/api/src/unraid-api/unraid-file-modifier/modifications/__test__/generic-modification.spec.ts +++ b/api/src/unraid-api/unraid-file-modifier/modifications/__test__/generic-modification.spec.ts @@ -1,4 +1,5 @@ import { Logger } from '@nestjs/common'; +import { existsSync } from 'fs'; import { readFile, writeFile } from 'fs/promises'; import { basename, resolve } from 'path'; @@ -8,7 +9,6 @@ import { FileModification } from '@app/unraid-api/unraid-file-modifier/file-modi import DefaultPageLayoutModification from '@app/unraid-api/unraid-file-modifier/modifications/default-page-layout.modification'; import NotificationsPageModification from '@app/unraid-api/unraid-file-modifier/modifications/notifications-page.modification'; import SSOFileModification from '@app/unraid-api/unraid-file-modifier/modifications/sso.modification'; -import { existsSync } from 'fs'; interface ModificationTestCase { ModificationClass: new (...args: ConstructorParameters) => FileModification; @@ -50,10 +50,10 @@ async function testModification(testCase: ModificationTestCase) { const logger = new Logger(); const patcher = await new testCase.ModificationClass(logger); - // @ts-ignore - Ignore for testing purposes + // @ts-expect-error - Ignore for testing purposes patcher.filePath = path; - // @ts-ignore - Ignore for testing purposes + // @ts-expect-error - Ignore for testing purposes const patch = await patcher.generatePatch(); // Test patch matches snapshot diff --git a/api/src/unraid-api/unraid-file-modifier/modifications/default-page-layout.modification.ts b/api/src/unraid-api/unraid-file-modifier/modifications/default-page-layout.modification.ts index e0b3b5200..2b5781890 100644 --- a/api/src/unraid-api/unraid-file-modifier/modifications/default-page-layout.modification.ts +++ b/api/src/unraid-api/unraid-file-modifier/modifications/default-page-layout.modification.ts @@ -10,8 +10,7 @@ import { export default class DefaultPageLayoutModification extends FileModification { id: string = 'default-page-layout'; - public readonly filePath: string = - '/usr/local/emhttp/plugins/dynamix/include/DefaultPageLayout.php'; + public readonly filePath: string = '/usr/local/emhttp/plugins/dynamix/include/DefaultPageLayout.php'; private addToaster(source: string): string { if (source.includes('unraid-toaster')) { @@ -45,7 +44,6 @@ export default class DefaultPageLayoutModification extends FileModification { protected async generatePatch(): Promise { const fileContent = await readFile(this.filePath, 'utf-8'); - const newContent = this.applyToSource(fileContent); const patch = createPatch(this.filePath, fileContent, newContent, undefined, undefined, { diff --git a/api/src/unraid-api/unraid-file-modifier/modifications/sso.modification.ts b/api/src/unraid-api/unraid-file-modifier/modifications/sso.modification.ts index aa7b7fc66..7fdf6338f 100644 --- a/api/src/unraid-api/unraid-file-modifier/modifications/sso.modification.ts +++ b/api/src/unraid-api/unraid-file-modifier/modifications/sso.modification.ts @@ -1,7 +1,12 @@ import type { Logger } from '@nestjs/common'; import { readFile } from 'node:fs/promises'; + import { createPatch } from 'diff'; -import { FileModification, ShouldApplyWithReason } from '@app/unraid-api/unraid-file-modifier/file-modification'; + +import { + FileModification, + ShouldApplyWithReason, +} from '@app/unraid-api/unraid-file-modifier/file-modification'; export default class SSOFileModification extends FileModification { id: string = 'sso'; @@ -43,7 +48,7 @@ function verifyUsernamePasswordAndSSO(string $username, string $password): bool // Read the file content const originalContent = await readFile(this.filePath, 'utf-8'); - + // Create modified content let newContent = originalContent;