mirror of
https://github.com/J3vb/OwnCord.git
synced 2026-09-03 03:50:00 +03:00
fix: resolve CI failures from invalid golangci-lint SHA and ESLint unknown rules
Update golangci-lint-action to v9.2.0 with correct commit SHA. Change eslint-disable-next-line to oxlint-disable-next-line for oxlint-specific rules (consistent-function-scoping, prefer-add-event-listener, require-post-message-target-origin) that ESLint doesn't recognize.
This commit is contained in:
@@ -47,7 +47,7 @@ jobs:
|
||||
retention-days: 7
|
||||
|
||||
- name: Lint
|
||||
uses: golangci/golangci-lint-action@4afd733a84b2f1a21f7c2e8a0e49adb3c0f2dbb6 # v9.0.0
|
||||
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0
|
||||
with:
|
||||
version: v2.11.3
|
||||
working-directory: Server/
|
||||
|
||||
@@ -48,7 +48,7 @@ export function createFileUpload(options: FileUploadOptions): FileUploadComponen
|
||||
let errorDiv: HTMLDivElement;
|
||||
let uploadAbort: AbortController | null = null;
|
||||
|
||||
// eslint-disable-next-line consistent-function-scoping -- co-located with its sole caller for readability
|
||||
// oxlint-disable-next-line consistent-function-scoping -- co-located with its sole caller for readability
|
||||
function formatSize(bytes: number): string {
|
||||
if (bytes < 1024) return `${bytes} B`;
|
||||
if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
|
||||
|
||||
@@ -183,7 +183,7 @@ export function createMessageInput(options: MessageInputOptions): MessageInputCo
|
||||
}
|
||||
|
||||
/** Read a File as a data: URL (more reliable than createObjectURL in WebView2). */
|
||||
// eslint-disable-next-line consistent-function-scoping -- co-located with handlePasteFile for readability
|
||||
// oxlint-disable-next-line consistent-function-scoping -- co-located with handlePasteFile for readability
|
||||
function readFileAsDataUrl(file: File): Promise<string> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const reader = new FileReader();
|
||||
|
||||
@@ -50,7 +50,7 @@ export function createSearchOverlay(options: SearchOverlayOptions): MountableCom
|
||||
let searchAbort: AbortController | null = null;
|
||||
let lastSearchTime = 0;
|
||||
|
||||
// eslint-disable-next-line consistent-function-scoping -- co-located with its sole caller for readability
|
||||
// oxlint-disable-next-line consistent-function-scoping -- co-located with its sole caller for readability
|
||||
function formatTimestamp(ts: string): string {
|
||||
try {
|
||||
const d = new Date(ts);
|
||||
|
||||
@@ -133,9 +133,9 @@ export function openCacheDb(): Promise<IDBDatabase | null> {
|
||||
db.createObjectStore(IDB_STORE);
|
||||
}
|
||||
};
|
||||
// eslint-disable-next-line prefer-add-event-listener -- IDBRequest does not support addEventListener
|
||||
// oxlint-disable-next-line prefer-add-event-listener -- IDBRequest does not support addEventListener
|
||||
req.onsuccess = () => resolve(req.result);
|
||||
// eslint-disable-next-line prefer-add-event-listener -- IDBRequest does not support addEventListener
|
||||
// oxlint-disable-next-line prefer-add-event-listener -- IDBRequest does not support addEventListener
|
||||
req.onerror = () => resolve(null);
|
||||
} catch {
|
||||
resolve(null);
|
||||
@@ -145,11 +145,11 @@ export function openCacheDb(): Promise<IDBDatabase | null> {
|
||||
|
||||
function closeDbAfterTransaction(tx: IDBTransaction, db: IDBDatabase): void {
|
||||
const close = (): void => db.close();
|
||||
// eslint-disable-next-line prefer-add-event-listener -- IDBTransaction does not support addEventListener
|
||||
// oxlint-disable-next-line prefer-add-event-listener -- IDBTransaction does not support addEventListener
|
||||
tx.oncomplete = close;
|
||||
// eslint-disable-next-line prefer-add-event-listener -- IDBTransaction does not support addEventListener
|
||||
// oxlint-disable-next-line prefer-add-event-listener -- IDBTransaction does not support addEventListener
|
||||
tx.onabort = close;
|
||||
// eslint-disable-next-line prefer-add-event-listener -- IDBTransaction does not support addEventListener
|
||||
// oxlint-disable-next-line prefer-add-event-listener -- IDBTransaction does not support addEventListener
|
||||
tx.onerror = close;
|
||||
}
|
||||
|
||||
@@ -163,9 +163,9 @@ async function idbGet(url: string): Promise<string | null> {
|
||||
closeDbAfterTransaction(tx, db);
|
||||
const store = tx.objectStore(IDB_STORE);
|
||||
const req = store.get(url);
|
||||
// eslint-disable-next-line prefer-add-event-listener -- IDBRequest does not support addEventListener
|
||||
// oxlint-disable-next-line prefer-add-event-listener -- IDBRequest does not support addEventListener
|
||||
req.onsuccess = () => resolve(typeof req.result === "string" ? req.result : null);
|
||||
// eslint-disable-next-line prefer-add-event-listener -- IDBRequest does not support addEventListener
|
||||
// oxlint-disable-next-line prefer-add-event-listener -- IDBRequest does not support addEventListener
|
||||
req.onerror = () => resolve(null);
|
||||
} catch {
|
||||
db.close();
|
||||
|
||||
@@ -257,11 +257,11 @@ async function clearImageCache(): Promise<void> {
|
||||
callback();
|
||||
}
|
||||
|
||||
// eslint-disable-next-line prefer-add-event-listener -- IDBRequest does not support addEventListener
|
||||
// oxlint-disable-next-line prefer-add-event-listener -- IDBRequest does not support addEventListener
|
||||
req.onsuccess = () => finish(resolve);
|
||||
// eslint-disable-next-line prefer-add-event-listener -- IDBRequest does not support addEventListener
|
||||
// oxlint-disable-next-line prefer-add-event-listener -- IDBRequest does not support addEventListener
|
||||
req.onerror = () => finish(() => reject(req.error));
|
||||
// eslint-disable-next-line prefer-add-event-listener -- IDBRequest does not support addEventListener
|
||||
// oxlint-disable-next-line prefer-add-event-listener -- IDBRequest does not support addEventListener
|
||||
req.onblocked = () => {
|
||||
if (blockedTimer !== null) return;
|
||||
blockedTimer = setTimeout(() => {
|
||||
|
||||
@@ -128,7 +128,7 @@ export function buildAppearanceTab(signal: AbortSignal): HTMLDivElement {
|
||||
|
||||
const currentAccent = loadPref<string>("accentColor", defaultAccent);
|
||||
|
||||
// eslint-disable-next-line consistent-function-scoping -- co-located with saveAccent for readability
|
||||
// oxlint-disable-next-line consistent-function-scoping -- co-located with saveAccent for readability
|
||||
function applyAccent(color: string): void {
|
||||
// Set on both documentElement and body so the accent wins over
|
||||
// theme class specificity (body.theme-neon-glow sets --accent)
|
||||
|
||||
@@ -50,7 +50,7 @@ const log = createLogger("api");
|
||||
|
||||
/** Create the REST API client. */
|
||||
export function createApiClient(initialConfig: ApiClientConfig, onUnauthorized?: OnUnauthorized) {
|
||||
// eslint-disable-next-line consistent-function-scoping -- co-located with createApiClient for encapsulation
|
||||
// oxlint-disable-next-line consistent-function-scoping -- co-located with createApiClient for encapsulation
|
||||
function isValidHost(host: string): boolean {
|
||||
return /^[\w.-]+(:\d+)?$/.test(host) && host.length <= 253;
|
||||
}
|
||||
@@ -159,7 +159,7 @@ export function createApiClient(initialConfig: ApiClientConfig, onUnauthorized?:
|
||||
return doFetch<T>("Admin API", adminBaseUrl(), method, path, body, signal);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line consistent-function-scoping -- co-located with doFetch for encapsulation
|
||||
// oxlint-disable-next-line consistent-function-scoping -- co-located with doFetch for encapsulation
|
||||
async function parseError(res: Response): Promise<ApiError> {
|
||||
try {
|
||||
const body = await res.json();
|
||||
|
||||
@@ -298,10 +298,10 @@ export class AudioPipeline {
|
||||
}
|
||||
// Don't connect workletNode output to anything — it's analysis-only
|
||||
|
||||
// eslint-disable-next-line require-post-message-target-origin -- MessagePort.postMessage, not Window.postMessage
|
||||
// oxlint-disable-next-line require-post-message-target-origin -- MessagePort.postMessage, not Window.postMessage
|
||||
workletNode.port.postMessage({ type: "config", threshold });
|
||||
|
||||
// eslint-disable-next-line prefer-add-event-listener -- MessagePort does not support addEventListener
|
||||
// oxlint-disable-next-line prefer-add-event-listener -- MessagePort does not support addEventListener
|
||||
workletNode.port.onmessage = (event: MessageEvent) => {
|
||||
if (event.data.type === "gate") {
|
||||
const gated = event.data.gated as boolean;
|
||||
@@ -396,7 +396,7 @@ export class AudioPipeline {
|
||||
}
|
||||
// Stop AudioWorklet
|
||||
if (this.vadWorkletNode !== null) {
|
||||
// eslint-disable-next-line require-post-message-target-origin -- MessagePort.postMessage, not Window.postMessage
|
||||
// oxlint-disable-next-line require-post-message-target-origin -- MessagePort.postMessage, not Window.postMessage
|
||||
this.vadWorkletNode.port.postMessage({ type: "stop" });
|
||||
this.vadWorkletNode.disconnect();
|
||||
this.vadWorkletNode = null;
|
||||
|
||||
@@ -90,13 +90,13 @@ async function createWorkletPipeline(
|
||||
});
|
||||
|
||||
const initPromise = new Promise<void>((resolve, reject) => {
|
||||
// eslint-disable-next-line prefer-add-event-listener -- MessagePort does not support addEventListener
|
||||
// oxlint-disable-next-line prefer-add-event-listener -- MessagePort does not support addEventListener
|
||||
workletNode.port.onmessage = (event: MessageEvent) => {
|
||||
if (event.data.type === "ready") resolve();
|
||||
else if (event.data.type === "error") reject(new Error(event.data.message));
|
||||
};
|
||||
});
|
||||
// eslint-disable-next-line require-post-message-target-origin -- MessagePort.postMessage, not Window.postMessage
|
||||
// oxlint-disable-next-line require-post-message-target-origin -- MessagePort.postMessage, not Window.postMessage
|
||||
workletNode.port.postMessage({ type: "init", wasmBytes }, [wasmBytes]);
|
||||
await initPromise;
|
||||
|
||||
@@ -108,7 +108,7 @@ async function createWorkletPipeline(
|
||||
return {
|
||||
processedTrack: dest.stream.getAudioTracks()[0]!,
|
||||
destroy() {
|
||||
// eslint-disable-next-line require-post-message-target-origin -- MessagePort.postMessage, not Window.postMessage
|
||||
// oxlint-disable-next-line require-post-message-target-origin -- MessagePort.postMessage, not Window.postMessage
|
||||
workletNode.port.postMessage({ type: "destroy" });
|
||||
workletNode.disconnect();
|
||||
source.disconnect();
|
||||
|
||||
@@ -53,7 +53,7 @@ export function notifyIncomingMessage(payload: ChatMessagePayload): void {
|
||||
|
||||
const channelName = getChannelName(payload.channel_id);
|
||||
|
||||
// eslint-disable-next-line consistent-function-scoping -- co-located with its sole caller for readability
|
||||
// oxlint-disable-next-line consistent-function-scoping -- co-located with its sole caller for readability
|
||||
function sanitizeNotif(s: string, maxLen: number): string {
|
||||
// eslint-disable-next-line no-control-regex -- intentional: strip control chars from user-provided strings
|
||||
const cleaned = s.replace(/[\x00-\x1F\x7F]/g, "");
|
||||
|
||||
Reference in New Issue
Block a user