Skip to content

Commit

Permalink
Add pre-commit checks and fix its complaints (#547)
Browse files Browse the repository at this point in the history
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``.
  • Loading branch information
egeakman committed Apr 3, 2024
1 parent 608e623 commit 8ec69ff
Show file tree
Hide file tree
Showing 23 changed files with 157 additions and 119 deletions.
21 changes: 21 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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"
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 4 additions & 1 deletion src/components/form/label.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ export const Label = ({
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
11 changes: 7 additions & 4 deletions src/components/form/select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,13 @@ export const Select = ({
<svg
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 12 8"
className={clsx("absolute top-1/2 -translate-y-1/2 w-6 h-6 pointer-events-none text-primary", {
"right-4": variant === "default",
"right-6": variant === "rounded",
})}
className={clsx(
"absolute top-1/2 -translate-y-1/2 w-6 h-6 pointer-events-none text-primary",
{
"right-4": variant === "default",
"right-6": variant === "rounded",
}
)}
>
<path
d="M10.59.59 6 5.17 1.41.59 0 2l6 6 6-6z"
Expand Down
1 change: 0 additions & 1 deletion src/components/icons/award.astro
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,3 @@ const { class: className } = Astro.props;
</g>
</g>
</svg>

1 change: 0 additions & 1 deletion src/components/icons/headhunt.astro
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,3 @@ const { class: className } = Astro.props;
</g>
</g>
</svg>

1 change: 0 additions & 1 deletion src/components/icons/network.astro
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,3 @@ const { class: className } = Astro.props;
</g>
</g>
</svg>

1 change: 0 additions & 1 deletion src/components/icons/rocket.astro
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,3 @@ const { class: className } = Astro.props;
</g>
</g>
</svg>

1 change: 0 additions & 1 deletion src/components/icons/target.astro
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,3 @@ const { class: className } = Astro.props;
</g>
</g>
</svg>

1 change: 0 additions & 1 deletion src/components/icons/transfer.astro
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,3 @@ const { class: className } = Astro.props;
</g>
</g>
</svg>

1 change: 0 additions & 1 deletion src/components/keynoters/keynoters.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import type { SVGProps } from "react";

import { Keynoter } from "./keynoter";


const Background = (props: SVGProps<SVGSVGElement>) => (
<svg
viewBox="0 0 729 704"
Expand Down
4 changes: 3 additions & 1 deletion src/components/note/note.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
export const Note = ({ children }: { children: string }) => {
return <p className="note text-xl p-4 border-l-4 border-primary">{children}</p>;
return (
<p className="note text-xl p-4 border-l-4 border-primary">{children}</p>
);
};
8 changes: 4 additions & 4 deletions src/components/session-summary/session-summary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ export const SessionSummary = ({
</p>

{/* <Prose> */}
{/* TODO: reuse prose thingy */}
{/* <ReactMarkdown components={{}}> */}
{session.abstract}
{/* </ReactMarkdown> */}
{/* TODO: reuse prose thingy */}
{/* <ReactMarkdown components={{}}> */}
{session.abstract}
{/* </ReactMarkdown> */}
{/* </Prose> */}

<TagContainer>
Expand Down
1 change: 0 additions & 1 deletion src/components/sponsor-tiers/sponsor-tiers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@ export const SponsorTiers = () => {
totalSlots={"unlimited"}
features={["Logo on EuroPython website, welcome tweet and more!"]}
/>

</div>
);
};
2 changes: 1 addition & 1 deletion src/components/typography/title.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const Title = ({
"text-lg md:text-2xl": level === 5,
"text-lg md:text-xl": level === 6,
},
className,
className
)}
{...props}
>
Expand Down
4 changes: 2 additions & 2 deletions src/consts.ts
Original file line number Diff line number Diff line change
@@ -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!";
2 changes: 1 addition & 1 deletion src/content/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
2 changes: 1 addition & 1 deletion src/content/deadlines/00_cfp.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Now it's time for the community voting and review.
6 changes: 4 additions & 2 deletions src/data/home/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ 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:

- Monday & Tuesday, 8 & 9 July: Tutorials & Workshops
- 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).
21 changes: 11 additions & 10 deletions src/data/sponsors.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -187,5 +187,6 @@
"logo": "img/logos/sponsor_logos/stickermule.svg"
}
]
}]
}
]
}
162 changes: 81 additions & 81 deletions tailwind.config.mjs
Original file line number Diff line number Diff line change
@@ -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")],
};
Loading

0 comments on commit 8ec69ff

Please sign in to comment.