Brain Structural Validation / Validate Markdown Structure & Links (push) Successful in 7s
3.3 KiB
3.3 KiB
type, status, topics
| type | status | topics | ||||
|---|---|---|---|---|---|---|
| knowledge | stable |
|
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, orpytestlocate their configuration strictly via directory traversal forpyproject.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, orbiome.json) at the repository root. When Biome has Git integration enabled (vcs: { enabled: true, useIgnoreFile: true }), placingbiome.jsoninsidefrontend/causes Biome to fail if executed from a subfolder without its own local.gitignore:internalError/fs: Biome couldn't find an ignore file - The Asymmetry: This often pushes developers to put
biome.jsonat the root, making the repository root asymmetric: Python is cleanly encapsulated inbackend/, 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:
{
"$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
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
- Isolated Sub-Workspaces:
frontend/andbackend/are both completely self-contained. Deleting, copying, or testing either layer requires no root cleanup. - Seamless CI & DevShell: From the repository root, commands can target the folder directly (
cd frontend && biome check .ornix-shell --run "cd frontend && npm run lint"). - Zero Ignore Duplication: All ignore rules remain centralized in the root
.gitignore.