Skip to content
Merged
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
5 changes: 5 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Formatting-only commits skipped by `git blame`.
# Enable once with: git config blame.ignoreRevsFile .git-blame-ignore-revs

# style(hub): format TypeScript and scripts with Biome
6b6ad4edc12e7685cc78c1cf0c96b930bc0b4742
12 changes: 12 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,14 @@
# Keep bundled license texts byte-identical to upstream on every OS.
apps/hub/src-tauri/licenses/*.txt text eol=lf

# Biome checks LF line endings; keep the files it checks LF on Windows checkouts
# too, so `biome ci` gives the same result with any core.autocrlf setting.
/apps/hub/**/*.ts text eol=lf
/apps/hub/**/*.tsx text eol=lf
/apps/hub/**/*.js text eol=lf
/apps/hub/**/*.mjs text eol=lf
/apps/hub/**/*.cjs text eol=lf
/apps/hub/**/*.css text eol=lf
/apps/hub/biome.json text eol=lf
/apps/hub/src/**/*.json text eol=lf
/apps/hub/scripts/**/*.json text eol=lf
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ jobs:
- name: Install locked frontend dependencies
working-directory: apps/hub
run: npm ci
- name: Biome lint and format
working-directory: apps/hub
run: npx biome ci
- name: Design system doctor
working-directory: apps/hub
run: npm run ds:doctor
Expand Down
16 changes: 16 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ npm run app:dev

See the [README](./README.md#scripts) for the individual frontend and Rust commands.

### Lint and formatting (Biome + Lefthook)

TypeScript and JavaScript in `apps/hub` (`src/`, `scripts/`, `vite.config.ts` and `vitest.canvas.config.ts`) are linted and formatted by [Biome](https://biomejs.dev) (`apps/hub/biome.json`). CSS is linted but not formatted, because tests assert literal CSS text. CI runs `npx biome ci` in `ci.yml`: any lint error or unformatted file fails the check; warnings do not.

After `npm ci`, run `npm run hooks:install` from `apps/hub` once per clone to install the [Lefthook](https://lefthook.dev) `pre-push` hook (`lefthook.yml` at the repository root). It is not automatic because npm lifecycle scripts stay off. The hook runs `npx biome ci` and `cargo fmt --all -- --check` before every push. If it fails, run `npm run check:fix` (and `cargo fmt --all` for Rust), commit, and push again. Skipping it with `--no-verify` only moves the failure to CI.

The repository-wide Biome formatting landed as a formatting-only commit listed in `.git-blame-ignore-revs`; run `git config blame.ignoreRevsFile .git-blame-ignore-revs` once so `git blame` skips it. If you had a branch open before that commit, rebase it on `main` and run `npm run check:fix` to resolve formatting conflicts.

### Branches and pull requests

1. Create a branch for the agreed issue and keep the change focused.
Expand Down Expand Up @@ -87,6 +95,14 @@ npm run app:dev

Consultad el [README](./README.es.md#scripts) para los comandos individuales del frontend y Rust.

### Lint y formato (Biome + Lefthook)

El TypeScript y JavaScript de `apps/hub` (`src/`, `scripts/`, `vite.config.ts` y `vitest.canvas.config.ts`) se analizan y formatean con [Biome](https://biomejs.dev) (`apps/hub/biome.json`). El CSS se analiza pero no se formatea, porque hay tests que comprueban su texto literal. CI ejecuta `npx biome ci` en `ci.yml`: cualquier error de lint o archivo sin formatear hace fallar el check; los warnings no.

Después de `npm ci`, ejecutad una vez por clon `npm run hooks:install` desde `apps/hub` para instalar el hook `pre-push` de [Lefthook](https://lefthook.dev) (`lefthook.yml` en la raíz del repositorio). No es automático porque los scripts de ciclo de vida de npm están desactivados. El hook ejecuta `npx biome ci` y `cargo fmt --all -- --check` antes de cada push. Si falla, ejecutad `npm run check:fix` (y `cargo fmt --all` para Rust), haced commit y volved a hacer push. Saltarlo con `--no-verify` solo traslada el fallo a CI.

El formato de Biome de todo el repositorio entró como un commit solo de formato listado en `.git-blame-ignore-revs`; ejecutad una vez `git config blame.ignoreRevsFile .git-blame-ignore-revs` para que `git blame` lo omita. Si teníais una rama abierta antes de ese commit, rebasadla sobre `main` y ejecutad `npm run check:fix` para resolver los conflictos de formato.

### Ramas y pull requests

1. Cread una rama para la issue acordada y mantened el cambio centrado.
Expand Down
4 changes: 4 additions & 0 deletions README.es.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ Desde `apps/hub`:
| `npm test` | Ejecutar los tests del frontend. |
| `npm run ds:doctor` | Comprobar la instalación del design system y ejecutar su protección (elementos sin componente, selectores internos, lista de excepciones). |
| `npm run build` | Comprobar TypeScript y compilar el frontend. |
| `npm run check` | Lint y comprobación de formato con Biome (CI ejecuta `npx biome ci`). |
| `npm run check:fix` | Aplicar los arreglos seguros y el formato de Biome. |
| `npm run lint` / `npm run format` | Solo lint de Biome / solo escribir el formato. |
| `npm run hooks:install` | Instalar el hook `pre-push` de Lefthook (una vez por clon). |
| `npm run app:dev` | Ejecutar la aplicación de escritorio en desarrollo. |

Desde la raíz del repositorio, tras compilar el frontend:
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ From `apps/hub`:
| `npm test` | Run frontend tests. |
| `npm run ds:doctor` | Check the design-system install and run its guard (raw elements, internal selectors, allowlist). |
| `npm run build` | Check TypeScript and build the frontend. |
| `npm run check` | Biome lint and format check (CI runs `npx biome ci`). |
| `npm run check:fix` | Apply Biome safe fixes and formatting. |
| `npm run lint` / `npm run format` | Biome lint only / write formatting only. |
| `npm run hooks:install` | Install the Lefthook `pre-push` hook (once per clone). |
| `npm run app:dev` | Run the desktop app in development. |

From the repository root, after building the frontend:
Expand Down
39 changes: 39 additions & 0 deletions apps/hub/biome.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
"vcs": {
"enabled": true,
"clientKind": "git",
"root": "../..",
"useIgnoreFile": true,
"defaultBranch": "main"
},
"files": {
"includes": ["src/**", "scripts/**", "vite.config.ts", "vitest.canvas.config.ts"]
},
"formatter": {
"enabled": true,
"indentStyle": "space",
"indentWidth": 2,
"lineWidth": 160
},
"javascript": {
"formatter": {
"quoteStyle": "single",
"jsxQuoteStyle": "double"
}
},
"assist": {
"enabled": false
},
"linter": {
"enabled": true,
"rules": {
"preset": "recommended"
}
},
"css": {
"formatter": {
"enabled": false
}
}
}
Loading
Loading