Skip to content

Commit 94480ba

Browse files
authored
Implement dprint and biome as a linter and formatter (#21)
* feat(lint): biome init to provide a biome.json with default config We intend to use biome with default config. The only change done in this biome.json is to add vcs support and use .gitignore * fmt(dprint): dprint init, dprint.json dprint uses gitignore, as default. We use dprint to supplement biome, our main linter+formatter. Also, I configure some plugins to format dockerfile, yaml and css-related formats. * ci: dprint fmt && biome check --write * chore: add dprint + biome information at README * ci: pnpm add -D @biomejs/biome dprint * ci(package.json): add check script * doc(README): add install and development instructions * ci: pnpm update * ci: pnpm check * fix!: pnpm update GitHub notified me for a astro-related vulnerability. Confirmed using `pnpm audit`. Ran `pnpm update`, `pnpm audit` again, call it a day. * ci: use --fix flag at biome check * ci: pnpm check * ci: biome check --write * fix(lint): biome lint failing at .css Related: biomejs/biome#4141 >Issue Summary When working with .css files in a Tailwind CSS environment, >the formatter occasionally throws an error: > >✖ expected '}' but instead the file ends This error often occurs when >using directives like @apply and functions such as theme(). Despite >appearing to be a syntax error, the root cause is typically a missing >semicolon (;) at the end of a line using these directives.
1 parent e1b623f commit 94480ba

36 files changed

+8297
-6951
lines changed

.github/workflows/deploy.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
# Trigger the workflow every time you push to the `main` branch
55
# Using a different branch name? Replace `main` with your branch’s name
66
push:
7-
branches: [ main ]
7+
branches: [main]
88
# Allows you to run this workflow manually from the Actions tab on GitHub.
99
workflow_dispatch:
1010

@@ -23,9 +23,9 @@ jobs:
2323
- name: Install, build, and upload your site
2424
uses: withastro/action@v3
2525
# with:
26-
# path: . # The root location of your Astro project inside the repository. (optional)
27-
# node-version: 20 # The specific version of Node that should be used to build your site. Defaults to 20. (optional)
28-
# package-manager: pnpm@latest # The Node package manager that should be used to install dependencies and build your site. Automatically detected based on your lockfile. (optional)
26+
# path: . # The root location of your Astro project inside the repository. (optional)
27+
# node-version: 20 # The specific version of Node that should be used to build your site. Defaults to 20. (optional)
28+
# package-manager: pnpm@latest # The Node package manager that should be used to install dependencies and build your site. Automatically detected based on your lockfile. (optional)
2929

3030
deploy:
3131
needs: build
@@ -36,4 +36,4 @@ jobs:
3636
steps:
3737
- name: Deploy to GitHub Pages
3838
id: deployment
39-
uses: actions/deploy-pages@v4
39+
uses: actions/deploy-pages@v4

.vscode/extensions.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"recommendations": ["astro-build.astro-vscode"],
3-
"unwantedRecommendations": []
2+
"recommendations": ["astro-build.astro-vscode"],
3+
"unwantedRecommendations": []
44
}

.vscode/launch.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
2-
"version": "0.2.0",
3-
"configurations": [
4-
{
5-
"command": "./node_modules/.bin/astro dev",
6-
"name": "Development server",
7-
"request": "launch",
8-
"type": "node-terminal"
9-
}
10-
]
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"command": "./node_modules/.bin/astro dev",
6+
"name": "Development server",
7+
"request": "launch",
8+
"type": "node-terminal"
9+
}
10+
]
1111
}

README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,47 @@ Ser la referencia en Ecuador para conectar, fortalecer y ampliar el impacto de l
1414
* **Amplificar el impacto:** Potenciar el alcance y visibilidad de las iniciativas locales.
1515
* **Crear oportunidades:** Generar espacios para el aprendizaje, networking y desarrollo profesional.
1616

