fix: lint

This commit is contained in:
Eli Bosley
2025-02-03 15:45:48 -05:00
parent 9e12407565
commit 42610d290d
5 changed files with 38 additions and 19 deletions

View File

@@ -3,12 +3,8 @@ import { existsSync } from 'fs';
import { cp, readFile, writeFile } from 'fs/promises';
import path, { basename, resolve } from 'path';
import { describe, expect, test } from 'vitest';
import { FileModification } from '@app/unraid-api/unraid-file-modifier/file-modification';
import AuthRequestModification from '@app/unraid-api/unraid-file-modifier/modifications/auth-request.modification';
import DefaultPageLayoutModification from '@app/unraid-api/unraid-file-modifier/modifications/default-page-layout.modification';
@@ -16,10 +12,6 @@ import { LogRotateModification } from '@app/unraid-api/unraid-file-modifier/modi
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';
interface ModificationTestCase {
ModificationClass: new (...args: ConstructorParameters<typeof FileModification>) => FileModification;
fileUrl: string;
@@ -116,4 +108,4 @@ describe('File modifications', () => {
test.each(testCases)(`$fileName modifier correctly applies to fresh install`, async (testCase) => {
await testModification(testCase);
});
});
});

View File

@@ -43,9 +43,16 @@ export default class AuthRequestModification extends FileModification {
const newContent = fileContent.replace(/(\$arrWhitelist\s*=\s*\[)/, `$1\n${filesToAddString}`);
// Generate and return patch
const patch = createPatch(overridePath ?? this.filePath, fileContent, newContent, undefined, undefined, {
context: 3,
});
const patch = createPatch(
overridePath ?? this.filePath,
fileContent,
newContent,
undefined,
undefined,
{
context: 3,
}
);
return patch;
}

View File

@@ -46,9 +46,16 @@ export default class DefaultPageLayoutModification extends FileModification {
const newContent = this.applyToSource(fileContent);
const patch = createPatch(overridePath ?? this.filePath, fileContent, newContent, undefined, undefined, {
context: 2,
});
const patch = createPatch(
overridePath ?? this.filePath,
fileContent,
newContent,
undefined,
undefined,
{
context: 2,
}
);
return patch;
}

View File

@@ -17,9 +17,16 @@ export default class NotificationsPageModification extends FileModification {
const newContent = NotificationsPageModification.applyToSource(fileContent);
const patch = createPatch(overridePath ?? this.filePath, fileContent, newContent, undefined, undefined, {
context: 3,
});
const patch = createPatch(
overridePath ?? this.filePath,
fileContent,
newContent,
undefined,
undefined,
{
context: 3,
}
);
return patch;
}

View File

@@ -64,7 +64,13 @@ function verifyUsernamePasswordAndSSO(string $username, string $password): bool
newContent = newContent.replace(/<\/form>/i, `</form>\n${tagToInject}`);
// Create and return the patch
const patch = createPatch(overridePath ?? this.filePath, originalContent, newContent, 'original', 'modified');
const patch = createPatch(
overridePath ?? this.filePath,
originalContent,
newContent,
'original',
'modified'
);
return patch;
}