diff --git a/.github/workflows/ci-lint.yml b/.github/workflows/ci-lint.yml new file mode 100644 index 00000000..16f0b7a4 --- /dev/null +++ b/.github/workflows/ci-lint.yml @@ -0,0 +1,40 @@ +name: ci-lint + +on: + push: + branches: + - master + - develop + pull_request: + branches: + - master + - develop + +permissions: + contents: read + +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: Run Linting and Formatting Check + run: pnpm run lint diff --git a/eslint.config.js b/eslint.config.js index 049f4769..7628d555 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -27,6 +27,9 @@ export default ts.config( // typescript-eslint strongly recommend that you do not use the no-undef lint rule on TypeScript projects. // 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': 'off', + '@typescript-eslint/no-unused-vars': 'warn', }, }, { @@ -53,6 +56,8 @@ export default ts.config( 'pnpm-lock.yaml', 'package-lock.json', 'yarn.lock', + 'src/lib/api/internal', + 'src/lib/components/ui', ], } ); 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/components/Code.svelte b/src/lib/components/Code.svelte index fc93aa64..c882be5e 100644 --- a/src/lib/components/Code.svelte +++ b/src/lib/components/Code.svelte @@ -1,6 +1,8 @@
- {#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/flashtool/FlashManager.ts b/src/routes/flashtool/FlashManager.ts index b9d03d21..56381eee 100644 --- a/src/routes/flashtool/FlashManager.ts +++ b/src/routes/flashtool/FlashManager.ts @@ -12,7 +12,7 @@ async function setupESPLoader( ): Promise { try { await serialPort.close(); // TODO: Find some way to detect if the port is already open - // eslint-disable-next-line @typescript-eslint/no-unused-vars + /* eslint-disable-next-line @typescript-eslint/no-unused-vars */ } catch (e) { /* empty */ } @@ -60,7 +60,7 @@ function appendBuffer(buffer: Uint8Array | null, data: Uint8Array): Uint8Array { async function setupApplication(serialPort: SerialPort): Promise { try { await serialPort.close(); // TODO: Find some way to detect if the port is already open - // eslint-disable-next-line @typescript-eslint/no-unused-vars + /* eslint-disable-next-line @typescript-eslint/no-unused-vars */ } catch (e) { /* empty */ } 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)}

import { CircleUser, LogIn, Undo2 } from '@lucide/svelte'; - import { goto } from '$app/navigation'; import { resolve } from '$app/paths'; import { page } from '$app/state'; import { publicShockerSharesApi } from '$lib/api'; import type { PublicShareResponse } from '$lib/api/internal/v1'; - import ClassicControlModule from '$lib/components/ControlModules/ClassicControlModule.svelte'; - import PublicShareClassicControlModule from '$lib/components/ControlModules/PublicShareClassicControlModule.svelte'; - import SimpleControlModule from '$lib/components/ControlModules/SimpleControlModule.svelte'; import { Button } from '$lib/components/ui/button'; import * as Card from '$lib/components/ui/card/index.js'; - import * as Form from '$lib/components/ui/form/index.js'; import Input from '$lib/components/ui/input/input.svelte'; import { handleApiError } from '$lib/errorhandling/apiErrorHandling'; import { UserStore } from '$lib/stores/UserStore'; diff --git a/svelte.config.js b/svelte.config.js index 2bd8d377..f9af9308 100644 --- a/svelte.config.js +++ b/svelte.config.js @@ -23,6 +23,8 @@ function getGitHash() { return child_process.execSync('git rev-parse HEAD').toString().trim(); } + +/* eslint-disable-next-line @typescript-eslint/no-unused-vars */ function getGitBranch() { if (isGithubActions) return process.env.GITHUB_REF_NAME; if (isCloudflare) return process.env.CF_BRANCH; @@ -51,7 +53,6 @@ function getSvelteBasePath() { } const commitHash = getGitHash(); -const branchName = getGitBranch(); /** @type {import('@sveltejs/kit').Config} */ const config = {