chore(deps): Upgrade packages & fix typings + formatting

This commit is contained in:
saibotk 2024-02-21 20:19:57 +01:00
parent 00903dbf57
commit 77adc92a40
Signed by: saibotk
GPG key ID: 67585F0065E261D5
11 changed files with 5386 additions and 2898 deletions

View file

@ -1,22 +1,22 @@
module.exports = { {
extends: ["@clickbar/typescript", "plugin:astro/recommended"], "extends": ["@clickbar/typescript", "plugin:astro/recommended"],
overrides: [ "overrides": [
{ {
// Define the configuration for `.astro` file. // Define the configuration for `.astro` file.
files: ["*.astro"], "files": ["*.astro"],
// Allows Astro components to be parsed. // Allows Astro components to be parsed.
parser: "astro-eslint-parser", "parser": "astro-eslint-parser",
// Parse the script in `.astro` as TypeScript by adding the following configuration. // Parse the script in `.astro` as TypeScript by adding the following configuration.
// It's the setting you need when using TypeScript. // It's the setting you need when using TypeScript.
parserOptions: { "parserOptions": {
parser: "@typescript-eslint/parser", "parser": "@typescript-eslint/parser",
extraFileExtensions: [".astro"], "extraFileExtensions": [".astro"]
}, },
rules: { "rules": {
// override/add rules settings here, such as: // override/add rules settings here, such as:
// Does not work well with typescript // Does not work well with typescript
"no-undef": "off", "no-undef": "off"
}, }
}, }
], ]
}; }

View file

@ -1,11 +0,0 @@
module.exports = {
plugins: [require.resolve("prettier-plugin-astro")],
overrides: [
{
files: "*.astro",
options: {
parser: "astro",
},
},
],
};

View file

@ -15,19 +15,19 @@
"astro": "astro" "astro": "astro"
}, },
"dependencies": { "dependencies": {
"@astrojs/mdx": "^1.0.0", "@astrojs/mdx": "^2.1.1",
"@astrojs/rss": "^3.0.0", "@astrojs/rss": "^4.0.5",
"@astrojs/sitemap": "^3.0.0", "@astrojs/sitemap": "^3.1.0",
"@astrojs/tailwind": "^5.0.0", "@astrojs/tailwind": "^5.1.0",
"@clickbar/eslint-config-typescript": "^9.0.0", "@clickbar/eslint-config-typescript": "^10.0.0",
"@fontsource/fira-code": "^5.0.8", "@fontsource/fira-code": "^5.0.16",
"@fontsource/inter": "^5.0.8", "@fontsource/inter": "^5.0.16",
"@tailwindcss/typography": "^0.5.9", "@tailwindcss/typography": "^0.5.10",
"astro": "^3.0.7", "astro": "^4.4.1",
"eslint": "^8.48.0", "eslint": "^8.56.0",
"eslint-plugin-astro": "^0.29.0", "eslint-plugin-astro": "^0.31.4",
"prettier-plugin-astro": "^0.12.0", "prettier-plugin-astro": "^0.13.0",
"tailwindcss": "^3.3.3", "tailwindcss": "^3.4.1",
"typescript": "^5.2.2" "typescript": "^5.3.3"
} }
} }

8086
pnpm-lock.yaml generated

File diff suppressed because it is too large Load diff

10
src/env.d.ts vendored
View file

@ -1 +1,11 @@
/// <reference types="astro/client" /> /// <reference types="astro/client" />
import "astro/astro-jsx";
declare global {
namespace JSX {
type Element = HTMLElement;
// type Element = astroHTML.JSX.Element // We want to use this, but it is defined as any.
type IntrinsicElements = astroHTML.JSX.IntrinsicElements;
}
}

View file

@ -19,8 +19,8 @@ const { pageTitle, description } = Astro.props
<html lang="en"> <html lang="en">
<head> <head>
<BaseHead <BaseHead
title={((pageTitle && pageTitle + ' - ') || '') + SITE_TITLE} title={((pageTitle && pageTitle + ' - ') ?? '') + SITE_TITLE}
description={(description && description) || SITE_DESCRIPTION} description={(description && description) ?? SITE_DESCRIPTION}
/> />
</head> </head>
<body <body

View file

@ -1,7 +1,14 @@
--- ---
import Base from '../layouts/Base.astro' import Base from '../layouts/Base.astro'
const rawPosts = await Astro.glob('./posts/**/*.{md,mdx}') interface Frontmatter {
title: string
description?: string
pubDate: string
draft?: boolean
}
const rawPosts = await Astro.glob<Frontmatter>('./posts/**/*.md')
const posts = rawPosts const posts = rawPosts
.filter((post) => !post.frontmatter.draft) .filter((post) => !post.frontmatter.draft)
.sort( .sort(

View file

@ -2,12 +2,17 @@ import rss, { pagesGlobToRssItems } from "@astrojs/rss";
import { SITE_TITLE, SITE_DESCRIPTION } from "../config"; import { SITE_TITLE, SITE_DESCRIPTION } from "../config";
export async function GET() { import type { RSSFeedItem } from "@astrojs/rss";
import type { APIContext } from "astro";
export async function GET(context: APIContext) {
return rss({ return rss({
title: SITE_TITLE, title: SITE_TITLE,
description: SITE_DESCRIPTION, description: SITE_DESCRIPTION,
site: import.meta.env.SITE, site: context.site ?? "",
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-argument
items: await pagesGlobToRssItems(import.meta.glob("./posts/**/*.{md,mdx}")), items: (await pagesGlobToRssItems(
import.meta.glob("./posts/**/*.md"),
)) as RSSFeedItem[],
}); });
} }

View file

@ -1,8 +1,8 @@
/* eslint-disable @typescript-eslint/no-var-requires */ import typographyPlugin from "@tailwindcss/typography";
const defaultTheme = require("tailwindcss/defaultTheme"); import defaultTheme from "tailwindcss/defaultTheme";
/** @type {import('tailwindcss').Config} */ /** @type {import('tailwindcss').Config} */
module.exports = { export default {
content: ["./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}"], content: ["./src/**/*.{astro,html,js,jsx,md,mdx,svelte,ts,tsx,vue}"],
theme: { theme: {
extend: { extend: {
@ -12,5 +12,5 @@ module.exports = {
}, },
}, },
}, },
plugins: [require("@tailwindcss/typography")], plugins: [typographyPlugin],
}; };

View file

@ -7,5 +7,6 @@
"@components/*": ["src/components/*"], "@components/*": ["src/components/*"],
"@images/*": ["src/images/*"] "@images/*": ["src/images/*"]
} }
} },
"include": ["src/**/*", "astro.config.js", "tailwind.config.js"]
} }