fix: address ESLint warnings and add Vitest configuration

- Add ESLint flat config with Svelte and TypeScript support
- Fix unused variables and component prop naming
- Add Vitest browser testing setup with Playwright
- Configure separate test projects for client and server code
This commit is contained in:
2025-12-30 12:28:14 -06:00
parent eedf22f86d
commit b809f1c095
10 changed files with 121 additions and 28 deletions
+7
View File
@@ -0,0 +1,7 @@
import { describe, it, expect } from 'vitest';
describe('sum test', () => {
it('adds 1 + 2 to equal 3', () => {
expect(1 + 2).toBe(3);
});
});
+2 -2
View File
@@ -3,7 +3,7 @@
let {
href,
icon,
icon: Icon,
label,
active = false,
size = 18
@@ -23,6 +23,6 @@
</script>
<a {href} class={navLinkClass(active)}>
<icon {size}></icon>
<Icon {size} />
<span>{label}</span>
</a>
+2 -2
View File
@@ -202,7 +202,7 @@
</div>
<div class="absolute right-4 hidden sm:flex gap-4 items-center">
{#each sourceLinks as link}
{#each sourceLinks as link (link.href)}
<a
href={link.href}
title={link.label}
@@ -266,7 +266,7 @@
</button>
</div>
<div class="flex flex-col gap-3">
{#each links as link}
{#each links as link (link.href)}
<NavLink
href={link.href}
icon={link.icon}
+1 -1
View File
@@ -41,7 +41,7 @@
}
}
function handleKeyDown(e: KeyboardEvent) {
function handleKeyDown() {
if (!gameReady || gameStarted) return;
handleInteraction();
}
+13
View File
@@ -0,0 +1,13 @@
import { page } from 'vitest/browser';
import { describe, expect, it } from 'vitest';
import { render } from 'vitest-browser-svelte';
import Page from './+page.svelte';
describe('/+page.svelte', () => {
it('should render h1', async () => {
render(Page);
const heading = page.getByRole('heading', { level: 1 });
await expect.element(heading).toBeInTheDocument();
});
});