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/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; --- -