From e4f48b4e2f2f3aad3a514367c6204e83172d5f80 Mon Sep 17 00:00:00 2001 From: Niko Date: Thu, 27 Mar 2025 21:05:01 +0100 Subject: [PATCH] Update formatter. --- .github/workflows/update-data.yml | 6 +- .pre-commit-config.yaml | 23 +- .prettierignore | 1 - .prettierrc | 16 + README.md | 36 +- astro.config.mjs | 2 +- package.json | 7 +- pnpm-lock.yaml | 11 +- src/components/BaseHead.astro | 12 +- src/components/accordion/accordion.astro | 4 +- src/components/button-link/button-link.astro | 17 +- src/components/card/card-container.tsx | 4 +- src/components/card/card.astro | 4 +- src/components/footer.astro | 43 +- src/components/form/label.tsx | 13 +- src/components/header/header-actions.astro | 6 +- src/components/hero2/hero.astro | 72 +-- src/components/hero2/icon-label.astro | 4 +- src/components/icons/target.astro | 6 +- src/components/keynoters/keynoter.astro | 24 +- src/components/keynoters/keynoters.astro | 16 +- src/components/layout/fullbleed.tsx | 8 +- src/components/logo/logo-extended.tsx | 55 +-- src/components/logo/logo.tsx | 277 ++---------- src/components/nav-items/nav-items.tsx | 15 +- src/components/note/note.tsx | 4 +- src/components/schedule/session.astro | 12 +- src/components/schedule/speakers.astro | 2 +- src/components/sections/prague.astro | 11 +- src/components/sections/updates.astro | 17 +- src/components/session-speakers.astro | 2 +- src/components/sessions/filter.astro | 14 +- src/components/sessions/list-sessions.astro | 12 +- src/components/sponsor-tiers/ribbon.astro | 8 +- .../sponsor-tiers/sponsor-tiers.astro | 19 +- src/components/sponsors/sponsor-tier.astro | 7 +- src/components/sponsors/sponsors.astro | 46 +- .../ticket-tiers/ticket-tiers.astro | 16 +- src/components/ui/Button.astro | 54 +-- src/components/ui/Headline.astro | 22 +- src/components/ui/Icon.astro | 38 +- src/content/deadlines/00_cfc.md | 6 +- src/content/deadlines/00_cfp.md | 6 +- src/content/deadlines/00_mentorship.md | 5 +- src/content/deadlines/00_voting.md | 3 +- src/content/deadlines/01_questionnaire.md | 4 +- src/content/deadlines/02_sponsorship.md | 4 +- src/content/deadlines/03_finaid.md | 4 +- src/content/deadlines/04_tickets.md | 4 +- src/content/pages/contacts.mdx | 24 +- src/content/pages/explore.mdx | 104 +++-- src/content/pages/faq.mdx | 68 ++- src/content/pages/finaid.mdx | 307 +++++++------ src/content/pages/programme/c-api-summit.mdx | 31 +- src/content/pages/programme/cfp.mdx | 115 +++-- src/content/pages/programme/mentorship.mdx | 52 +-- src/content/pages/programme/rust-summit.mdx | 65 +-- src/content/pages/programme/selection.mdx | 27 +- src/content/pages/programme/sessions.mdx | 247 +++++----- src/content/pages/programme/tracks.mdx | 90 +++- src/content/pages/programme/voting.mdx | 91 ++-- src/content/pages/programme/wasm-summit.mdx | 34 +- src/content/pages/sponsorship/information.mdx | 422 ++++++++++-------- src/content/pages/sponsorship/sponsor.mdx | 137 +++--- src/content/pages/terms.mdx | 331 +++++++------- src/content/pages/test.mdx | 114 +++-- src/content/pages/tickets.mdx | 127 ++++-- src/content/pages/visa.mdx | 49 +- src/content/pages/where.mdx | 73 ++- src/data/home/intro.md | 9 +- src/data/home/prague.mdx | 4 +- src/pages/404.astro | 34 +- src/pages/[...slug].astro | 3 +- src/pages/robots.txt.ts | 3 +- src/pages/schedule/[day].astro | 62 +-- src/pages/session/[slug].astro | 58 +-- src/pages/speaker/[slug].astro | 13 +- src/pages/test_components.astro | 33 +- src/styles/global.css | 6 +- 79 files changed, 1825 insertions(+), 1910 deletions(-) delete mode 100644 .prettierignore create mode 100644 .prettierrc diff --git a/.github/workflows/update-data.yml b/.github/workflows/update-data.yml index c38123318..186da2f2c 100644 --- a/.github/workflows/update-data.yml +++ b/.github/workflows/update-data.yml @@ -26,10 +26,8 @@ jobs: - name: Open pull request uses: peter-evans/create-pull-request@v6 with: - author: - github-actions[bot] - committer: - github-actions[bot] + author: github-actions[bot] + committer: github-actions[bot] commit-message: "🆕 Update data" title: "🆕 Update data" body: "🆕 Update data" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 48ca79789..6599b8452 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,6 +16,27 @@ repos: rev: v4.0.0-alpha.8 hooks: - id: prettier - args: ["--tab-width", "2", "--trailing-comma", "es5"] + args: + [ + "--tab-width", + "2", + "--trailing-comma", + "es5", + "--print-width", + "100", + "--bracket-same-line", + "true", + ] additional_dependencies: ["prettier", "prettier-plugin-astro"] exclude: "pnpm-lock.yaml" + files: \.(astro|mdx|md|yml|yaml|ts|js|mjs)$ + + - repo: local + hooks: + - id: astro-check + name: astro check + entry: astro check + language: node + files: "^(?:public|src)/.+|astro\\.config\\.mjs|tsconfig\\.json" + pass_filenames: false + additional_dependencies: ["astro", "@astrojs/check"] diff --git a/.prettierignore b/.prettierignore deleted file mode 100644 index 1b9355bd3..000000000 --- a/.prettierignore +++ /dev/null @@ -1 +0,0 @@ -*.mdx diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 000000000..f1271dce6 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,16 @@ +{ + "tabWidth": 2, + "trailingComma": "es5", + "plugins": ["prettier-plugin-astro"], + "overrides": [ + { + "files": "*.astro", + "options": { + "parser": "astro" + } + } + ], + "printWidth": 100, + "bracketSameLine": true, + "endOfLine": "lf" +} diff --git a/README.md b/README.md index c5fa514f6..ab447677f 100644 --- a/README.md +++ b/README.md @@ -2,31 +2,30 @@ ## Introduction 👋 -Welcome to the repository for the EuroPython website! We use -[Astro](https://astro.build) in combination with pnpm to manage dependencies. +Welcome to the repository for the EuroPython website! We use [Astro](https://astro.build) in +combination with pnpm to manage dependencies. ## Setup 🛠️ ### Local dev env -To get started, clone the repository and run `pnpm install` to fetch all the -dependencies. Then, use `pnpm run dev` to start the development server. +To get started, clone the repository and run `pnpm install` to fetch all the dependencies. Then, use +`pnpm run dev` to start the development server. The website will be available at `http://localhost:4321`. ### Pre-commit Setup -To ensure code quality and consistency, we use `pre-commit` hooks. Follow these -steps to set up `pre-commit` on your local environment: +To ensure code quality and consistency, we use `pre-commit` hooks. Follow these steps to set up +`pre-commit` on your local environment: 1. Install `pre-commit`. You can follow the instructions from [pre-commit.com](https://pre-commit.com/#install). 2. Run `pre-commit install` in the root of your local repository. -3. Now, `pre-commit` will run automatically on `git commit`. You can also run it - manually on all files using `pre-commit run --all-files`. +3. Now, `pre-commit` will run automatically on `git commit`. You can also run it manually on all + files using `pre-commit run --all-files`. -This will help maintain a consistent coding style and catch common issues before -submission. +This will help maintain a consistent coding style and catch common issues before submission. ### Docker @@ -41,25 +40,22 @@ The website will be available at `http://localhost:4321`. ## Content Structure 🗂️ -The content of the site is store in this repository. We are using Astro's -content collections to manage the content. The collections are configure inside -`src/content/config.ts`. +The content of the site is store in this repository. We are using Astro's content collections to +manage the content. The collections are configure inside `src/content/config.ts`. ### Pages -Pages are stored in the `src/content/pages` directory. Each page is a mdx file -with frontmatter. +Pages are stored in the `src/content/pages` directory. Each page is a mdx file with frontmatter. ### Deadlines -Meanwhile, our important deadlines ⏰ are located inside the -`src/content/deadlines` directory. +Meanwhile, our important deadlines ⏰ are located inside the `src/content/deadlines` directory. ## Using Astro Image Component 🖼️ -When adding images to the website, please make sure to use astro Image component -and to specify the width of the image. This will make sure we are optimizing the -images and not serving large images to the users. +When adding images to the website, please make sure to use astro Image component and to specify the +width of the image. This will make sure we are optimizing the images and not serving large images to +the users. Here is an example: diff --git a/astro.config.mjs b/astro.config.mjs index 73673847d..618169cb1 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -59,7 +59,7 @@ export default defineConfig({ site: process.env.SITE_URL || "https://ep2025.europython.eu", redirects: { "/c-api-summit/": "/programme/c-api-summit/", - "/programme/cfp/": "/programme/cfp/", + "/cfp/": "/programme/cfp/", "/planning/": "https://forms.gle/riw6CvML8ck94A4V9", "/reviewers/": "https://forms.gle/4GTJjwZ1nHBGetM18", "/rust-summit/": "/programme/rust-summit/", diff --git a/package.json b/package.json index 11b34b982..8b4f49a09 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,8 @@ "build": "astro check && astro build && pnpm pagefind --site dist", "preview": "astro preview", "astro": "astro", - "format": "prettier --write --plugin=prettier-plugin-astro ." + "format:files": "pnpm prettier --config .prettierrc --write --log-level=error", + "format": "pnpm run format:files ." }, "dependencies": { "@astro-community/astro-embed-youtube": "^0.5.6", @@ -21,7 +22,6 @@ "@tailwindcss/typography": "^0.5.16", "@types/react": "^19.0.12", "@types/react-dom": "^19.0.4", - "astro": "^5.1.6", "astro-delete-unused-images": "^1.0.3", "astro-meta-tags": "^0.3.1", "astro-pagefind": "^1.8.1", @@ -40,7 +40,8 @@ "typescript": "^5.7.3" }, "devDependencies": { - "prettier": "^3.4.2", + "astro": "^5.5.2", + "prettier": "^3.5.3", "prettier-plugin-astro": "^0.14.1" }, "prettier": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 82ca365b6..8f925fe2f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -37,9 +37,6 @@ importers: "@types/react-dom": specifier: ^19.0.4 version: 19.0.4(@types/react@19.0.12) - astro: - specifier: ^5.1.6 - version: 5.5.2(jiti@1.21.7)(rollup@4.35.0)(typescript@5.8.2)(yaml@2.7.0) astro-delete-unused-images: specifier: ^1.0.3 version: 1.0.3 @@ -89,8 +86,11 @@ importers: specifier: ^5.7.3 version: 5.8.2 devDependencies: + astro: + specifier: ^5.5.2 + version: 5.5.2(jiti@1.21.7)(rollup@4.35.0)(typescript@5.8.2)(yaml@2.7.0) prettier: - specifier: ^3.4.2 + specifier: ^3.5.3 version: 3.5.3 prettier-plugin-astro: specifier: ^0.14.1 @@ -1500,8 +1500,7 @@ packages: { integrity: sha512-SOTJxB8mqxe/KEYEJiLIot0YULiCffyfTEclwmdeaASitDJ7eLM/KYrJ9sx3U5hq9GVI17Z4Y0P/1T2aQ0ZN3A==, } - engines: - { node: ^18.17.1 || ^20.3.0 || >=22.0.0, npm: ">=9.6.5", pnpm: ">=7.1.0" } + engines: { node: ^18.17.1 || ^20.3.0 || >=22.0.0, npm: ">=9.6.5", pnpm: ">=7.1.0" } hasBin: true autoprefixer@10.4.21: diff --git a/src/components/BaseHead.astro b/src/components/BaseHead.astro index 372114db3..59f2f6064 100644 --- a/src/components/BaseHead.astro +++ b/src/components/BaseHead.astro @@ -53,13 +53,7 @@ const { title, description, image = "/social-card.png" } = Astro.props; - + - + diff --git a/src/components/accordion/accordion.astro b/src/components/accordion/accordion.astro index d4a3ca670..63743a455 100644 --- a/src/components/accordion/accordion.astro +++ b/src/components/accordion/accordion.astro @@ -27,9 +27,7 @@ const { title, id } = Astro.props; document.addEventListener("DOMContentLoaded", () => { const hash = window.location.hash.substring(1); // Remove # if (hash) { - const details = document.getElementById( - hash, - ) as HTMLDetailsElement | null; + const details = document.getElementById(hash) as HTMLDetailsElement | null; if (details) { details.open = true; } diff --git a/src/components/button-link/button-link.astro b/src/components/button-link/button-link.astro index 7202882c4..74f4de5b6 100644 --- a/src/components/button-link/button-link.astro +++ b/src/components/button-link/button-link.astro @@ -10,15 +10,8 @@ export interface Props { isExternal?: boolean; } -const { - url, - className = "", - secondary = false, - disabled = false, - isExternal, -} = Astro.props; -const resolvedIsExternal = - isExternal !== undefined ? isExternal : url?.startsWith("http"); +const { url, className = "", secondary = false, disabled = false, isExternal } = Astro.props; +const resolvedIsExternal = isExternal !== undefined ? isExternal : url?.startsWith("http"); --- - { - resolvedIsExternal && ( - - ) - } + {resolvedIsExternal && } diff --git a/src/components/card/card-container.tsx b/src/components/card/card-container.tsx index 7ee4f841e..cacaaac13 100644 --- a/src/components/card/card-container.tsx +++ b/src/components/card/card-container.tsx @@ -1,5 +1,3 @@ export const CardContainer = ({ children }: { children: React.ReactNode }) => ( -
- {children} -
+
{children}
); diff --git a/src/components/card/card.astro b/src/components/card/card.astro index 5312f3ff2..f29170096 100644 --- a/src/components/card/card.astro +++ b/src/components/card/card.astro @@ -22,7 +22,7 @@ const { title, subtitle, url, image } = Astro.props; src={image} width={600} height={375} - alt=`Card image - ${title}` + alt=`Card image - ${title}` class="not-prose rounded-xl aspect-[3/2] w-full" loading="lazy" /> @@ -30,7 +30,7 @@ const { title, subtitle, url, image } = Astro.props; diff --git a/src/components/footer.astro b/src/components/footer.astro index 83f15a299..c2748752d 100644 --- a/src/components/footer.astro +++ b/src/components/footer.astro @@ -9,9 +9,7 @@ const gitVersion = import.meta.env.GIT_VERSION; --- -