From 366f9f5b974a16800f3f415fffd03c4c22ba243d Mon Sep 17 00:00:00 2001 From: Matte Noble Date: Fri, 23 May 2025 12:23:32 -0700 Subject: [PATCH] Back to line length of 100 + some svelte/ts settings - Goes back to a max line length of 100 - Makes whitespace insignificant in Svelte files (see below) - Avoids parens around single argument closures, in TS, when unncessary *Whitespace Significance* In HTML, `

1

` and `

1

` are not the same thing. In the former, the "1" has spaces around it. If you were to try to split this into multiple lines... ```html

1

``` ...you would lose that whitespace. The newlines reset any significance around individual tokens. This meant prettier would format that code as... ```html

1

``` ...which is insane and hideous. We're saying all whitespace is insignificant from now on. Meaning prettier no longer needs to retain it and can format that code as a sane person. This means you need to explicitly use ` ` characters if you explicitly need whitespace around things. OR put it in a `span` and use css. TL;DR: do not rely on whitespace significance in HTML. --- .prettierrc | 5 +- src/components/Icons/Chat.svelte | 6 ++- src/components/Icons/Check.svelte | 6 +-- src/components/McpServer.svelte | 2 +- src/components/ModelMenu.svelte | 2 +- src/components/Smithery/Configuration.svelte | 21 +++++--- src/components/Updater.svelte | 2 +- src/components/Welcome.svelte | 4 +- src/hooks.client.ts | 12 ++--- src/lib/deeplinks.ts | 2 +- src/lib/engines/gemini/client.ts | 8 +-- src/lib/engines/gemini/message.ts | 2 +- src/lib/engines/gemini/tool.ts | 2 +- src/lib/engines/ollama/client.ts | 6 +-- src/lib/engines/ollama/message.ts | 2 +- src/lib/engines/openai/client.ts | 8 +-- src/lib/engines/openai/message.ts | 2 +- src/lib/ext.ts | 4 +- src/lib/http.ts | 20 +++++-- src/lib/llm.ts | 11 +++- src/lib/logger.ts | 4 +- src/lib/mcp.ts | 2 +- src/lib/models/app.ts | 10 ++-- src/lib/models/base.svelte.ts | 16 +++--- src/lib/models/config.ts | 8 +-- src/lib/models/engine.ts | 2 +- src/lib/models/message/ollama.ts | 2 +- src/lib/models/message/openai.ts | 2 +- src/lib/models/session.ts | 2 +- src/lib/tool-call-migration.ts | 4 +- src/routes/+layout.svelte | 4 +- src/routes/+page.svelte | 11 +--- src/routes/chat/[session_id]/+page.svelte | 56 ++++++-------------- src/routes/mcp-servers/install/+page.svelte | 5 +- 34 files changed, 122 insertions(+), 133 deletions(-) diff --git a/.prettierrc b/.prettierrc index ea06fff..e9ff429 100644 --- a/.prettierrc +++ b/.prettierrc @@ -4,7 +4,8 @@ "tabWidth": 4, "semi": true, "trailingComma": "es5", - "printWidth": 80, + "printWidth": 100, + "arrowParens": "avoid", "plugins": [ "prettier-plugin-svelte", "prettier-plugin-tailwindcss" @@ -14,7 +15,7 @@ "files": "*.svelte", "options": { "parser": "svelte", - "printWidth": 100 + "htmlWhitespaceSensitivity": "ignore" } } ] diff --git a/src/components/Icons/Chat.svelte b/src/components/Icons/Chat.svelte index 7c853d4..183418d 100644 --- a/src/components/Icons/Chat.svelte +++ b/src/components/Icons/Chat.svelte @@ -13,11 +13,13 @@ > - - diff --git a/src/components/Icons/Check.svelte b/src/components/Icons/Check.svelte index e790a0b..d5fe451 100644 --- a/src/components/Icons/Check.svelte +++ b/src/components/Icons/Check.svelte @@ -4,8 +4,8 @@ width="100%" height="100%" xmlns="http://www.w3.org/2000/svg" - > + - + > diff --git a/src/components/McpServer.svelte b/src/components/McpServer.svelte index e4f6f60..939f1ee 100644 --- a/src/components/McpServer.svelte +++ b/src/components/McpServer.svelte @@ -41,7 +41,7 @@ } async function remove(key: string) { - env = env.filter((e) => e[0] !== key); + env = env.filter(e => e[0] !== key); await save(); } diff --git a/src/components/ModelMenu.svelte b/src/components/ModelMenu.svelte index 433ef60..cb21b7f 100644 --- a/src/components/ModelMenu.svelte +++ b/src/components/ModelMenu.svelte @@ -40,7 +40,7 @@ toggle(e)} + onclick={e => toggle(e)} class="border-light absolute top-0 left-0 w-full justify-between rounded-md border p-2 px-4" > diff --git a/src/components/Smithery/Configuration.svelte b/src/components/Smithery/Configuration.svelte index b9037e1..bb22f06 100644 --- a/src/components/Smithery/Configuration.svelte +++ b/src/components/Smithery/Configuration.svelte @@ -60,13 +60,13 @@ } function isValid() { - return config.every((prop) => prop.valid); + return config.every(prop => prop.valid); } function validateAll() { config - .filter((c) => c.required) - .forEach((prop) => { + .filter(c => c.required) + .forEach(prop => { prop.valid = validate(prop.value); }); } @@ -115,8 +115,13 @@ {#if srcdoc} - + {/if} {#if server && config} @@ -126,7 +131,7 @@ {#if config.length > 0}
- {#each config.filter((p) => p.required) as prop (prop.name)} + {#each config.filter(p => p.required) as prop (prop.name)} - {#if config.some((p) => !p.required)} + {#if config.some(p => !p.required)} {#if advancedIsOpen} - -