Lint SDK
The Lint SDK provides a language-agnostic linting framework for RBS. Register linters for any language — Black, ESLint, Prettier, Ruff, Biome, or your own custom linter — and run them as part of your build pipeline. Linting failures cause builds to exit with code 1, making the SDK ideal for CI/CD enforcement.
Linters are not pre-installed. RBS downloads and manages them as external dependencies, following the hermetic build principle. No system-level tool installation required.
Quick start
Python projects
Node.js / TypeScript projects
CI/CD integration
The Lint SDK causes builds to exit 1 when linting fails, making it a natural fit for CI pipelines:
Pre-defined lint rules
Python: py_lint
Runs Black and isort on Python files:
Node.js: nodejs_lint
Runs Prettier (and optionally ESLint) on JavaScript/TypeScript files:
Pre-defined linters
Python linters
Registered via register_python_linters():
| Linter | Purpose | Check mode | Fix mode |
|---|
| Black | Code formatter | --check --diff | Formats in-place |
| isort | Import sorter | --check-only --diff | Sorts in-place |
| flake8 | Style checker | --show-source --statistics | No auto-fix |
| Ruff | Fast linter | check --show-source | check --fix |
Node.js / TypeScript linters
Registered via register_nodejs_linters():
| Linter | Purpose | Check mode | Fix mode |
|---|
| Prettier | Code formatter | --check | --write |
| ESLint | JavaScript/TypeScript linter | --format stylish | --fix |
| tsc | TypeScript type checker | --noEmit --pretty | No auto-fix |
| Biome | Fast all-in-one linter | check --diagnostic-level=warn | check --apply |
Defining custom linters
Register any linter without modifying the build system — just define it in your configuration:
Configuration options
| Option | Type | Description |
|---|
name | string | Unique identifier for the linter. |
language | string | Target language (e.g., "python", "nodejs", "go"). |
executable | string | Linter binary path, name, or protocol reference (see below). |
check_args | list | Arguments for lint checking mode. |
fix_args | list | Arguments for auto-fix mode. |
file_patterns | list | Glob patterns for files to lint (default: ["*"]). |
exclude_patterns | list | Glob patterns for files to exclude. |
config_file | string | Optional path to a linter configuration file. |
environment | dict | Environment variables to set when running the linter. |
success_exit_codes | list | Exit codes that indicate success (default: [0]). |
Reference linter binaries from managed external dependencies using the protocol format:
Examples:
@python://black:24.1.1:black — Python’s Black formatter
@nodejs://prettier:3.2.0:prettier — Prettier
@nodejs://typescript:5.3.3:tsc — TypeScript compiler
RBS automatically locates the binary in the managed dependency cache, resolving the correct platform and version.
ctx.lint API reference
The ctx.lint module is available inside any rule implementation.
ctx.lint.run()
Run a linter in check mode:
ctx.lint.fix()
Run a linter in auto-fix mode:
ctx.lint.run_all()
Run all registered linters for a language:
ctx.lint.fix_all()
Run all linters for a language in fix mode:
ctx.lint.list()
List all registered linters:
ctx.lint.get_linter()
Get a specific linter’s configuration:
Complete examples
Django project
TypeScript project
Adding support for a new ecosystem
The SDK-first design means you can add linter support for any language without modifying the build system:
Troubleshooting
Linter not found
If you see “executable file not found”:
- Check that the external dependency is declared in
WORKSPACE.rbs.
- Verify the linter is registered with
register_*_linters().
- Confirm the package was downloaded (check
.rbs/external-deps/).
Wrong files being linted
Use glob() with exclude patterns to skip generated files and dependencies: