Proposing a toolchain for polyglot monorepo
I need to suggest a comprehensive toolchain for a polyglot monorepo involving shared configurations, styles, and linters for consistency. I could propose tools like EditorConfig, Prettier, ESLint, and others, considering options like Bazel or Nx. It might be useful to ask the user for clarification since they seemed vague. I can provide a generic blueprint with repository-level config files, recommended patterns, and mention tools for Python, JavaScript, and more. Keeping it concise is essential!Creating an actionable blueprint
I want to create a practical blueprint using tools like "pre-commit," "lefthook," and "just" for managing a polyglot codebase. Pre-commit can handle various languages, and I should suggest tools like "pint" for PHP, "ktlint" for Kotlin, and "swiftformat" for Swift. It’s important to include a central config directory with symlinks for packages. Standardizing on shared configs for ESLint, Stylelint, and type configurations can really help. My final recommended toolchain would cover version management, common formatting, language-specific tools, and commit hooks.Drafting consistency checks and documentation
I’m considering all the consistency checks needed, like license headers, forbidden patterns, dead links, and tools for spellcheck and markdown linting. I also want to cover dependencies and security with tools like Dependabot or Renovate and incorporate documentation linting. Since the user is looking for a plan for a polyglot repository toolchain with shared configurations and consistency checks, I should provide a crisp template in markdown format. Including an example justfile and a sample configuration snippet will be helpful!
Below is a practical “polyglot monorepo hygiene” toolchain that scales well across languages while keeping one place for shared rules, consistent local/CI behavior, and fast feedback.
1) Repo-wide foundations (language-agnostic)
Tool/version pinning (so everyone runs the same things)
Pick one:
- mise (
mise.toml) or asdf (.tool-versions) for Node/Python/Go/Rust/etc.
- Or Nix / devcontainer if you want fully reproducible environments.
Minimum:
- Pin Node, Python, Go, Rust versions (as applicable)
- Pin formatter/linter versions (via package managers + lockfiles)
Editor + EOL consistency
.editorconfig (tabs/spaces, final newline, charset)
.gitattributes (normalize line endings, treat binaries correctly)
Unified formatting for “non-code” files
- Prettier for:
md, yaml, json, toml (optional), graphql, etc.
- Add:
.prettierrc + .prettierignore
Git hooks and a single entrypoint
- pre-commit (works across languages and runs the same locally + in CI)
- A repo task runner: just, Taskfile, or make to standardize commands
Recommended convention:
just fmt, just lint, just test, just ci
2) Shared config strategy (avoid duplication)
Use a central folder:
/config
/eslint
/prettier
/ruff
/mypy
/golangci
/rustfmt
/markdownlint
Then extend from packages/services:
- JS/TS:
extends: ["../../config/eslint/base.js"]
- Python:
pyproject.toml references shared settings (or copy minimal + keep shared in config/ruff/ruff.toml)
- Go:
golangci-lint supports --config pointing to config/golangci/.golangci.yml
If you have many JS packages, strongly consider publishing internal shared configs:
@org/eslint-config
@org/tsconfig
@org/prettier-config
This reduces drift.
3) Language-specific formatting + linting (modern, fast picks)
JavaScript/TypeScript
- Prettier (format)
- ESLint (lint) + typescript-eslint
- Optional: Stylelint (CSS)
Shared rules:
- Strict unused vars, import ordering, no floating promises, etc.
Python
- Ruff for lint + import sort + (optionally) formatting
- Mypy for type checking (if typed codebase)
This combination is fast and reduces tool count (vs black/isort/flake8).
Go
- gofmt + goimports
- golangci-lint (aggregates many linters)
Rust
Shell
- shellcheck (lint)
- shfmt (format)
4) Consistency checks (high leverage in polyglot repos)
These catch “repo drift” that language linters won’t:
- cspell (spellcheck for docs/code identifiers)
- markdownlint (docs style)
- yamllint (YAML hygiene)
- actionlint (GitHub Actions workflow correctness)
- license header check (if required)
- dead link checker (docs)
- secret scanning: gitleaks (local + CI)
- security/deps: Renovate/Dependabot + OSV scanner (or Trivy)
5) Pre-commit as the unifier (example)
/.pre-commit-config.yaml (sketch):
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-merge-conflict
- id: check-yaml
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v4.0.0-alpha.8
hooks:
- id: prettier
files: \.(md|yaml|yml|json)$
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.9
hooks:
- id: ruff
- id: ruff-format
- repo: https://github.com/golangci/golangci-lint
rev: v1.60.3
hooks:
- id: golangci-lint
- repo: https://github.com/pre-commit/mirrors-eslint
rev: v9.9.1
hooks:
- id: eslint
- repo: https://github.com/zricethezav/gitleaks
rev: v8.21.2
hooks:
- id: gitleaks
Run the same in CI:
pre-commit run --all-files
6) CI layout (keep it consistent and fast)
- One “lint” job that runs
pre-commit --all-files
- Optional per-language test jobs (matrix by subproject path)
- Cache package managers (npm/pnpm, pip, go build cache, cargo)
Key idea: local = CI. The same commands should pass in both.
7) Minimal “golden” repo files to add
At repo root:
.editorconfig
.gitattributes
.pre-commit-config.yaml
.prettierrc + .prettierignore
justfile (or Taskfile.yml)
config/** (shared tool configs)
CODEOWNERS (optional but helpful)
renovate.json (or dependabot config)
If you tell me which languages you’re actually using (e.g., TS + Python + Go, plus Terraform? Java?), I can propose a concrete file tree and exact configs (ESLint flat config vs legacy, Ruff rules, golangci-lint set, etc.) tuned for that mix.