Skip to content

Commit f921518

Browse files
committed
Enable pedantic linting, add staged hooks, fix all violations
1 parent af3d911 commit f921518

21 files changed

Lines changed: 103 additions & 197 deletions

.github/workflows/lint.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,6 @@ jobs:
2020

2121
- name: Lint and format check
2222
run: npx vp check
23+
24+
- name: Svelte type check
25+
run: npx svelte-kit sync && npx svelte-check-rs --threshold error

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ build
77

88
# secrets
99
.env
10+
package-lock.json

.pre-commit-config.yaml

Lines changed: 0 additions & 57 deletions
This file was deleted.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"rehype-katex-svelte": "^1.2.0",
4343
"remark-math": "3.0.1",
4444
"svelte": "5.54.0",
45-
"svelte-multiselect": "^11.6.3",
45+
"svelte-multiselect": "^11.6.4",
4646
"svelte-preprocess": "^6.0.3",
4747
"svelte-preprocess-import-assets": "^1.1.0",
4848
"svelte2tsx": "^0.7.52",

src/app.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ body {
8080
min-height: 100vh;
8181
display: flex;
8282
flex-direction: column;
83+
transition:
84+
background-color 0.3s,
85+
color 0.3s;
8386
}
8487
main {
8588
padding: calc(1ex + 2vw);

src/app.html

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,17 @@
55
<meta name="author" content="Janosh Riebesell" />
66
<meta name="color-scheme" content="light dark" />
77

8+
<!-- Theme switching (prevent flash before Svelte hydrates) -->
89
<script>
9-
// Set theme immediately to prevent flashing
10-
try {
11-
const theme =
12-
localStorage.getItem('theme') ||
13-
(window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light')
14-
document.documentElement.style.colorScheme = theme
15-
} catch {
16-
document.documentElement.style.colorScheme = 'dark'
17-
}
10+
const saved = localStorage.theme
11+
const theme =
12+
saved === 'light' || saved === 'dark'
13+
? saved
14+
: matchMedia('(prefers-color-scheme: dark)').matches
15+
? 'dark'
16+
: 'light'
17+
document.documentElement.style.colorScheme = theme
18+
document.documentElement.dataset.theme = theme
1819
</script>
1920

2021
<meta property="og:type" content="website" />
@@ -55,6 +56,6 @@
5556
</head>
5657

5758
<body data-sveltekit-preload-data="hover">
58-
%sveltekit.body%
59+
<div style="display: contents">%sveltekit.body%</div>
5960
</body>
6061
</html>

src/lib/Footer.svelte

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,31 @@
11
<script>
22
import pkg from '$root/package.json'
33
import Icon from '@iconify/svelte'
4+
import { ThemeToggle } from 'svelte-multiselect'
5+
6+
let scroll_y = $state(0)
7+
let show_scroll_top = $derived(scroll_y > globalThis.innerHeight)
48
</script>
59

6-
<button onclick={() => document.body.scrollIntoView({ behavior: `smooth` })}>
7-
<Icon icon="material-symbols:arrow-upward-rounded" />
8-
</button>
10+
<svelte:window bind:scrollY={scroll_y} />
11+
12+
{#if show_scroll_top}
13+
<button onclick={() => document.body.scrollIntoView({ behavior: `smooth` })}>
14+
<Icon icon="material-symbols:arrow-upward-rounded" />
15+
</button>
16+
{/if}
917

1018
<footer>
11-
<a href={pkg.repository}><Icon icon="octicon:mark-github" width="20pt" />Source</a>
19+
<a href={pkg.repository} style=" display: flex"><Icon icon="octicon:mark-github" width="20pt" />&ensp;Source</a>
20+
<ThemeToggle tooltip={false} style="transform: scale(1.4)" />
1221
</footer>
1322

1423
<style>
1524
footer {
1625
margin: 3em;
17-
}
18-
footer a {
1926
display: flex;
2027
place-content: center;
21-
gap: 5pt;
28+
gap: max(1em, 2vw);
2229
}
2330
button {
2431
position: fixed;

src/lib/PaperGrid.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
})
3737
3838
const all_years = Array.from(papers_by_week.keys()).map((key) =>
39-
parseInt(key.split(`-`)[0])
39+
parseInt(key.split(`-`)[0], 10)
4040
)
4141
const [min_year, max_year] = [Math.min(...all_years), Math.max(...all_years)]
4242
years = Array.from({ length: max_year - min_year + 1 }, (_, i) => min_year + i)

src/lib/ThemeToggle.svelte

Lines changed: 0 additions & 51 deletions
This file was deleted.

src/lib/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,5 @@ export { default as LiteYouTubeEmbed } from './LiteYouTubeEmbed.svelte'
44
export { default as PaperGrid } from './PaperGrid.svelte'
55
export { default as PaperTimeline } from './PaperTimeline.svelte'
66
export { default as SortButtons } from './SortButtons.svelte'
7-
export { default as ThemeToggle } from './ThemeToggle.svelte'
87

98
export type * from './types'

0 commit comments

Comments
 (0)