From 6cd1ae915f580eba4c8d1b53d3cf03dd63b8b2e5 Mon Sep 17 00:00:00 2001 From: Bradley Shellnut Date: Wed, 24 Jan 2024 21:13:15 -0800 Subject: [PATCH] Fixing svelte check errors that I can, adding explicit TypeScript ignore comments for those I need to look into later, and fixing warnings. --- package.json | 2 +- pnpm-lock.yaml | 10 +- src/lib/components/Articles.svelte | 4 - src/lib/components/contactHub/index.svelte | 3 +- src/lib/components/footer/index.svelte | 17 ---- src/lib/components/logo/index.svelte | 13 ++- src/lib/components/pagination/index.svelte | 1 - .../portfolio/personal-website-gatsby.ts | 5 +- src/lib/renderImage.ts | 3 +- src/lib/types/album.ts | 1 + src/lib/util/cookieUtils.ts | 17 ---- src/routes/articles/[page]/+page.svelte | 93 +------------------ src/routes/og/+server.ts | 1 + src/routes/portfolio/+page.svelte | 4 + src/routes/uses/+page.svelte | 3 + 15 files changed, 32 insertions(+), 145 deletions(-) delete mode 100644 src/lib/util/cookieUtils.ts diff --git a/package.json b/package.json index 9ddcfb8..eedac04 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "eslint-plugin-svelte": "^2.35.1", "iconify-icon": "^1.0.8", "just-intersect": "^4.3.0", - "mdsvex": "^0.10.6", + "mdsvex": "^0.11.0", "mdsvex-relative-images": "^1.0.3", "postcss": "^8.4.33", "postcss-import": "^15.1.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c6a1fd4..b5302f9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -86,8 +86,8 @@ devDependencies: specifier: ^4.3.0 version: 4.3.0 mdsvex: - specifier: ^0.10.6 - version: 0.10.6(svelte@4.2.9) + specifier: ^0.11.0 + version: 0.11.0(svelte@4.2.9) mdsvex-relative-images: specifier: ^1.0.3 version: 1.0.3 @@ -3465,10 +3465,10 @@ packages: unist-util-visit: 3.1.0 dev: true - /mdsvex@0.10.6(svelte@4.2.9): - resolution: {integrity: sha512-aGRDY0r5jx9+OOgFdyB9Xm3EBr9OUmcrTDPWLB7a7g8VPRxzPy4MOBmcVYgz7ErhAJ7bZ/coUoj6aHio3x/2mA==} + /mdsvex@0.11.0(svelte@4.2.9): + resolution: {integrity: sha512-gJF1s0N2nCmdxcKn8HDn0LKrN8poStqAicp6bBcsKFd/zkUBGLP5e7vnxu+g0pjBbDFOscUyI1mtHz+YK2TCDw==} peerDependencies: - svelte: 3.x + svelte: '>=3 <5' dependencies: '@types/unist': 2.0.6 prism-svelte: 0.4.7 diff --git a/src/lib/components/Articles.svelte b/src/lib/components/Articles.svelte index ddd7a4d..7c0f468 100644 --- a/src/lib/components/Articles.svelte +++ b/src/lib/components/Articles.svelte @@ -103,10 +103,6 @@ font-size: 2rem; } - & a + svg { - text-decoration: none; - } - @media (max-width: 1000px) { font-size: 1.5rem; } diff --git a/src/lib/components/contactHub/index.svelte b/src/lib/components/contactHub/index.svelte index 6182422..a7c182b 100644 --- a/src/lib/components/contactHub/index.svelte +++ b/src/lib/components/contactHub/index.svelte @@ -4,6 +4,7 @@ import linkedin from '@iconify-icons/radix-icons/linkedin-logo'; import twitter from '@iconify-icons/radix-icons/twitter-logo'; + export let showGithub: boolean = false; export let showTwitter: boolean = false; export let showLinkedIn: boolean = false; export let showEmail: boolean = false; @@ -42,7 +43,7 @@ {/if} - {#if github && userNames?.github} + {#if showGithub && userNames?.github} ' is not assignable to type 'string'.ts(2322) + const bee: string = beeIcon; + // @ts-expect-error: Type 'Record' is not assignable to type 'string'.ts(2322) + const shell: string = shellIcon; + // @ts-expect-error: Type 'Record' is not assignable to type 'string'.ts(2322) + const nut: string = nutIcon;
- Bee Icon + Bee Icon

Bradley

- Shell Icon + Shell Icon

Shell

- Nut Icon + Nut Icon

Nut

