From 87aa98398fc2aa0894d48382bc7844dc81bd011b Mon Sep 17 00:00:00 2001 From: HeavenVR Date: Mon, 9 Feb 2026 16:11:20 +0100 Subject: [PATCH 1/6] Start working on eslint enforcement --- .github/workflows/ci-check.yml | 42 +++++++++++++++++++ eslint.config.js | 1 + src/lib/api/index.ts | 2 +- src/lib/inputvalidation/usernameValidator.ts | 2 +- src/lib/types/AnyComponent.ts | 2 +- .../shares/user/+page.server.ts | 6 +++ .../(authenticated)/shares/user/+page.svelte | 9 ---- .../user/dialog-share-code-create.svelte | 2 +- .../user/dialog-share-code-redeem.svelte | 4 +- .../shares/user/incoming/+page.svelte | 2 +- .../user/incoming/incoming-share-item.svelte | 2 +- .../shares/user/invites/+page.svelte | 8 ++-- .../user/invites/incoming-invite-item.svelte | 2 +- .../user/invites/outgoing-invite-item.svelte | 2 +- .../shares/user/outgoing/+page.svelte | 2 +- .../user/outgoing/user-share-item.svelte | 4 +- .../(authenticated)/shockers/own/+page.svelte | 2 +- src/routes/+error.svelte | 5 ++- src/routes/+layout.svelte | 2 +- src/routes/Breadcrumb.svelte | 2 +- .../shares/public/[shareId=guid]/+page.svelte | 5 --- svelte.config.js | 1 - 22 files changed, 72 insertions(+), 37 deletions(-) create mode 100644 .github/workflows/ci-check.yml create mode 100644 src/routes/(authenticated)/shares/user/+page.server.ts delete mode 100644 src/routes/(authenticated)/shares/user/+page.svelte diff --git a/.github/workflows/ci-check.yml b/.github/workflows/ci-check.yml new file mode 100644 index 00000000..d732c1d4 --- /dev/null +++ b/.github/workflows/ci-check.yml @@ -0,0 +1,42 @@ +name: CI/CD Checks + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build-and-test: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v6 + + - uses: pnpm/action-setup@v4 + name: Install pnpm + with: + run_install: false + + - name: Install Node.js + uses: actions/setup-node@v6 + with: + node-version-file: .nvmrc + cache: 'pnpm' + + - name: Install dependencies + shell: bash + run: pnpm install --frozen-lockfile --strict-peer-dependencies + + - name: Check for compile issues + shell: bash + run: pnpm run check + + - name: Run Linting and Formatting Check + run: pnpm run lint + + - name: Run Tests + run: pnpm run test diff --git a/eslint.config.js b/eslint.config.js index 049f4769..9a018a41 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -53,6 +53,7 @@ export default ts.config( 'pnpm-lock.yaml', 'package-lock.json', 'yarn.lock', + 'src/lib/api/internal' ], } ); diff --git a/src/lib/api/index.ts b/src/lib/api/index.ts index 3f2cab25..f5d48c4b 100644 --- a/src/lib/api/index.ts +++ b/src/lib/api/index.ts @@ -38,7 +38,7 @@ function GetBasePath(): string { } // Normalize pathname - let pathname = url.pathname === '/' ? '' : url.pathname.replace(/\/+$/, ''); + const pathname = url.pathname === '/' ? '' : url.pathname.replace(/\/+$/, ''); return `${url.origin}${pathname}`; } catch (error) { diff --git a/src/lib/inputvalidation/usernameValidator.ts b/src/lib/inputvalidation/usernameValidator.ts index 55e0618f..bef4b688 100644 --- a/src/lib/inputvalidation/usernameValidator.ts +++ b/src/lib/inputvalidation/usernameValidator.ts @@ -7,7 +7,7 @@ import type { ValidationResult } from '$lib/types/ValidationResult'; // This is taken from https://github.com/OpenShock/API/blob/develop/ServicesCommon/Validation/ChatsetMatchers.cs#L19 const MultipleWhiteSpaceRegex = /\s{2,}/; -// eslint-disable-next-line no-control-regex + const UnwantedCharacterRegex = /[\u0000-\u001F\u007F-\u00A0\u02B0-\u036F\u1400-\u17FF\u1AB0-\u1AFF\u1DC0-\u1DFF\u2000-\u209F\u20D0-\u21FF\u2300-\u23FF\u2460-\u24FF\u25A0-\u27BF\u2900-\u297F\u2B00-\u2BFF\uFE00-\uFE0F\u{1F000}-\u{1F02F}\u{1F0A0}-\u{10FFFF}\u00AD\u180B-\u180F\u3000]/u; diff --git a/src/lib/types/AnyComponent.ts b/src/lib/types/AnyComponent.ts index 1ca0219f..d88a84ac 100644 --- a/src/lib/types/AnyComponent.ts +++ b/src/lib/types/AnyComponent.ts @@ -1,6 +1,6 @@ import type { Component, SvelteComponent } from 'svelte'; -// eslint-disable-next-line @typescript-eslint/no-explicit-any + export type AnyComponent = | Component | (new (...args: any[]) => SvelteComponent); diff --git a/src/routes/(authenticated)/shares/user/+page.server.ts b/src/routes/(authenticated)/shares/user/+page.server.ts new file mode 100644 index 00000000..4b2e3eb6 --- /dev/null +++ b/src/routes/(authenticated)/shares/user/+page.server.ts @@ -0,0 +1,6 @@ +import { resolve } from '$app/paths'; +import { redirect } from '@sveltejs/kit'; + +export function load() { + redirect(307, resolve('/shares/user/outgoing')); +} \ No newline at end of file diff --git a/src/routes/(authenticated)/shares/user/+page.svelte b/src/routes/(authenticated)/shares/user/+page.svelte deleted file mode 100644 index 0a07e98d..00000000 --- a/src/routes/(authenticated)/shares/user/+page.svelte +++ /dev/null @@ -1,9 +0,0 @@ - diff --git a/src/routes/(authenticated)/shares/user/dialog-share-code-create.svelte b/src/routes/(authenticated)/shares/user/dialog-share-code-create.svelte index cd5b59be..fe4b4d3f 100644 --- a/src/routes/(authenticated)/shares/user/dialog-share-code-create.svelte +++ b/src/routes/(authenticated)/shares/user/dialog-share-code-create.svelte @@ -1,5 +1,5 @@ @@ -36,7 +36,7 @@

