mirror of
https://github.com/unraid/api.git
synced 2025-12-31 13:39:52 -06:00
fix: lint
This commit is contained in:
@@ -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);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user