diff --git a/src/lib/components/pagination/index.svelte b/src/lib/components/pagination/index.svelte index 29803fa..7fa5778 100644 --- a/src/lib/components/pagination/index.svelte +++ b/src/lib/components/pagination/index.svelte @@ -3,7 +3,6 @@ export let pageSize: number; export let totalCount: number; export let currentPage: number; - export let skip: number; export let base: string; // make some variables diff --git a/src/lib/content/portfolio/personal-website-gatsby.ts b/src/lib/content/portfolio/personal-website-gatsby.ts index a14e1cd..7bf0721 100644 --- a/src/lib/content/portfolio/personal-website-gatsby.ts +++ b/src/lib/content/portfolio/personal-website-gatsby.ts @@ -17,11 +17,10 @@ type Sources = { height: string; }; -const { height, src, width }: ImageMeta = meta; +const { height, src, width } = meta as ImageMeta; const sources: Sources[] = []; -const imageFormatsMetadata: ImageMeta[] = JSON.parse(formatMeta); -console.log(`Image format metadata: ${JSON.parse(imageFormatsMetadata)}`); +const imageFormatsMetadata: ImageMeta[] = JSON.parse(`${formatMeta}`); for (const metadata of imageFormatsMetadata) { sources.push({ srcset: new URL(metadata.src), diff --git a/src/lib/renderImage.ts b/src/lib/renderImage.ts index 602e047..dd74830 100644 --- a/src/lib/renderImage.ts +++ b/src/lib/renderImage.ts @@ -6,10 +6,11 @@ import { read } from '$app/server'; // we use a Vite plugin to turn this import into the result of fs.readFileSync during build import firaSansSemiBold from '$lib/fonts/FiraSans-SemiBold.ttf'; +import type { SvelteComponent } from 'svelte'; const fontData = read(firaSansSemiBold).arrayBuffer(); -export async function componentToPng(component, +export async function componentToPng(component: SvelteComponent, props: Record, height: number, width: number) { const result = component.render(props); diff --git a/src/lib/types/album.ts b/src/lib/types/album.ts index 07ec0d1..aa153c1 100644 --- a/src/lib/types/album.ts +++ b/src/lib/types/album.ts @@ -7,6 +7,7 @@ export type Album = { artwork: string; title: string; artist: string; + src: Record | ExternalImageSource[] | undefined }; export type ExternalImageSource = { diff --git a/src/lib/util/cookieUtils.ts b/src/lib/util/cookieUtils.ts deleted file mode 100644 index 261342a..0000000 --- a/src/lib/util/cookieUtils.ts +++ /dev/null @@ -1,17 +0,0 @@ -export function getCookieLookup() { - if (typeof document !== 'object') { - return {}; - } - - return document.cookie.split('; ').reduce((lookup, v) => { - const parts = v.split('='); - lookup[parts[0]] = parts[1]; - - return lookup; - }, {}); -} - -export const getCurrentCookieValue = (name) => { - const cookies = getCookieLookup(); - return cookies[name] ?? ''; -}; diff --git a/src/routes/articles/[page]/+page.svelte b/src/routes/articles/[page]/+page.svelte index abac63e..d267118 100644 --- a/src/routes/articles/[page]/+page.svelte +++ b/src/routes/articles/[page]/+page.svelte @@ -7,117 +7,26 @@ export let data: PageData; let articles: Article[]; let currentPage: number; - let totalPages: number; let totalArticles: number; let limit: number; $: ({ articles, currentPage, totalPages, totalArticles, limit } = data); - $: seoTitle = `Tech Articles - Page ${currentPage} | Bradley Shellnut`; -
+

Favorite Tech Articles

-
- - \ No newline at end of file diff --git a/src/routes/og/+server.ts b/src/routes/og/+server.ts index 00c63c8..6f1a9ac 100644 --- a/src/routes/og/+server.ts +++ b/src/routes/og/+server.ts @@ -13,6 +13,7 @@ export async function GET({ url }) { const page = url.searchParams.get('page') ?? undefined; const content = url.searchParams.get('content') ?? ''; + // @ts-expect-error: Argument of type 'typeof SocialImageCard__SvelteComponent_' is not assignable to parameter of type 'SvelteComponent' return componentToPng(SocialImageCard, { header, page, diff --git a/src/routes/portfolio/+page.svelte b/src/routes/portfolio/+page.svelte index 1caa122..e32d1ac 100644 --- a/src/routes/portfolio/+page.svelte +++ b/src/routes/portfolio/+page.svelte @@ -6,9 +6,13 @@ import weddingWebsite from "$lib/assets/images/portfolio/Wedding_Website.png?as=run"; import oldSite from '$lib/assets/images/portfolio/Old_Website_Bradley_Shellnut.png?as=run'; import shellnutArchitectWebsite from "$lib/assets/images/portfolio/Mark_Shellnut_Architect.png?as=run"; + // @ts-expect-error: Cannot find module '$lib/content/uses/development.md' or its corresponding type declarations.ts(2307) import PersonalWebsiteSvelteKit from "$lib/content/portfolio/personal/personal-website-sveltekit.md"; + // @ts-expect-error: Cannot find module '$lib/content/uses/development.md' or its corresponding type declarations.ts(2307) import WeddingWebsite from '$lib/content/portfolio/personal/wedding-website.md'; + // @ts-expect-error: Cannot find module '$lib/content/uses/development.md' or its corresponding type declarations.ts(2307) import MarkShellnutArchitect from '$lib/content/portfolio/professional/mark-shellnut-architect.md'; + // @ts-expect-error: Cannot find module '$lib/content/uses/development.md' or its corresponding type declarations.ts(2307) import OldWebsite from '$lib/content/portfolio/personal/old-website.md'; import ExternalLink from '$lib/components/ExternalLink.svelte'; diff --git a/src/routes/uses/+page.svelte b/src/routes/uses/+page.svelte index a02f9c3..0b3cfa3 100644 --- a/src/routes/uses/+page.svelte +++ b/src/routes/uses/+page.svelte @@ -2,8 +2,11 @@ import ExternalLink from '$lib/components/ExternalLink.svelte'; import LazyImage from '$lib/components/LazyImage.svelte'; import desktop from '$lib/assets/images/Desktop_so_clean.jpg?as=run'; + // @ts-expect-error: Cannot find module '$lib/content/uses/development.md' or its corresponding type declarations.ts(2307) import HardwareAccessories from '$lib/content/uses/hardware-accessories.md'; + // @ts-expect-error: Cannot find module '$lib/content/uses/development.md' or its corresponding type declarations.ts(2307) import Development from '$lib/content/uses/development.md'; + // @ts-expect-error: Cannot find module '$lib/content/uses/development.md' or its corresponding type declarations.ts(2307) import PrivacyHardwareSoftware from '$lib/content/uses/privacy-hardware-software.md';