Skip to content

Add formatting check to workflows. #1080

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .github/workflows/update-data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@ jobs:
- name: Open pull request
uses: peter-evans/create-pull-request@v6
with:
author:
github-actions[bot] <github-actions[bot]@users.noreply.github.com>
committer:
github-actions[bot] <github-actions[bot]@users.noreply.github.com>
author: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
committer: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
commit-message: "🆕 Update data"
title: "🆕 Update data"
body: "🆕 Update data"
Expand Down
23 changes: 22 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
1 change: 0 additions & 1 deletion .prettierignore

This file was deleted.

16 changes: 16 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"tabWidth": 2,
"trailingComma": "es5",
"plugins": ["prettier-plugin-astro"],
"overrides": [
{
"files": "*.astro",
"options": {
"parser": "astro"
}
}
],
"printWidth": 100,
"bracketSameLine": true,
"endOfLine": "lf"
}
36 changes: 16 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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:

Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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": {
Expand Down
11 changes: 5 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 3 additions & 9 deletions src/components/BaseHead.astro
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,7 @@ const { title, description, image = "/social-card.png" } = Astro.props;
<meta http-equiv="X-Clacks-Overhead" content="GNU Oier Etxaniz" />
<meta http-equiv="X-Clacks-Overhead" content="GNU Russel Winder" />

<script
defer
is:inline
data-domain="ep2025.europython.eu"
src="https://plausible.io/js/script.js"></script>
<script defer is:inline data-domain="ep2025.europython.eu" src="https://plausible.io/js/script.js"
></script>

<script
is:inline
src="https://kit.fontawesome.com/14a4971ab3.js"
crossorigin="anonymous"></script>
<script is:inline src="https://kit.fontawesome.com/14a4971ab3.js" crossorigin="anonymous"></script>
4 changes: 1 addition & 3 deletions src/components/accordion/accordion.astro
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
17 changes: 3 additions & 14 deletions src/components/button-link/button-link.astro
Original file line number Diff line number Diff line change
Expand Up @@ -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");
---

<a
Expand All @@ -31,9 +24,5 @@ const resolvedIsExternal =
>
<slot />

{
resolvedIsExternal && (
<span class="inline-block ml-1 font-system text-lg leading-4">↗</span>
)
}
{resolvedIsExternal && <span class="inline-block ml-1 font-system text-lg leading-4">↗</span>}
</a>
4 changes: 1 addition & 3 deletions src/components/card/card-container.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
export const CardContainer = ({ children }: { children: React.ReactNode }) => (
<section className="justify-center gap-6 flex flex-wrap px-6">
{children}
</section>
<section className="justify-center gap-6 flex flex-wrap px-6">{children}</section>
);
4 changes: 2 additions & 2 deletions src/components/card/card.astro
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ 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"
/>
</div>
</a>
<div class="flex items-center flex-col flex-grow mb-2">
<a href={url} class="block hover:underline">
<h3 >{title}</h3>
<h3>{title}</h3>
</a>
<slot />
</div>
Expand Down
43 changes: 9 additions & 34 deletions src/components/footer.astro
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ const gitVersion = import.meta.env.GIT_VERSION;
---

<Fullbleed className="bg-primary text-white">
<footer
class="max-w-4xl lg:max-w-6xl mx-auto py-16 lg:grid grid-cols-2 px-6 gap-60"
>
<footer class="max-w-4xl lg:max-w-6xl mx-auto py-16 lg:grid grid-cols-2 px-6 gap-60">
<div>
<nav class="mb-12">
<h6 class="font-bold text-xl mb-6">Quicklinks</h6>
Expand All @@ -33,9 +31,7 @@ const gitVersion = import.meta.env.GIT_VERSION;
</nav>
</div>

<article
class="flex flex-col lg:flex-row self-center gap-8 lg:gap-12 justify-end"
>
<article class="flex flex-col lg:flex-row self-center gap-8 lg:gap-12 justify-end">
<div>
<EPSLogo className="max-w-[100px] lg:max-w-[200px] h-auto w-full" />
</div>
Expand All @@ -50,51 +46,30 @@ const gitVersion = import.meta.env.GIT_VERSION;
</address>

<p class="mb-4">
<a
class="underline whitespace-nowrap"
href="https://europython-society.org"
>
<a class="underline whitespace-nowrap" href="https://europython-society.org">
europython-society.org <span> ↗</span>
</a>
<a
class="underline whitespace-nowrap"
href="https://blog.europython.eu"
>
<a class="underline whitespace-nowrap" href="https://blog.europython.eu">
blog.europython.eu <span> ↗</span>
</a>
<br />
<a
class="underline whitespace-nowrap"
href="https://fosstodon.org/@europython"
>
<a class="underline whitespace-nowrap" href="https://fosstodon.org/@europython">
fosstodon.org/@europython <span> ↗</span>
</a>
<br />
<a
class="underline whitespace-nowrap"
href="https://linkedin.com/company/europython"
>
<a class="underline whitespace-nowrap" href="https://linkedin.com/company/europython">
linkedin.com/company/europython <span> ↗</span>
</a>
<br />
<a
class="underline whitespace-nowrap"
href="https://bsky.app/profile/europython.eu"
>
<a class="underline whitespace-nowrap" href="https://bsky.app/profile/europython.eu">
bsky.app/profile/europython.eu <span> ↗</span>
</a>
<br />
<a
class="underline whitespace-nowrap"
href="https://github.com/europython"
>
<a class="underline whitespace-nowrap" href="https://github.com/europython">
github.com/europython <span> ↗</span>
</a>
<br />
<a
class="underline whitespace-nowrap"
href="https://twitter.com/europython"
>
<a class="underline whitespace-nowrap" href="https://twitter.com/europython">
twitter.com/europython <span> ↗</span>
</a>
</p>
Expand Down
13 changes: 2 additions & 11 deletions src/components/form/label.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
export const Label = ({
children,
htmlFor,
}: {
children: React.ReactNode;
htmlFor: string;
}) => {
export const Label = ({ children, htmlFor }: { children: React.ReactNode; htmlFor: string }) => {
return (
<label
htmlFor={htmlFor}
className="block text-primary font-bold mb-4 pl-3 text-lg"
>
<label htmlFor={htmlFor} className="block text-primary font-bold mb-4 pl-3 text-lg">
{children}
</label>
);
Expand Down
6 changes: 4 additions & 2 deletions src/components/header/header-actions.astro
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ const IS_LIVE = false;
{
!mobile ? (
<>
<Button url="/tickets" icon="ticket">Register Now!</Button>
<Button url="/tickets" icon="ticket">
Register Now!
</Button>
{IS_LIVE && <Button url="/live">Live</Button>}
</>
) : null
Expand Down Expand Up @@ -116,7 +118,7 @@ const IS_LIVE = false;
--pagefind-ui-border: #d8d8d8;
--pagefind-ui-border-width: 2px;
--pagefind-ui-border-radius: 0;
width:50%;
width: 50%;
min-width: 10vw;
}
.pagefind-ui.yellow {
Expand Down
Loading
Loading