chore: add ESLint, Prettier, and Vitest tooling

Add code-quality tooling the project lacked:
- ESLint (flat config via @sveltejs/eslint-config)
- Prettier (tabs, single quotes, matching existing style)
- Vitest (node env, for pure-logic unit tests)
- npm scripts: lint, format, format:check, test, test:watch

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-03 09:29:28 -07:00
parent 5e2cd60895
commit a85bd16218
6 changed files with 2111 additions and 8 deletions
+6
View File
@@ -0,0 +1,6 @@
build/
.svelte-kit/
node_modules/
package-lock.json
static/
*.md
+15
View File
@@ -0,0 +1,15 @@
{
"useTabs": true,
"singleQuote": true,
"trailingComma": "none",
"printWidth": 100,
"plugins": ["prettier-plugin-svelte"],
"overrides": [
{
"files": "*.svelte",
"options": {
"parser": "svelte"
}
}
]
}
+20
View File
@@ -0,0 +1,20 @@
import svelteConfig from '@sveltejs/eslint-config';
/** @type {import('eslint').Linter.Config[]} */
export default [
{
ignores: ['build/', '.svelte-kit/', 'static/', 'node_modules/']
},
...svelteConfig,
{
// Service worker runs in a ServiceWorkerGlobalScope, not the browser/node defaults.
files: ['static/service-worker.js'],
languageOptions: {
globals: {
self: 'readonly',
caches: 'readonly',
fetch: 'readonly'
}
}
}
];
+2048 -5
View File
File diff suppressed because it is too large Load Diff
+15 -2
View File
@@ -9,17 +9,30 @@
"preview": "vite preview",
"prepare": "svelte-kit sync || echo ''",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch"
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "prettier --check . && eslint .",
"format": "prettier --write .",
"format:check": "prettier --check .",
"test": "vitest run",
"test:watch": "vitest"
},
"devDependencies": {
"@sveltejs/adapter-auto": "^7.0.0",
"@sveltejs/adapter-static": "^3.0.10",
"@sveltejs/eslint-config": "^10.0.1",
"@sveltejs/kit": "^2.49.1",
"@sveltejs/vite-plugin-svelte": "^6.2.1",
"eslint": "^10.4.1",
"eslint-plugin-svelte": "^3.19.0",
"globals": "^17.6.0",
"prettier": "^3.8.3",
"prettier-plugin-svelte": "^4.1.0",
"svelte": "^5.45.6",
"svelte-check": "^4.3.4",
"typescript": "^5.9.3",
"vite": "^7.2.6"
"typescript-eslint": "^8.60.1",
"vite": "^7.2.6",
"vitest": "^4.1.8"
},
"dependencies": {
"gsap": "^3.14.2",
+7 -1
View File
@@ -1,6 +1,12 @@
/// <reference types="vitest/config" />
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
export default defineConfig({
plugins: [sveltekit()]
plugins: [sveltekit()],
test: {
// Pure-logic unit tests (utils, data). No DOM needed.
environment: 'node',
include: ['src/**/*.{test,spec}.ts']
}
});