{$userShare.shares.length}

diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 8714497b..7193b248 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -5,7 +5,7 @@ import { SidebarProvider } from '$lib/components/ui/sidebar'; import { Toaster } from '$lib/components/ui/sonner'; import { buildMetaData } from '$lib/metadata'; - import { type Snippet, onMount } from 'svelte'; + import { type Snippet } from 'svelte'; import Footer from './Footer.svelte'; import Header from './Header.svelte'; import Sidebar from './Sidebar.svelte'; diff --git a/src/routes/Breadcrumb.svelte b/src/routes/Breadcrumb.svelte index 236634b7..2f527b6a 100644 --- a/src/routes/Breadcrumb.svelte +++ b/src/routes/Breadcrumb.svelte @@ -6,7 +6,7 @@ {#if breadcrumbs.State.length > 0} - {#each breadcrumbs.State as crumb, index} + {#each breadcrumbs.State as crumb, index (index)} {#if index < breadcrumbs.State.length - 1} diff --git a/src/routes/shares/public/[shareId=guid]/+page.svelte b/src/routes/shares/public/[shareId=guid]/+page.svelte index cc76651f..da101bba 100644 --- a/src/routes/shares/public/[shareId=guid]/+page.svelte +++ b/src/routes/shares/public/[shareId=guid]/+page.svelte @@ -1,16 +1,11 @@
- {#each Buttons as { type, Icon }} + {#each Buttons as { type, Icon } (type)} {@const isDisabled = disabled || disabledControls[type]} + {/snippet}
{#snippet child({ props })} - + + + {menu.title} diff --git a/src/routes/flashtool/FirmwareBoardSelector.svelte b/src/routes/flashtool/FirmwareBoardSelector.svelte index 8073aa69..e9b48473 100644 --- a/src/routes/flashtool/FirmwareBoardSelector.svelte +++ b/src/routes/flashtool/FirmwareBoardSelector.svelte @@ -47,7 +47,7 @@ No board found. - {#each boards as board} + {#each boards as board (board)} (selectedBoard = board)}> {board} diff --git a/src/routes/report/api-tokens/+page.svelte b/src/routes/report/api-tokens/+page.svelte index 66a9f4b1..fa9c5dc3 100644 --- a/src/routes/report/api-tokens/+page.svelte +++ b/src/routes/report/api-tokens/+page.svelte @@ -69,7 +69,7 @@ Detected Tokens - {#each secrets as secret} + {#each secrets as secret (secret)}

Date: Tue, 10 Feb 2026 00:39:20 +0100 Subject: [PATCH 3/6] WOOOOOOOOOO --- eslint.config.js | 3 ++- src/lib/components/confirm-dialog/dialog-manager.svelte | 2 +- .../components/datetime-picker/date-time-picker.svelte | 7 +------ src/lib/components/input/TextInput.svelte | 6 ++---- src/lib/components/shares/permission-switch.svelte | 1 + src/lib/inputvalidation/usernameValidator.ts | 8 ++++---- src/lib/metadata.ts | 2 +- src/lib/sharelink-signalr/index.svelte.ts | 2 +- src/lib/stores/ConfirmDialogStore.ts | 2 +- src/lib/types/AnyComponent.ts | 3 ++- src/lib/types/ChildrenFunc.ts | 2 +- src/routes/Footer.svelte | 4 ++-- src/routes/Header.svelte | 3 ++- src/routes/flashtool/FlashManager.ts | 4 ++-- svelte.config.js | 2 +- 15 files changed, 24 insertions(+), 27 deletions(-) diff --git a/eslint.config.js b/eslint.config.js index bbd2ca99..7628d555 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -28,7 +28,7 @@ export default ts.config( // see: https://typescript-eslint.io/troubleshooting/faqs/eslint/#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors 'no-undef': 'off', 'no-useless-assignment': 'warn', - 'svelte/no-unused-svelte-ignore': 'warn', + 'svelte/no-unused-svelte-ignore': 'off', '@typescript-eslint/no-unused-vars': 'warn', }, }, @@ -57,6 +57,7 @@ export default ts.config( 'package-lock.json', 'yarn.lock', 'src/lib/api/internal', + 'src/lib/components/ui', ], } ); diff --git a/src/lib/components/confirm-dialog/dialog-manager.svelte b/src/lib/components/confirm-dialog/dialog-manager.svelte index e4a9073e..d34e5340 100644 --- a/src/lib/components/confirm-dialog/dialog-manager.svelte +++ b/src/lib/components/confirm-dialog/dialog-manager.svelte @@ -3,7 +3,7 @@ import { onMount } from 'svelte'; import DialogConfirm from './dialog-confirm.svelte'; - /* eslint-disable @typescript-eslint/no-explicit-any */ + /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ let dialogData: ConfirmDialogContext | null = $state(null); let dialogCounter = $state(0); let dialogOpen = $state(false); diff --git a/src/lib/components/datetime-picker/date-time-picker.svelte b/src/lib/components/datetime-picker/date-time-picker.svelte index 2b4bbe18..cb338a10 100644 --- a/src/lib/components/datetime-picker/date-time-picker.svelte +++ b/src/lib/components/datetime-picker/date-time-picker.svelte @@ -79,12 +79,7 @@

- { - time && setTime(time); - }} - /> + time && setTime(time)} />
diff --git a/src/lib/components/input/TextInput.svelte b/src/lib/components/input/TextInput.svelte index 116f7a10..0ce3acf2 100644 --- a/src/lib/components/input/TextInput.svelte +++ b/src/lib/components/input/TextInput.svelte @@ -1,10 +1,10 @@