17+
## ¿Cómo contribuir en este repositorio?
18+
19+
Este repositorio tiene instalado:
20+
21+
- Un linter, `biome`
22+
- Un formatter, `dprint`
23+
24+
Además de usar `pnpm` cómo administrador de paquetes para JS y amigos.
25+
26+
### Biome
27+
28+
`biome` es una alternativa a ESLint + Prettier, que está escrita en Rust. Es una excelente herramienta, que acorta considerablemente el tiempo de desarrollo. Aunque esta herramienta tiene un [paquete distribuído a través de `npm`](https://www.npmjs.com/package/@biomejs/biome), la invocación a través de `npm` / `pnpm` es un cuello de botella para su rendimiento.
29+
30+
### Dprint
31+
32+
Al igual que `biome`, esta es una herramienta intencionada en reemplazar, en este caso, a Prettier. La razón por la cuál usamos `dprint` es porque [`biome` tiene soporte parcial para HTML y sus supersets](https://biomejs.dev/internals/language-support/#html-super-languages-support). Es decir: usamos `dprint` para suplementar biome.
33+
34+
### Instalación
35+
36+
#### pnpm
37+
38+
Preferimos una instalación global usando `pnpm`
39+
40+
```sh
41+
pnpm install --global @biomejs/biome dprint
42+
```
43+
44+
Sin embargo, tanto `biome` como `dprint` están declarados cómo dependencias de desarrollo dentro del `package.json`.
45+
46+
>[Estamos a la mitad de una implementación de Nix, como administrador de paquete.](https://github.com/Ecuador-In-Tech/web/pull/20)
47+
48+
### Desarrollo
49+
50+
La tubería UNIX intencionada para el desarrollo de este proyecto es:
51+
52+
```sh
53+
pnpm check && pnpm dev
54+
```
55+
56+
>Se está ponderando qué task runner se implementará para mejorar la experiencia de desarrollo
57+
1758
### **Valores**
1859

1960
* **Colaboración**

astro.config.mjs

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
11
// @ts-check
2-
import { defineConfig } from 'astro/config';
2+
import { defineConfig } from "astro/config";
33

4-
import tailwind from '@astrojs/tailwind';
4+
import tailwind from "@astrojs/tailwind";
55

6-
import alpinejs from '@astrojs/alpinejs';
6+
import alpinejs from "@astrojs/alpinejs";
77

8-
import sitemap from '@astrojs/sitemap';
8+
import sitemap from "@astrojs/sitemap";
99

10-
import compressor from 'astro-compressor';
10+
import compressor from "astro-compressor";
1111

1212
// https://astro.build/config
1313
export default defineConfig({
14-
site: "https://ecuadorintech.org",
15-
integrations: [
16-
tailwind({
17-
applyBaseStyles: false,
18-
}),
19-
alpinejs(), sitemap(), compressor()]
20-
})
14+
site: "https://ecuadorintech.org",
15+
integrations: [
16+
tailwind({
17+
applyBaseStyles: false,
18+
}),
19+
alpinejs(),
20+
sitemap(),
21+
compressor(),
22+
],
23+
});

biome.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
3+
"vcs": {
4+
"enabled": true,
5+
"clientKind": "git",
6+
"useIgnoreFile": true
7+
},
8+
"files": {
9+
"ignoreUnknown": false,
10+
"ignore": []
11+
},
12+
"formatter": {
13+
"enabled": true,
14+
"indentStyle": "tab"
15+
},
16+
"organizeImports": {
17+
"enabled": true
18+
},
19+
"linter": {
20+
"enabled": true,
21+
"rules": {
22+
"recommended": true
23+
}
24+
},
25+
"javascript": {
26+
"formatter": {
27+
"quoteStyle": "double"
28+
}
29+
}
30+
}

dprint.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"dockerfile": {},
3+
"biome": {},
4+
"malva": {},
5+
"markup": {},
6+
"yaml": {},
7+
"excludes": ["**/node_modules"],
8+
"plugins": [
9+
"https://plugins.dprint.dev/dockerfile-0.3.2.wasm",
10+
"https://plugins.dprint.dev/biome-0.7.1.wasm",
11+
"https://plugins.dprint.dev/g-plane/malva-v0.11.1.wasm",
12+
"https://plugins.dprint.dev/g-plane/markup_fmt-v0.18.0.wasm",
13+
"https://plugins.dprint.dev/g-plane/pretty_yaml-v0.5.0.wasm"
14+
]
15+
}

0 commit comments

Comments
 (0)