Opinionated linting to keep your agent in check.
A compiler does not care that a function is named MyBadName, that an import is unused, or that a materialized type hides a private one. An agent learns the same way, from the error it gets, and there is no error to get. ziglint reads the AST that std.zig.Ast gives it and reports the 36 things the house style says are wrong, each with a note that says why.
It has no dependencies, runs on the Zig tree you point it at, and prints one line per finding: Z024: src/Linter.zig:31: line exceeds 120 bytes (252 bytes).
- Rules: what the 36 checks cover, and how
--onlyand--ignorepick one. The rule reference has the note for each. - Inline ignores:
// ziglint-ignore: Z001silences one rule on one line, so a deliberate exception costs one line of prose. - Reading a rule:
ziglint --explain Z024prints the note in the terminal, and--list-rulesprints every code and title.
Not implemented:
- An autofix. A finding names the line and the rule, and the edit is yours.
- Formatting.
zig fmtowns layout, and ziglint never runs it. - A rule over what a parse cannot see: a name built at comptime, a type that exists only after instantiation, or a generated file.
ziglint runs zig to find the standard library it lints against, so zig must be on PATH. --zig-lib-path points it at another lib directory.
With Homebrew, on macOS or Linux:
brew install --cask baskingspot/tap/ziglintWith mise:
mise use -g github:baskingspot/ziglintWith Nix:
nix run github:baskingspot/ziglint -- srcEach release has a tarball for linux-x64, linux-arm64, and macos-arm64, a zip for windows-x64, and a SHA256SUMS file. The archives are attested, so check a download with gh attestation verify FILE -R baskingspot/ziglint --signer-repo baskingspot/gh-actions.
From source:
zig build install -Doptimize=ReleaseFast --prefix $HOME/.local- The guide: install, run, configure, and what the rules cover.
- The rule reference: every rule with its note and its examples, generated from
src/docs/rules/. - The changelog: the notes from each release.
nix develop
just cinix develop provides the toolchain and the site tools. just lists the recipes, just ci runs what CI runs, just guide serves the guide with live reload, and just doc builds the whole site into zig-out/site/ziglint/. The rule and changelog pages are generated by zig build site.
MIT. See LICENSE. The logo files in docs/static/ are baskingspot marks and are not covered by it. See docs/static/LICENSE.
Built with LLM assistance. How, in detail.