Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ node_modules
.netlify
.wrangler
/.svelte-kit
/.svelte-check
/build

# OS
Expand Down
14 changes: 14 additions & 0 deletions .oxlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"ignorePatterns": ["**/*.svelte", ".svelte-kit", ".svelte-check", "build"],
"rules": {
"no-unused-vars": [
"warn",
{
"argsIgnorePattern": "^_",
"varsIgnorePattern": "^_",
"caughtErrorsIgnorePattern": "^_"
}
]
}
}
2 changes: 1 addition & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"recommendations": ["svelte.svelte-vscode", "oxc.oxc-vscode", "dbaeumer.vscode-eslint"]
"recommendations": ["svelte.svelte-vscode", "oxc.oxc-vscode"]
}
7 changes: 6 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,10 @@
"files.eol": "\n",
"oxc.fmt.configPath": ".oxfmtrc.json",
"editor.defaultFormatter": "oxc.oxc-vscode",
"editor.formatOnSave": true
"editor.formatOnSave": true,
// The svelte extension formats with its bundled prettier, which drifts from
// rsvelte-fmt. Format .svelte files via `bun run format` instead.
"[svelte]": {
"editor.formatOnSave": false
}
}
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

- **Language**: TypeScript
- **Package Manager**: bun
- **Add-ons**: oxfmt, eslint, sveltekit-adapter, mcp
- **Add-ons**: oxfmt, oxlint, rsvelte, sveltekit-adapter, mcp

---

Expand Down
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
### An opinionated SvelteKit starter, with the following opinions:

- TypeScript
- Oxfmt
- ESLint
- rsvelte (Rust Svelte compiler via Vite plugin)
- Oxfmt (via rsvelte-fmt)
- Oxlint
- MCP (incl. Claude, Cursor, Gemini)
- Bun
- Component & Library aliases
Expand All @@ -21,7 +22,7 @@
- Security headers in hooks
- Size CSS shorthand (kitto)
- SSL support with mkcert
- Svelte Check RS
- rsvelte toolchain (svelte-check, fmt, lint)
- UI state store
- Variablised media query breakpoints (kitto)

Expand All @@ -38,8 +39,8 @@ To recreate the underlying SvelteKit setup use this configuration:

```sh
# recreate this project
bun x sv@0.16.4 create --template minimal --types ts --add eslint sveltekit-adapter="adapter:auto" mcp="ide:claude-code,cursor,gemini+setup:remote" --install bun .
bun add -d oxfmt
bun x sv@0.16.4 create --template minimal --types ts --add sveltekit-adapter="adapter:auto" mcp="ide:claude-code,cursor,gemini+setup:remote" --install bun .
bun add -d oxfmt oxlint @rsvelte/svelte-check @rsvelte/fmt @rsvelte/lint
```

## Developing
Expand Down
331 changes: 120 additions & 211 deletions bun.lock

Large diffs are not rendered by default.

52 changes: 0 additions & 52 deletions eslint.config.js

This file was deleted.

33 changes: 18 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,30 @@
"build": "vite build",
"preview": "vite preview",
"prepare": "svelte-kit sync || echo ''",
"check": "svelte-kit sync && svelte-check-rs --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check-rs --tsconfig ./tsconfig.json --watch",
"lint": "oxfmt --check . && eslint .",
"format": "oxfmt"
"check": "svelte-kit sync && rsvelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && rsvelte-check --tsconfig ./tsconfig.json --watch",
"lint": "rsvelte-fmt --check . && oxlint && rsvelte-lint src",
"format": "rsvelte-fmt"
},
"overrides": {
"@sveltejs/vite-plugin-svelte": "npm:@rsvelte/vite-plugin-svelte@^0.4.2"
},
"devDependencies": {
"@eslint/js": "10.0.1",
"@rsvelte/fmt": "0.7.2",
"@rsvelte/lint": "0.9.2",
"@rsvelte/svelte-check": "0.5.1",
"@sveltejs/adapter-auto": "7.0.1",
"@sveltejs/kit": "2.70.1",
"@sveltejs/vite-plugin-svelte": "7.2.0",
"@types/node": "26.1.1",
"eslint": "10.7.0",
"eslint-config-prettier": "10.1.8",
"eslint-plugin-svelte": "3.22.0",
"globals": "17.7.0",
"@sveltejs/vite-plugin-svelte": "0.5.0",
"kitto": "1.8.0",
"oxfmt": "0.60.0",
"oxlint": "1.75.0",
"svelte": "5.56.7",
"svelte-check-rs": "0.11.0",
"typescript": "5.9.3",
"typescript-eslint": "8.65.0",
"typescript": "7.0.2",
"vite": "8.1.5"
}
},
"trustedDependencies": [
"@rsvelte/fmt",
"@rsvelte/lint"
]
}
12 changes: 12 additions & 0 deletions rsvelte-lint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"extends": ["recommended"],
"rules": {
"svelte/no-at-html-tags": "off",
"svelte/no-navigation-without-resolve": "off",
"svelte/block-lang": "off",
"svelte/consistent-selector-style": "off",
"svelte/no-inline-styles": "off",
"svelte/prefer-destructured-store-props": "off",
"svelte/require-optimized-style-attribute": "off"
}
}
4 changes: 2 additions & 2 deletions src/components/button.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
class={['button', cls]}
{href}
type={href ? undefined : (type ?? 'button')}
{...rest}>
{@render children?.()}
{...rest}
>{@render children?.()}
</svelte:element>

