Configuration
Create a zlint.json file in the same directory as build.zig. When left
unconfigured, rules use the default behavior described in the
Rules section.
zlint.json does not yet support comments or trailing commas yet.
{
"rules": {
"unsafe-undefined": "error",
"homeless-try": "warn",
"unused-decls": "off"
}
}
Configuring Rules
Some rules accept configuration options. To pass them, provide an [level, config] tuple.
{
"rules": {
"unsafe-undefined": ["error", { "allowed_types": ["PathBuf"] }]
}
}
Skipping Files
To skip linting specific files or groups of files, use the ignore field.
{
"ignore": ["src/bad.zig", "src/subfolder/**"],
"rules": {
"unsafe-undefined": "error"
}
}
See Ignoring Files for more details, including on how to disable specific rules for a single file.
Intellisense
If you don't use ZLint's VSCode Extension, you can get intellisense by linking directly to our JSON Schema.
{
"$schema": "https://raw.githubusercontent.com/DonIsaac/zlint/refs/heads/main/zlint.schema.json",
"rules": {
"unsafe-undefined": "error",
"homeless-try": "warn"
}
}
Instead of using the schema directly from main, you can lock it to the specific version you use.
When copying the below snippet, make sure you swap in the version of ZLint you are using!
{
"$schema": "https://raw.githubusercontent.com/DonIsaac/zlint/refs/tags/v0.7.7/zlint.schema.json",
"rules": {
"unsafe-undefined": "error",
"homeless-try": "warn"
}
}