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
Install [pre-commit](https://pre-commit.com/).
Install dependencies with `npm install` (or `pnpm install` or `yarn`). Then
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
`playwright` since the versions in `nixpkgs` and `node` must exactly match.

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
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 iterablePostFiles = Object.entries(allPostFiles);

View File

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

View File

@ -1,5 +1,6 @@
import { fontFamily } from "tailwindcss/defaultTheme";
//import { fontFamily } from "tailwindcss/defaultTheme";
import type { Config } from "tailwindcss";
import typography from '@tailwindcss/typography';
const config: Config = {
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',
//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 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',
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',
mono: "'Fira Code','Cascadia Code',Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New','Sarasa Mono SC','Noto Sans CJK SC','monospace', monospace"
},
typography: ((theme) => {
let markdownCommon = {
const markdownCommon = {
h1: {
color: theme('colors.eucalyptus.700'),
},
@ -149,7 +150,7 @@ const config: Config = {
}
},
plugins: [
require('@tailwindcss/typography'),
typography,
],
};