Skip to main content

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():

Node.js / TypeScript linters

Registered via register_nodejs_linters():

Defining custom linters

Register any linter without modifying the build system — just define it in your configuration:

Configuration options

Executable protocol format

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”:
  1. Check that the external dependency is declared in WORKSPACE.rbs.
  2. Verify the linter is registered with register_*_linters().
  3. Confirm the package was downloaded (check .rbs/external-deps/).

Wrong files being linted

Use glob() with exclude patterns to skip generated files and dependencies: