An opinionated linter for the Zig programming language.
Warning
This project is still under construction. It is usable and useful, but many features have not been implemented yet.
- 🔍 Custom Analysis. ZLint has its own semantic analyzer, heavily inspired by the Oxc project, that is completely separate from the Zig compiler. This means that ZLint still checks and understands code that may otherwise be ignored by Zig due to dead code elimination.
- ⚡️ Fast. Designed from the ground-up to be highly performant, ZLint typically takes a few hundred milliseconds to lint large projects.
- 💡 Understandable. Error messages are pretty, detailed, and easy to understand. Most rules come with explanations on how to fix them and what exactly is wrong.
Pre-built binaries for Windows, MacOS, and Linux on x64 and aarch64 are available for each release.
curl -fsSL https://raw.githubusercontent.com/DonIsaac/zlint/refs/heads/main/tasks/install.sh | bash
Warning
- Pre-built binaries are not available for Alpine Linux (or any other MUSL-based distro). Please build from source.
- This installation script does not work on Windows. Please download the binary manually.
Clone this repo and compile the project with Zig.
zig build --release=safe
All lints and what they do can be found here.
Create a zlint.json
file in the same directory as build.zig
. This disables
all default rules, only enabling the ones you choose.
{
"rules": {
"no-undefined": "error",
"homeless-try": "warn"
}
}
ZLint also supports ESLint-like disable directives to turn off some or all rules for a specific file.
// zlint-disable no-undefined -- We need to come back and fix this later
const x: i32 = undefined;
If you have any rule ideas, please add them to the rule ideas board.
Interested in contributing code? Check out the contributing guide.