Files
suaveplan/packages/devtools/tooling/linter/README.md
2026-05-27 23:29:53 +01:00

87 lines
5.2 KiB
Markdown

# @suaveplan/linter - Unified markdown + biome linting pipeline: remark-based markdown fixer (MD012/022/025/029/031/032/035/036/040/044), injectable CommandRunner-backed biome wrapper, glob resolver, orchestrator with structured LintReport, pure runCli, LINTER_CODES error registry, and OTel self-telemetry.
Unified markdown + biome linting pipeline for Suaveplan: a remark-based
markdown fixer covering MD012/022/025/029/031/032/035/036/040/044, an injectable
`CommandRunner`-backed biome wrapper, a deterministic glob resolver, an orchestrator
that returns a structured `LintReport`, a pure `runCli`, the `LINTER_CODES` error
registry, and OpenTelemetry self-telemetry. The package is server-tier (Node ≥ 20),
ships zero `@suaveplan/*` runtime deps other than `@suaveplan/error` and
`@suaveplan/types`, and is fully tree-shakeable via per-feature subpath exports.
<!-- begin:auto-docs -->
## Documentation tree
- [biome-runner](./src/biome-runner/biome-runner.md) — `@suaveplan/linter/biome-runner` is the seam between the linter and the Biome CLI. Rather than calling `execSync` from…
- [biome-runner](./src/biome-runner/biome-runner.md) — `@suaveplan/linter/biome-runner` is the seam between the linter and the Biome CLI. Rather than calling `execSync` from…
- [cli](./src/cli/cli.md) — `@suaveplan/linter/cli` is the pure-function CLI entry point. It parses an `argv` array, runs the unified orchestrator,…
- [cli](./src/cli/cli.md) — `@suaveplan/linter/cli` is the pure-function CLI entry point. It parses an `argv` array, runs the unified orchestrator,…
- [error-codes](./src/error-codes/error-codes.md) — `@suaveplan/linter/error-codes` owns the stable error-code registry and the typed `LinterError` class that every other…
- [error-codes](./src/error-codes/error-codes.md) — `@suaveplan/linter/error-codes` owns the stable error-code registry and the typed `LinterError` class that every other…
- [glob-resolver](./src/glob-resolver/glob-resolver.md) — `@suaveplan/linter/glob-resolver` expands a list of patterns (glob expressions or file paths) into a sorted, deduplicat…
- [glob-resolver](./src/glob-resolver/glob-resolver.md) — `@suaveplan/linter/glob-resolver` expands a list of patterns (glob expressions or file paths) into a sorted, deduplicat…
- [markdown-fixer](./src/markdown-fixer/markdown-fixer.md) — `@suaveplan/linter/markdown-fixer` is the remark-based markdown auto-fixer at the core of the package. It applies a cur…
- [markdown-fixer](./src/markdown-fixer/markdown-fixer.md) — `@suaveplan/linter/markdown-fixer` is the remark-based markdown auto-fixer at the core of the package. It applies a cur…
- [rules](./src/markdown-fixer/rules.md) — `rules.ts` houses the individual remark plugins that implement each markdown-lint rule the fixer enforces, plus the sha…
- [telemetry](./src/telemetry/telemetry.md) — `@suaveplan/linter/telemetry` exposes the OpenTelemetry instruments and the record helpers every other module uses to e…
- [telemetry](./src/telemetry/telemetry.md) — `@suaveplan/linter/telemetry` exposes the OpenTelemetry instruments and the record helpers every other module uses to e…
- [unified-lint](./src/unified-lint/unified-lint.md) — `@suaveplan/linter/unified-lint` is the orchestrator that composes the biome runner and the markdown fixer into a singl…
- [unified-lint](./src/unified-lint/unified-lint.md) — `@suaveplan/linter/unified-lint` is the orchestrator that composes the biome runner and the markdown fixer into a singl…
- [bin](./src/bin.md) — `bin.ts` is the executable entry point installed by `package.json` as the `suaveplan-lint` binary. It is intentionally…
<!-- end:auto-docs -->
## Install
```bash
bun add @suaveplan/linter
```
## Quick start
```ts
import { runUnifiedLint } from "@suaveplan/linter";
const report = await runUnifiedLint({ fix: false });
if (!report.success) {
process.exitCode = 1;
}
```
Or run the bundled binary:
```bash
bunx suaveplan-lint --fix
bunx suaveplan-lint --markdown-only "docs/*.md"
```
## Modules
- [`error-codes`](./src/error-codes/error-codes.md) — stable
`LINTER_CODES` registry and `LinterError` class.
- [`telemetry`](./src/telemetry/telemetry.md) — four OTel
instruments and helper functions.
- [`markdown-fixer`](./src/markdown-fixer/markdown-fixer.md) — remark
pipeline + processor.
- [`markdown-fixer/rules`](./src/markdown-fixer/rules.md) — individual
remark rule plugins (re-exported through the markdown-fixer subpath).
- [`biome-runner`](./src/biome-runner/biome-runner.md) — injectable
Biome subprocess wrapper.
- [`glob-resolver`](./src/glob-resolver/glob-resolver.md) — pattern
expansion with default ignore list.
- [`unified-lint`](./src/unified-lint/unified-lint.md) — orchestrator
returning a `LintReport`.
- [`cli`](./src/cli/cli.md) — pure `runCli(argv, opts?)`.
## Subpath exports
Every feature is exposed as its own subpath so consumers tree-shake at the feature
boundary:
```ts
import { fixMarkdown } from "@suaveplan/linter/markdown-fixer";
import { runBiome } from "@suaveplan/linter/biome-runner";
import { LINTER_CODES } from "@suaveplan/linter/error-codes";
```
The root `@suaveplan/linter` import re-exports the public surface of every feature.