chore: Eslint and pre-commit hooks

This commit is contained in:
Leni Aniva 2024-09-28 23:59:37 -07:00
parent b7156d0c93
commit 2b030ab61f
Signed by: aniva
GPG Key ID: 4D9B1C8D10EA4C50
14 changed files with 40 additions and 42 deletions

View File

@ -21,6 +21,8 @@ directory. The website will be built statically in `build/`. Note that changing
## Developing ## Developing
Install [pre-commit](https://pre-commit.com/).
Install dependencies with `npm install` (or `pnpm install` or `yarn`). Then Install dependencies with `npm install` (or `pnpm install` or `yarn`). Then
start the dev server with start the dev server with
@ -43,4 +45,3 @@ npx playwright test
All tests must have the suffix `.spec.[jt]s`. Be cautious while updating All tests must have the suffix `.spec.[jt]s`. Be cautious while updating
`playwright` since the versions in `nixpkgs` and `node` must exactly match. `playwright` since the versions in `nixpkgs` and `node` must exactly match.

View File

@ -11,4 +11,4 @@
"utils": "$lib/utils" "utils": "$lib/utils"
}, },
"typescript": true "typescript": true
} }

View File

@ -17,7 +17,7 @@ export default [
...tseslint.configs.recommended, ...tseslint.configs.recommended,
{ {
rules: { rules: {
"no-unused-vars": [ "@typescript-eslint/no-unused-vars": [
"error", "error",
{ {
"argsIgnorePattern": "^_", "argsIgnorePattern": "^_",

View File

@ -4,73 +4,73 @@
@tailwind base; @tailwind base;
@tailwind components; @tailwind components;
@tailwind utilities; @tailwind utilities;
@layer base { @layer base {
:root { :root {
--background: 0 0% 90%; --background: 0 0% 90%;
--foreground: 20 14.3% 4.1%; --foreground: 20 14.3% 4.1%;
--muted: 60 4.8% 95.9%; --muted: 60 4.8% 95.9%;
--muted-foreground: 25 5.3% 44.7%; --muted-foreground: 25 5.3% 44.7%;
--popover: 0 0% 100%; --popover: 0 0% 100%;
--popover-foreground: 20 14.3% 4.1%; --popover-foreground: 20 14.3% 4.1%;
--card: 0 0% 100%; --card: 0 0% 100%;
--card-foreground: 20 14.3% 4.1%; --card-foreground: 20 14.3% 4.1%;
--border: 20 5.9% 90%; --border: 20 5.9% 90%;
--input: 20 5.9% 90%; --input: 20 5.9% 90%;
--primary: 24 9.8% 10%; --primary: 24 9.8% 10%;
--primary-foreground: 60 9.1% 97.8%; --primary-foreground: 60 9.1% 97.8%;
--secondary: 60 4.8% 95.9%; --secondary: 60 4.8% 95.9%;
--secondary-foreground: 24 9.8% 10%; --secondary-foreground: 24 9.8% 10%;
--accent: 60 4.8% 95.9%; --accent: 60 4.8% 95.9%;
--accent-foreground: 24 9.8% 10%; --accent-foreground: 24 9.8% 10%;
--destructive: 0 72.2% 50.6%; --destructive: 0 72.2% 50.6%;
--destructive-foreground: 60 9.1% 97.8%; --destructive-foreground: 60 9.1% 97.8%;
--ring: 20 14.3% 4.1%; --ring: 20 14.3% 4.1%;
--radius: 0.5rem; --radius: 0.5rem;
} }
.dark { .dark {
--background: 20 14.3% 4.1%; --background: 20 14.3% 4.1%;
--foreground: 60 9.1% 97.8%; --foreground: 60 9.1% 97.8%;
--muted: 12 6.5% 15.1%; --muted: 12 6.5% 15.1%;
--muted-foreground: 24 5.4% 63.9%; --muted-foreground: 24 5.4% 63.9%;
--popover: 20 14.3% 4.1%; --popover: 20 14.3% 4.1%;
--popover-foreground: 60 9.1% 97.8%; --popover-foreground: 60 9.1% 97.8%;
--card: 20 14.3% 4.1%; --card: 20 14.3% 4.1%;
--card-foreground: 60 9.1% 97.8%; --card-foreground: 60 9.1% 97.8%;
--border: 12 6.5% 15.1%; --border: 12 6.5% 15.1%;
--input: 12 6.5% 15.1%; --input: 12 6.5% 15.1%;
--primary: 60 9.1% 97.8%; --primary: 60 9.1% 97.8%;
--primary-foreground: 24 9.8% 10%; --primary-foreground: 24 9.8% 10%;
--secondary: 12 6.5% 15.1%; --secondary: 12 6.5% 15.1%;
--secondary-foreground: 60 9.1% 97.8%; --secondary-foreground: 60 9.1% 97.8%;
--accent: 12 6.5% 15.1%; --accent: 12 6.5% 15.1%;
--accent-foreground: 60 9.1% 97.8%; --accent-foreground: 60 9.1% 97.8%;
--destructive: 0 62.8% 30.6%; --destructive: 0 62.8% 30.6%;
--destructive-foreground: 60 9.1% 97.8%; --destructive-foreground: 60 9.1% 97.8%;
--ring: 24 5.7% 82.9%; --ring: 24 5.7% 82.9%;
} }
} }
@layer base { @layer base {
* { * {
@apply border-border; @apply border-border;

View File

@ -1,4 +1,3 @@
# Archives # Archives
Archives live here Archives live here

View File

@ -23,5 +23,3 @@ Strongest of Gensokyo
for i in range(9): for i in range(9):
print("this is python") print("this is python")
``` ```

View File

@ -48,7 +48,7 @@ function remarkAlert/*: Plugin<[Option?], Root> = */() /*=>*/ {
} }
return item; return item;
}); });
if (!!alertType) { if (alertType) {
node.data = { node.data = {
hName: "div", hName: "div",
hProperties: { hProperties: {

View File

@ -59,4 +59,4 @@ export const flyAndScale = (
}, },
easing: cubicOut easing: cubicOut
}; };
}; };

View File

@ -1,10 +1,10 @@
import { error } from '@sveltejs/kit'; import { error } from '@sveltejs/kit';
import type { PageLoad } from './$types'; import type { PageLoad } from './$types';
export const load: PageLoad = async ({ params }) => { export const load: PageLoad = async (_) => {
const post = await import(`$content/home.md`); const post = await import(`$content/home.md`);
if (!post) throw error(404); if (!post) throw error(404);
const { name, date } = post.metadata; const { name } = post.metadata;
const Content = post.default; const Content = post.default;
return { return {

View File

@ -1,7 +1,6 @@
import { error } from '@sveltejs/kit';
import type { PageLoad } from './$types'; import type { PageLoad } from './$types';
export const load: PageLoad = async ({ params }) => { export const load: PageLoad = async (_) => {
const post = await import("$content/archives.md"); const post = await import("$content/archives.md");
const Content = post.default; const Content = post.default;

View File

@ -1,6 +1,6 @@
import type { PageLoad } from './$types'; import type { PageLoad } from './$types';
export const load: PageLoad = async ({ params }) => { export const load: PageLoad = async (_) => {
const allPostFiles = import.meta.glob('$content/post/*.md'); const allPostFiles = import.meta.glob('$content/post/*.md');
const iterablePostFiles = Object.entries(allPostFiles); const iterablePostFiles = Object.entries(allPostFiles);

View File

@ -15,7 +15,7 @@ export const load: PageLoad = async ({ params }) => {
Content, Content,
}; };
} }
catch(e) { catch {
error(404, `Could not find post ${params.slug}`) error(404, `Could not find post ${params.slug}`)
} }
} }

View File

@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 372.75 369.86"><defs><style>.a{fill:#7ea898;}.b{fill:#98b9ac;}.c{fill:#5e7e72;}.d{fill:#b1cbc1;}.e{fill:#7ea4a8;}</style></defs><title>logo</title><path class="a" d="M374.82,96.22a195.93,195.93,0,0,1,16,13.3,199,199,0,0,1,38.73,48.8l-24.79,14a171.37,171.37,0,0,0-33.2-41.83A174.63,174.63,0,0,0,357.85,119Z" transform="translate(-56.84 -56.84)"/><path class="a" d="M374.82,96.22l-17,22.81a169.62,169.62,0,0,0-64.51-29.62l6.22-27.76A197.51,197.51,0,0,1,374.82,96.22Z" transform="translate(-56.84 -56.84)"/><path class="a" d="M299.56,61.65l-6.22,27.76a171.18,171.18,0,0,0-71-.77l-5.62-27.91A199.82,199.82,0,0,1,299.56,61.65Z" transform="translate(-56.84 -56.84)"/><path class="b" d="M355.19,200.19l37.2-20.94a156.28,156.28,0,0,1,19.41,62.12l-42.5,4A113.46,113.46,0,0,0,355.19,200.19Z" transform="translate(-56.84 -56.84)"/><path class="b" d="M369.3,245.36l42.5-4A156.85,156.85,0,0,1,404.29,306l-40.44-13.64A113.82,113.82,0,0,0,369.3,245.36Z" transform="translate(-56.84 -56.84)"/><path class="c" d="M222.36,88.64l2.8,13.94a155.59,155.59,0,0,0-59.72,25.82l-8.25-11.61A169.73,169.73,0,0,1,222.36,88.64Z" transform="translate(-56.84 -56.84)"/><path class="c" d="M225.16,102.58l8.41,41.85a112.85,112.85,0,0,0-43.43,18.77l-24.7-34.8A155.59,155.59,0,0,1,225.16,102.58Z" transform="translate(-56.84 -56.84)"/><path class="b" d="M363.85,292.37,404.29,306A155.94,155.94,0,0,1,371.09,362l-31.38-28.89A113.48,113.48,0,0,0,363.85,292.37Z" transform="translate(-56.84 -56.84)"/><path class="c" d="M157.19,116.79l8.25,11.61a157.81,157.81,0,0,0-44.07,47.87L109.12,169a172.47,172.47,0,0,1,48.07-52.22Z" transform="translate(-56.84 -56.84)"/><path class="c" d="M165.44,128.4l24.7,34.8A114.42,114.42,0,0,0,158.08,198l-36.71-21.74a157.81,157.81,0,0,1,44.07-47.87Z" transform="translate(-56.84 -56.84)"/><path class="d" d="M371.09,362l10.47,9.64a170.33,170.33,0,0,1-57.85,41.13l-5.64-13.07A155.93,155.93,0,0,0,371.09,362Z" transform="translate(-56.84 -56.84)"/><path class="c" d="M121.37,176.27,158.08,198A113,113,0,0,0,143,242.85l-42.4-4.93A155.54,155.54,0,0,1,121.37,176.27Z" transform="translate(-56.84 -56.84)"/><path class="c" d="M109.12,169l12.25,7.26a155.54,155.54,0,0,0-20.81,61.65l-14.13-1.64A169.67,169.67,0,0,1,109.12,169Z" transform="translate(-56.84 -56.84)"/><path class="d" d="M318.07,399.66l5.64,13.07a170.79,170.79,0,0,1-69.6,14l.16-14.21A157,157,0,0,0,318.07,399.66Z" transform="translate(-56.84 -56.84)"/><path class="e" d="M58.16,233l28.27,3.3A171.33,171.33,0,0,0,93.06,307L65.9,315.45A200,200,0,0,1,58.16,233Z" transform="translate(-56.84 -56.84)"/><path class="d" d="M254.27,412.48l-.16,14.21a170.51,170.51,0,0,1-69.28-15.49l5.94-12.94A156.44,156.44,0,0,0,254.27,412.48Z" transform="translate(-56.84 -56.84)"/><path class="e" d="M65.9,315.45,93.06,307A169.78,169.78,0,0,0,127.9,368.8l-21.34,18.79A197.58,197.58,0,0,1,65.9,315.45Z" transform="translate(-56.84 -56.84)"/><path class="d" d="M190.77,398.26l-5.94,12.94a172.38,172.38,0,0,1-56.93-42.4l10.69-9.41a157.61,157.61,0,0,0,52.18,38.87Z" transform="translate(-56.84 -56.84)"/></svg> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 372.75 369.86"><defs><style>.a{fill:#7ea898;}.b{fill:#98b9ac;}.c{fill:#5e7e72;}.d{fill:#b1cbc1;}.e{fill:#7ea4a8;}</style></defs><title>logo</title><path class="a" d="M374.82,96.22a195.93,195.93,0,0,1,16,13.3,199,199,0,0,1,38.73,48.8l-24.79,14a171.37,171.37,0,0,0-33.2-41.83A174.63,174.63,0,0,0,357.85,119Z" transform="translate(-56.84 -56.84)"/><path class="a" d="M374.82,96.22l-17,22.81a169.62,169.62,0,0,0-64.51-29.62l6.22-27.76A197.51,197.51,0,0,1,374.82,96.22Z" transform="translate(-56.84 -56.84)"/><path class="a" d="M299.56,61.65l-6.22,27.76a171.18,171.18,0,0,0-71-.77l-5.62-27.91A199.82,199.82,0,0,1,299.56,61.65Z" transform="translate(-56.84 -56.84)"/><path class="b" d="M355.19,200.19l37.2-20.94a156.28,156.28,0,0,1,19.41,62.12l-42.5,4A113.46,113.46,0,0,0,355.19,200.19Z" transform="translate(-56.84 -56.84)"/><path class="b" d="M369.3,245.36l42.5-4A156.85,156.85,0,0,1,404.29,306l-40.44-13.64A113.82,113.82,0,0,0,369.3,245.36Z" transform="translate(-56.84 -56.84)"/><path class="c" d="M222.36,88.64l2.8,13.94a155.59,155.59,0,0,0-59.72,25.82l-8.25-11.61A169.73,169.73,0,0,1,222.36,88.64Z" transform="translate(-56.84 -56.84)"/><path class="c" d="M225.16,102.58l8.41,41.85a112.85,112.85,0,0,0-43.43,18.77l-24.7-34.8A155.59,155.59,0,0,1,225.16,102.58Z" transform="translate(-56.84 -56.84)"/><path class="b" d="M363.85,292.37,404.29,306A155.94,155.94,0,0,1,371.09,362l-31.38-28.89A113.48,113.48,0,0,0,363.85,292.37Z" transform="translate(-56.84 -56.84)"/><path class="c" d="M157.19,116.79l8.25,11.61a157.81,157.81,0,0,0-44.07,47.87L109.12,169a172.47,172.47,0,0,1,48.07-52.22Z" transform="translate(-56.84 -56.84)"/><path class="c" d="M165.44,128.4l24.7,34.8A114.42,114.42,0,0,0,158.08,198l-36.71-21.74a157.81,157.81,0,0,1,44.07-47.87Z" transform="translate(-56.84 -56.84)"/><path class="d" d="M371.09,362l10.47,9.64a170.33,170.33,0,0,1-57.85,41.13l-5.64-13.07A155.93,155.93,0,0,0,371.09,362Z" transform="translate(-56.84 -56.84)"/><path class="c" d="M121.37,176.27,158.08,198A113,113,0,0,0,143,242.85l-42.4-4.93A155.54,155.54,0,0,1,121.37,176.27Z" transform="translate(-56.84 -56.84)"/><path class="c" d="M109.12,169l12.25,7.26a155.54,155.54,0,0,0-20.81,61.65l-14.13-1.64A169.67,169.67,0,0,1,109.12,169Z" transform="translate(-56.84 -56.84)"/><path class="d" d="M318.07,399.66l5.64,13.07a170.79,170.79,0,0,1-69.6,14l.16-14.21A157,157,0,0,0,318.07,399.66Z" transform="translate(-56.84 -56.84)"/><path class="e" d="M58.16,233l28.27,3.3A171.33,171.33,0,0,0,93.06,307L65.9,315.45A200,200,0,0,1,58.16,233Z" transform="translate(-56.84 -56.84)"/><path class="d" d="M254.27,412.48l-.16,14.21a170.51,170.51,0,0,1-69.28-15.49l5.94-12.94A156.44,156.44,0,0,0,254.27,412.48Z" transform="translate(-56.84 -56.84)"/><path class="e" d="M65.9,315.45,93.06,307A169.78,169.78,0,0,0,127.9,368.8l-21.34,18.79A197.58,197.58,0,0,1,65.9,315.45Z" transform="translate(-56.84 -56.84)"/><path class="d" d="M190.77,398.26l-5.94,12.94a172.38,172.38,0,0,1-56.93-42.4l10.69-9.41a157.61,157.61,0,0,0,52.18,38.87Z" transform="translate(-56.84 -56.84)"/></svg>

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

@ -1,5 +1,6 @@
import { fontFamily } from "tailwindcss/defaultTheme"; //import { fontFamily } from "tailwindcss/defaultTheme";
import type { Config } from "tailwindcss"; import type { Config } from "tailwindcss";
import typography from '@tailwindcss/typography';
const config: Config = { const config: Config = {
darkMode: ["class"], darkMode: ["class"],
@ -103,12 +104,12 @@ const config: Config = {
sans: '"Source Han Sans SC", "Source Han Sans CN","Noto Sans CJK SC", "Noto Sans", -apple-system, "Helvetica Neue", Helvetica, "Nimbus Sans L", Arial, "Liberation Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Wenquanyi Micro Hei", "WenQuanYi Zen Hei", "ST Heiti", SimHei, "WenQuanYi Zen Hei Sharp", sans-serif', sans: '"Source Han Sans SC", "Source Han Sans CN","Noto Sans CJK SC", "Noto Sans", -apple-system, "Helvetica Neue", Helvetica, "Nimbus Sans L", Arial, "Liberation Sans", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Wenquanyi Micro Hei", "WenQuanYi Zen Hei", "ST Heiti", SimHei, "WenQuanYi Zen Hei Sharp", sans-serif',
//For varible font usage sometimes //For varible font usage sometimes
// 'serif': '"Source Han Serif CN Variable", "Source Han Serif SC", "Source Han Serif CN","Noto Serif CJK SC", "Songti SC", STSong, "AR PL New Sung", "AR PL SungtiL GB", NSimSun, SimSun, "TW\-Sung", "WenQuanYi Bitmap Song", "AR PL UMing CN", "AR PL UMing HK", "AR PL UMing TW", "AR PL UMing TW MBE", PMingLiU, MingLiU, serif', // 'serif': '"Source Han Serif CN Variable", "Source Han Serif SC", "Source Han Serif CN","Noto Serif CJK SC", "Songti SC", STSong, "AR PL New Sung", "AR PL SungtiL GB", NSimSun, SimSun, "TW\-Sung", "WenQuanYi Bitmap Song", "AR PL UMing CN", "AR PL UMing HK", "AR PL UMing TW", "AR PL UMing TW MBE", PMingLiU, MingLiU, serif',
serif: '"Source Han Serif SC", "Source Han Serif CN","Noto Serif CJK SC", "Songti SC", STSong, "AR PL New Sung", "AR PL SungtiL GB", NSimSun, SimSun, "TW\-Sung", "WenQuanYi Bitmap Song", "AR PL UMing CN", "AR PL UMing HK", "AR PL UMing TW", "AR PL UMing TW MBE", PMingLiU, MingLiU, serif', serif: '"Source Han Serif SC", "Source Han Serif CN","Noto Serif CJK SC", "Songti SC", STSong, "AR PL New Sung", "AR PL SungtiL GB", NSimSun, SimSun, "TW-Sung", "WenQuanYi Bitmap Song", "AR PL UMing CN", "AR PL UMing HK", "AR PL UMing TW", "AR PL UMing TW MBE", PMingLiU, MingLiU, serif',
cursive: 'FancyTitleFont,"Source Han Serif SC", "Source Han Serif CN", "Noto Serif CJK SC", "Songti SC", STSong, "AR PL New Sung", "AR PL SungtiL GB", NSimSun, SimSun, "TW\-Sung", "WenQuanYi Bitmap Song", "AR PL UMing CN", "AR PL UMing HK", "AR PL UMing TW", "AR PL UMing TW MBE", PMingLiU, MingLiU, serif', cursive: 'FancyTitleFont,"Source Han Serif SC", "Source Han Serif CN", "Noto Serif CJK SC", "Songti SC", STSong, "AR PL New Sung", "AR PL SungtiL GB", NSimSun, SimSun, "TW-Sung", "WenQuanYi Bitmap Song", "AR PL UMing CN", "AR PL UMing HK", "AR PL UMing TW", "AR PL UMing TW MBE", PMingLiU, MingLiU, serif',
mono: "'Fira Code','Cascadia Code',Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New','Sarasa Mono SC','Noto Sans CJK SC','monospace', monospace" mono: "'Fira Code','Cascadia Code',Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New','Sarasa Mono SC','Noto Sans CJK SC','monospace', monospace"
}, },
typography: ((theme) => { typography: ((theme) => {
let markdownCommon = { const markdownCommon = {
h1: { h1: {
color: theme('colors.eucalyptus.700'), color: theme('colors.eucalyptus.700'),
}, },
@ -149,7 +150,7 @@ const config: Config = {
} }
}, },
plugins: [ plugins: [
require('@tailwindcss/typography'), typography,
], ],
}; };