<style lang="css">
Expand Down
3 changes: 1 addition & 2 deletions src/components/cookies.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
<div class="title">This site uses cookies to measure and improve your experience.</div>
{#if details}
<div class="details" transition:slide>
We use cookies to improve your experience.<br />"Essential" cookies are needed for the site to
function.
We use cookies to improve your experience.<br />"Essential" cookies are needed for the site to function.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious on this diff, do we need to change line width or was this previously formatted incorrectly?

<dl>
<dt>Essential</dt>
<dd>Online support</dd>
Expand Down
6 changes: 4 additions & 2 deletions src/hooks.server.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export function handleError({ error }) {
import type { Handle, HandleServerError } from '@sveltejs/kit'

export const handleError: HandleServerError = ({ error }) => {

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I always dislike this added ceremony (explicitly importing types that SvelteKit has already typed through its magic 🪄)

I can either learn to embrace types everywhere even though its already typesafe, for the sake of being explicit (good argument for it) - or, can we revert this as the types are already applied?

const env = import.meta.env.environment
const err = error instanceof Error ? error : new Error('Unknown error')

Expand All @@ -10,7 +12,7 @@ export function handleError({ error }) {
}
}

export const handle = async ({ event, resolve }) => {
export const handle: Handle = async ({ event, resolve }) => {
const response = await resolve(event)

response.headers.set('Cache-Control', 'no-cache')
Expand Down
9 changes: 4 additions & 5 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,10 @@ export const prefs = storable&lt;{ cookies?: boolean }&gt;({}, 'prefs')`
<section class="hero">
<h1 class="hero-title">Starter Kit</h1>
<p class="hero-desc">
This repo is a working SvelteKit app not a tutorial site. It comes with Bun-friendly scripts,
TypeScript, linting and formatting, LightningCSS helpers for breakpoints and fluid type, basic
security headers, and a few small UI pieces (loader, optional cookie banner, analytics helper)
already imported or one comment away. Use it as a shortcut so you are not redoing the same wiring on
every new project. When you are ready,
This repo is a working SvelteKit app not a tutorial site. It comes with Bun-friendly scripts, TypeScript,
linting and formatting, LightningCSS helpers for breakpoints and fluid type, basic security headers, and a few
small UI pieces (loader, optional cookie banner, analytics helper) already imported or one comment away. Use
it as a shortcut so you are not redoing the same wiring on every new project. When you are ready,
<span>replace or delete this page</span>
and ship your own home screen.
</p>
Expand Down
5 changes: 5 additions & 0 deletions src/rsvelte.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// @sveltejs/vite-plugin-svelte is aliased to @rsvelte/vite-plugin-svelte (see package.json overrides),
// whose bundled types only declare the @rsvelte module name. Re-export them under the aliased name.
declare module '@sveltejs/vite-plugin-svelte' {
export * from '@rsvelte/vite-plugin-svelte'
}
6 changes: 4 additions & 2 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ export default defineConfig({
$components: './src/components',
$library: './src/library'
},
compilerOptions: {
vitePlugin: {
// Force runes mode for the project, except for libraries. Can be removed in svelte 6.
runes: ({ filename }) => (filename.split(/[/\\]/).includes('node_modules') ? undefined : true)
// Resolved per-file in JS — rsvelte's native compiler can't accept function options.
dynamicCompileOptions: ({ filename }) =>
filename.split(/[/\\]/).includes('node_modules') ? undefined : { runes: true }
}
})
]
Expand Down