From 8ec69ff2a4f2f2e4d3f9c26f8de7710df4c264e4 Mon Sep 17 00:00:00 2001
From: Ege Akman
Date: Wed, 3 Apr 2024 09:26:30 +0300
Subject: [PATCH] Add pre-commit checks and fix its complaints (#547)
Closes #497
We can change the ``maxkb`` argument to our needs.
Added some handy checks as well.
Since we are using [``pre-commit``](https://pypi.org/p/pre-commit), we
might want to add that to a ``requirements-dev.txt``.
---
.pre-commit-config.yaml | 21 +++
README.md | 14 ++
src/components/form/label.tsx | 5 +-
src/components/form/select.tsx | 11 +-
src/components/icons/award.astro | 1 -
src/components/icons/headhunt.astro | 1 -
src/components/icons/network.astro | 1 -
src/components/icons/rocket.astro | 1 -
src/components/icons/target.astro | 1 -
src/components/icons/transfer.astro | 1 -
src/components/keynoters/keynoters.tsx | 1 -
src/components/note/note.tsx | 4 +-
.../session-summary/session-summary.tsx | 8 +-
.../sponsor-tiers/sponsor-tiers.tsx | 1 -
src/components/typography/title.tsx | 2 +-
src/consts.ts | 4 +-
src/content/config.ts | 2 +-
src/content/deadlines/00_cfp.mdx | 2 +-
src/data/home/intro.md | 6 +-
src/data/sponsors.json | 21 +--
tailwind.config.mjs | 162 +++++++++---------
tsconfig.json | 2 +-
vercel.json | 4 +-
23 files changed, 157 insertions(+), 119 deletions(-)
create mode 100644 .pre-commit-config.yaml
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 000000000..3a39c4805
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,21 @@
+repos:
+ - repo: https://github.com/pre-commit/pre-commit-hooks
+ rev: v4.5.0
+ hooks:
+ - id: check-added-large-files
+ args: ["--maxkb", "5000"]
+ - id: check-case-conflict
+ - id: check-merge-conflict
+ - id: check-yaml
+ - id: end-of-file-fixer
+ exclude_types: ["svg"]
+ - id: trailing-whitespace
+ exclude_types: ["svg"]
+
+ - repo: https://github.com/pre-commit/mirrors-prettier
+ rev: v3.1.0
+ hooks:
+ - id: prettier
+ args: ["--tab-width", "2", "--trailing-comma", "es5"]
+ exclude_types: ["mdx"]
+ exclude: "pnpm-lock.yaml"
diff --git a/README.md b/README.md
index d2dcc017a..c5fa514f6 100644
--- a/README.md
+++ b/README.md
@@ -14,6 +14,20 @@ 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:
+
+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`.
+
+This will help maintain a consistent coding style and catch common issues before
+submission.
+
### Docker
If you want to run this in docker, run:
diff --git a/src/components/form/label.tsx b/src/components/form/label.tsx
index 793e8cf84..3e37d629b 100644
--- a/src/components/form/label.tsx
+++ b/src/components/form/label.tsx
@@ -6,7 +6,10 @@ export const Label = ({
htmlFor: string;
}) => {
return (
-
{/* */}
- {/* TODO: reuse prose thingy */}
- {/* */}
- {session.abstract}
- {/* */}
+ {/* TODO: reuse prose thingy */}
+ {/* */}
+ {session.abstract}
+ {/* */}
{/* */}
diff --git a/src/components/sponsor-tiers/sponsor-tiers.tsx b/src/components/sponsor-tiers/sponsor-tiers.tsx
index 715b63d94..f23aecbf0 100644
--- a/src/components/sponsor-tiers/sponsor-tiers.tsx
+++ b/src/components/sponsor-tiers/sponsor-tiers.tsx
@@ -217,7 +217,6 @@ export const SponsorTiers = () => {
totalSlots={"unlimited"}
features={["Logo on EuroPython website, welcome tweet and more!"]}
/>
-
);
};
diff --git a/src/components/typography/title.tsx b/src/components/typography/title.tsx
index fe291b963..a7385ad78 100644
--- a/src/components/typography/title.tsx
+++ b/src/components/typography/title.tsx
@@ -26,7 +26,7 @@ export const Title = ({
"text-lg md:text-2xl": level === 5,
"text-lg md:text-xl": level === 6,
},
- className,
+ className
)}
{...props}
>
diff --git a/src/consts.ts b/src/consts.ts
index 0df8a61f4..a9da0d873 100644
--- a/src/consts.ts
+++ b/src/consts.ts
@@ -1,5 +1,5 @@
// Place any global data in this file.
// You can import this data from anywhere in your site by using the `import` keyword.
-export const SITE_TITLE = 'Astro Blog';
-export const SITE_DESCRIPTION = 'Welcome to my website!';
+export const SITE_TITLE = "Astro Blog";
+export const SITE_DESCRIPTION = "Welcome to my website!";
diff --git a/src/content/config.ts b/src/content/config.ts
index 16b44737c..8c720908f 100644
--- a/src/content/config.ts
+++ b/src/content/config.ts
@@ -11,7 +11,7 @@ const pages = defineCollection({
const deadlines = defineCollection({
type: "content",
schema: ({ image }) =>
- z.object({
+ z.object({
title: z.string(),
subtitle: z.string(),
url: z.string(),
diff --git a/src/content/deadlines/00_cfp.mdx b/src/content/deadlines/00_cfp.mdx
index 5efd3d8a2..da1c5c5d7 100644
--- a/src/content/deadlines/00_cfp.mdx
+++ b/src/content/deadlines/00_cfp.mdx
@@ -7,4 +7,4 @@ image: "./cfp1.jpg"
Call for Proposals concluded on March 13th AoE.
We received the record high 627 submissions this year.
-Now it's time for the community voting and review.
\ No newline at end of file
+Now it's time for the community voting and review.
diff --git a/src/data/home/intro.md b/src/data/home/intro.md
index 74ee1aae6..65a8a34f1 100644
--- a/src/data/home/intro.md
+++ b/src/data/home/intro.md
@@ -4,7 +4,8 @@ title: EuroPython Prague, You're invited!
Welcome to the 23rd EuroPython. We're the oldest and longest running
volunteer-led Python programming conference on the planet! Join us in July in
-the vibrant Bohemian city Prague. We'll be together, celebrating our shared passion for Python and its community!
+the vibrant Bohemian city Prague. We'll be together, celebrating our shared
+passion for Python and its community!
A week of all things Python:
@@ -12,4 +13,5 @@ A week of all things Python:
- Wednesday–Friday, 10-12 July: Conference talks & sponsor exhibition
- Saturday & Sunday, 13 & 14 July: Sprints
-If you have any questions, feel free to contact us at [helpdesk@europython.eu](mailto:helpdesk@europython.eu).
+If you have any questions, feel free to contact us at
+[helpdesk@europython.eu](mailto:helpdesk@europython.eu).
diff --git a/src/data/sponsors.json b/src/data/sponsors.json
index 7f6892c49..da15faf4b 100644
--- a/src/data/sponsors.json
+++ b/src/data/sponsors.json
@@ -167,15 +167,15 @@
"logo": "img/logos/sponsor_logos/pretalx.svg"
},
{
- "name": "1Password",
- "url": "https://1password.com/",
- "logo": "img/logos/sponsor_logos/1password.svg"
- },
- {
- "name": "O’Reilly ",
- "url": "https://www.oreilly.com/",
- "logo": "img/logos/sponsor_logos/OReilly.svg"
- },
+ "name": "1Password",
+ "url": "https://1password.com/",
+ "logo": "img/logos/sponsor_logos/1password.svg"
+ },
+ {
+ "name": "O’Reilly ",
+ "url": "https://www.oreilly.com/",
+ "logo": "img/logos/sponsor_logos/OReilly.svg"
+ },
{
"name": "Manning Publications",
"url": "http://mng.bz/vnWa",
@@ -187,5 +187,6 @@
"logo": "img/logos/sponsor_logos/stickermule.svg"
}
]
- }]
+ }
+ ]
}
diff --git a/tailwind.config.mjs b/tailwind.config.mjs
index d6c19de9b..9e7d7c1fe 100644
--- a/tailwind.config.mjs
+++ b/tailwind.config.mjs
@@ -1,93 +1,93 @@
/** @type {import('tailwindcss').Config} */
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: {
- colors: {
- black: "#000",
- white: "#fff",
- text: "var(--color-text)",
- transparent: "transparent",
- current: "currentColor",
- inherit: "inherit",
+ theme: {
+ colors: {
+ black: "#000",
+ white: "#fff",
+ text: "var(--color-text)",
+ transparent: "transparent",
+ current: "currentColor",
+ inherit: "inherit",
- "text-inverted": "var(--color-text-inverted)",
+ "text-inverted": "var(--color-text-inverted)",
- "body-inverted": "#001c13",
- "body-background": "var(--color-body-background)",
- "body-light": "#888",
+ "body-inverted": "#001c13",
+ "body-background": "var(--color-body-background)",
+ "body-light": "#888",
- "hero-primary": "var(--color-hero-primary)",
- "hero-secondary": "var(--color-hero-secondary)",
+ "hero-primary": "var(--color-hero-primary)",
+ "hero-secondary": "var(--color-hero-secondary)",
- primary: "var(--color-primary)",
- "primary-hover": "var(--color-primary-hover)",
- "primary-active": "var(--color-primary-active)",
- button: "var(--color-button)",
- "button-hover": "var(--color-button-hover)",
+ primary: "var(--color-primary)",
+ "primary-hover": "var(--color-primary-hover)",
+ "primary-active": "var(--color-primary-active)",
+ button: "var(--color-button)",
+ "button-hover": "var(--color-button-hover)",
- secondary: "var(--color-secondary)",
- "secondary-dark": "var(--color-secondary-dark)",
- "secondary-darkest": "var(--color-secondary-darkest)",
- "secondary-light": "var(--color-secondary-light)",
+ secondary: "var(--color-secondary)",
+ "secondary-dark": "var(--color-secondary-dark)",
+ "secondary-darkest": "var(--color-secondary-darkest)",
+ "secondary-light": "var(--color-secondary-light)",
- "session-beginner": "#63d451",
- "session-intermediate": "#ffcd45",
- "session-advanced": "#d34848",
- "session-none": "var(--color-secondary-light)",
+ "session-beginner": "#63d451",
+ "session-intermediate": "#ffcd45",
+ "session-advanced": "#d34848",
+ "session-none": "var(--color-secondary-light)",
- "sponsor-keystone": "#5c9f92",
- "sponsor-diamond": "#568497",
- "sponsor-platinum": "#6b6c6e",
- "sponsor-gold": "#f5c251",
- "sponsor-silver": "#707172",
- "sponsor-bronze": "#6e6151",
- "sponsor-patron": "#a11217",
+ "sponsor-keystone": "#5c9f92",
+ "sponsor-diamond": "#568497",
+ "sponsor-platinum": "#6b6c6e",
+ "sponsor-gold": "#f5c251",
+ "sponsor-silver": "#707172",
+ "sponsor-bronze": "#6e6151",
+ "sponsor-patron": "#a11217",
- red: "#ce3333",
- "keynoter-info": "hsla(0,0%,100%,.85)",
- },
- extend: {
- aspectRatio: {
- hero: "2.4380530973",
- },
- fontFamily: {
- system: ["system-ui", "sans-serif"],
- title: [
- "Inter Variable",
- "-apple-system",
- "BlinkMacSystemFont",
- "Segoe UI",
- "Roboto",
- "Helvetica",
- "Arial",
- "sans-serif",
- "Apple Color Emoji",
- "Segoe UI Emoji",
- "Segoe UI Symbol",
- ],
- sans: [
- "-apple-system",
- "BlinkMacSystemFont",
- "Segoe UI",
- "Roboto",
- "Helvetica",
- "Arial",
- "sans-serif",
- "Apple Color Emoji",
- "Segoe UI Emoji",
- "Segoe UI Symbol",
- ],
- },
- typography: (theme) => ({
- DEFAULT: {
- css: {
- color: theme("colors.text"),
- "--tw-prose-headings": theme("colors.white"),
- },
- },
- }),
- },
- },
- plugins: [require("@tailwindcss/typography")],
+ red: "#ce3333",
+ "keynoter-info": "hsla(0,0%,100%,.85)",
+ },
+ extend: {
+ aspectRatio: {
+ hero: "2.4380530973",
+ },
+ fontFamily: {
+ system: ["system-ui", "sans-serif"],
+ title: [
+ "Inter Variable",
+ "-apple-system",
+ "BlinkMacSystemFont",
+ "Segoe UI",
+ "Roboto",
+ "Helvetica",
+ "Arial",
+ "sans-serif",
+ "Apple Color Emoji",
+ "Segoe UI Emoji",
+ "Segoe UI Symbol",
+ ],
+ sans: [
+ "-apple-system",
+ "BlinkMacSystemFont",
+ "Segoe UI",
+ "Roboto",
+ "Helvetica",
+ "Arial",
+ "sans-serif",
+ "Apple Color Emoji",
+ "Segoe UI Emoji",
+ "Segoe UI Symbol",
+ ],
+ },
+ typography: (theme) => ({
+ DEFAULT: {
+ css: {
+ color: theme("colors.text"),
+ "--tw-prose-headings": theme("colors.white"),
+ },
+ },
+ }),
+ },
+ },
+ plugins: [require("@tailwindcss/typography")],
};
diff --git a/tsconfig.json b/tsconfig.json
index 6bed1f7a5..1760d34c3 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -5,4 +5,4 @@
"jsx": "react-jsx",
"jsxImportSource": "react"
}
-}
\ No newline at end of file
+}
diff --git a/vercel.json b/vercel.json
index bf0776cdf..9eaeeef46 100644
--- a/vercel.json
+++ b/vercel.json
@@ -1,3 +1,3 @@
{
- "framework": "astro"
-}
\ No newline at end of file
+ "framework": "astro"
+}