diff --git a/eslint.config.mjs b/eslint.config.mjs index efa8210a8..2a448f042 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -204,7 +204,6 @@ export default [ ], // disabled as code in this project is not yet compliant: - '@typescript-eslint/prefer-nullish-coalescing': 'off', '@typescript-eslint/no-empty-object-type': 'off', 'svelte/valid-compile': 'off', 'no-undef': 'off', diff --git a/packages/backend/src/utils/inferenceUtils.ts b/packages/backend/src/utils/inferenceUtils.ts index 409bbe8bb..e32ea6f50 100644 --- a/packages/backend/src/utils/inferenceUtils.ts +++ b/packages/backend/src/utils/inferenceUtils.ts @@ -76,7 +76,7 @@ export async function withDefaultConfiguration( return { port: options.port ?? (await getFreeRandomPort('0.0.0.0')), image: options.image, - labels: options.labels || {}, + labels: options.labels ?? {}, modelsInfo: options.modelsInfo, connection: options.connection, inferenceProvider: options.inferenceProvider, diff --git a/packages/backend/src/workers/provider/LlamaCppPython.ts b/packages/backend/src/workers/provider/LlamaCppPython.ts index 1c563e8b9..df4afafe0 100644 --- a/packages/backend/src/workers/provider/LlamaCppPython.ts +++ b/packages/backend/src/workers/provider/LlamaCppPython.ts @@ -242,7 +242,7 @@ export class LlamaCppPython extends InferenceProvider { status: 'running', models: config.modelsInfo, type: InferenceType.LLAMA_CPP, - labels: containerCreateOptions.Labels || {}, + labels: containerCreateOptions.Labels ?? {}, }; } diff --git a/packages/frontend/src/lib/table/model/ModelColumnName.svelte b/packages/frontend/src/lib/table/model/ModelColumnName.svelte index 743dcd15c..de275aa0a 100644 --- a/packages/frontend/src/lib/table/model/ModelColumnName.svelte +++ b/packages/frontend/src/lib/table/model/ModelColumnName.svelte @@ -15,7 +15,7 @@ function openDetails(): void { aria-label="Model Name"> {object.name} - {#if object.registry || object.license} + {#if object.registry ?? object.license} {object.registry} - {object.license} {/if} diff --git a/packages/frontend/src/pages/CreateService.svelte b/packages/frontend/src/pages/CreateService.svelte index 35f897f09..66281b5c9 100644 --- a/packages/frontend/src/pages/CreateService.svelte +++ b/packages/frontend/src/pages/CreateService.svelte @@ -120,7 +120,7 @@ const processTasks = (tasks: Task[]): void => { // hint: we do not need to display them as the TasksProgress component will error = trackedTasks.find(task => task.error)?.error !== undefined; - const task: Task | undefined = trackedTasks.find(task => 'containerId' in (task.labels || {})); + const task: Task | undefined = trackedTasks.find(task => 'containerId' in (task.labels ?? {})); if (task === undefined) return; containerId = task.labels?.['containerId']; diff --git a/packages/frontend/src/pages/InferenceServerDetails.svelte b/packages/frontend/src/pages/InferenceServerDetails.svelte index c4f13b4f2..16cc44e95 100644 --- a/packages/frontend/src/pages/InferenceServerDetails.svelte +++ b/packages/frontend/src/pages/InferenceServerDetails.svelte @@ -31,7 +31,7 @@ let selectedLanguage: string = 'curl'; $: selectedLanguage; let variants: LanguageVariant[] = []; -$: variants = $snippetLanguages.find(language => language.key === selectedLanguage)?.variants || []; +$: variants = $snippetLanguages.find(language => language.key === selectedLanguage)?.variants ?? []; let selectedVariant: string = 'cURL'; $: selectedVariant; diff --git a/packages/frontend/src/pages/Model.svelte b/packages/frontend/src/pages/Model.svelte index 3f4174fbe..91ca9b216 100644 --- a/packages/frontend/src/pages/Model.svelte +++ b/packages/frontend/src/pages/Model.svelte @@ -14,9 +14,9 @@ export function goToUpPage(): void { diff --git a/packages/frontend/src/pages/Recipe.svelte b/packages/frontend/src/pages/Recipe.svelte index 1df9da990..b1ac14bee 100644 --- a/packages/frontend/src/pages/Recipe.svelte +++ b/packages/frontend/src/pages/Recipe.svelte @@ -44,9 +44,9 @@ function getFilter(items: ApplicationState[]): ApplicationState[] { @@ -88,9 +88,9 @@ function getFilter(items: ApplicationState[]): ApplicationState[] {
- {#each recipe?.categories || [] as categoryId} + {#each recipe?.categories ?? [] as categoryId} category.id === categoryId)?.name || '?'} + title={categories.find(category => category.id === categoryId)?.name ?? '?'} classes="bg-[var(--pd-label-bg)] p-1 text-xs w-fit" /> {/each}
diff --git a/packages/shared/src/messages/MessageProxy.ts b/packages/shared/src/messages/MessageProxy.ts index a269a7d66..37ef4f516 100644 --- a/packages/shared/src/messages/MessageProxy.ts +++ b/packages/shared/src/messages/MessageProxy.ts @@ -151,7 +151,7 @@ export class RpcBrowser { return; } - const { resolve, reject } = this.promises.get(message.id) || {}; + const { resolve, reject } = this.promises.get(message.id) ?? {}; if (message.status === 'error') { reject?.(message.error); @@ -205,7 +205,7 @@ export class RpcBrowser { // Add some timeout if (!noTimeoutChannels.includes(channel)) { setTimeout(() => { - const { reject } = this.promises.get(requestId) || {}; + const { reject } = this.promises.get(requestId) ?? {}; if (!reject) return; reject(new Error('Timeout')); this.promises.delete(requestId);