From 19a55b71b01e55a8e1a33f5e01356d4e30734bf9 Mon Sep 17 00:00:00 2001 From: kiskaadee Date: Thu, 1 Oct 2026 05:34:35 -0500 Subject: [PATCH] knowledge(biome): document monorepo vcs symmetry and root resolution --- .../biome-monorepo-vcs-symmetry.md | 76 +++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 04-learning/knowledge/technologies/biome-monorepo-vcs-symmetry.md diff --git a/04-learning/knowledge/technologies/biome-monorepo-vcs-symmetry.md b/04-learning/knowledge/technologies/biome-monorepo-vcs-symmetry.md new file mode 100644 index 0000000..e083481 --- /dev/null +++ b/04-learning/knowledge/technologies/biome-monorepo-vcs-symmetry.md @@ -0,0 +1,76 @@ +--- +type: knowledge +status: stable +topics: ['frontend', 'biome', 'tooling', 'monorepo'] +--- + +# Biome Linter Monorepo Symmetry & VCS Root Resolution + +## 1. Problem: Configuration Asymmetry in Polyglot Repositories + +In modern fullstack or polyglot application repositories (e.g. FastAPI/Go/Rust backend + React/Vite SPA frontend), developer tooling presents a layout dilemma: + +* **Backend Tooling Autonomy**: Python tools like `uv`, `ruff`, or `pytest` locate their configuration strictly via directory traversal for `pyproject.toml`. They operate completely indifferent to Git repository root boundaries. +* **Frontend Tooling Creep**: By contrast, JS/TS linters historically placed configuration files (`.eslintrc.json`, `prettierrc`, or `biome.json`) at the repository root. When Biome has Git integration enabled (`vcs: { enabled: true, useIgnoreFile: true }`), placing `biome.json` inside `frontend/` causes Biome to fail if executed from a subfolder without its own local `.gitignore`: + ```text + internalError/fs: Biome couldn't find an ignore file + ``` +* **The Asymmetry**: This often pushes developers to put `biome.json` at the root, making the repository root asymmetric: Python is cleanly encapsulated in `backend/`, while JavaScript tooling pollutes the top-level directory. + +--- + +## 2. Solution: VCS Root Resolution (`vcs.root`) + +Biome v2 introduces explicit version control root configuration via `vcs.root`. By pointing the VCS root to the parent directory (`".."`), `biome.json` can live strictly inside `frontend/` while honoring the root `.gitignore`: + +```json +{ + "$schema": "https://biomejs.dev/schemas/2.5.14/schema.json", + "vcs": { + "enabled": true, + "clientKind": "git", + "useIgnoreFile": true, + "root": ".." + }, + "files": { + "ignoreUnknown": true, + "includes": ["src/**", "vite.config.ts"] + }, + "formatter": { + "enabled": true, + "indentStyle": "space", + "indentWidth": 2, + "lineWidth": 90 + }, + "linter": { + "enabled": true, + "rules": { + "preset": "recommended" + } + } +} +``` + +--- + +## 3. Structural Comparison + +```text +Asymmetric Layout (Avoid) Symmetric Layout (Preferred) +---------------------------------- ---------------------------------- +repo/ repo/ +├── backend/ ├── backend/ +│ ├── app/ │ ├── app/ +│ └── pyproject.toml │ └── pyproject.toml +├── frontend/ ├── frontend/ +│ ├── src/ │ ├── src/ +│ └── package.json │ ├── biome.json <-- vcs.root = ".." +├── biome.json <-- Leaks out │ └── package.json +├── shell.nix ├── shell.nix +└── .gitignore └── .gitignore +``` + +### Operational Ergonomics +1. **Isolated Sub-Workspaces**: `frontend/` and `backend/` are both completely self-contained. Deleting, copying, or testing either layer requires no root cleanup. +2. **Seamless CI & DevShell**: From the repository root, commands can target the folder directly (`cd frontend && biome check .` or `nix-shell --run "cd frontend && npm run lint"`). +3. **Zero Ignore Duplication**: All ignore rules remain centralized in the root `.gitignore`.