Skip to main content

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.

tip

zlint.json does not yet support comments or trailing commas yet.

zlint.json
{
"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.

zlint.json
{
"rules": {
"unsafe-undefined": ["error", { "allowed_types": ["PathBuf"] }]
}
}

Skipping Files​

To skip linting specific files or groups of files, use the ignore field.

zlint.json
{
"ignore": ["src/bad.zig", "src/subfolder/**"],
"rules": {
"unsafe-undefined": "error"
}
}
tip

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.

zlint.json
{
"$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.

warning

When copying the below snippet, make sure you swap in the version of ZLint you are using!

zlint.json
{
"$schema": "https://raw.githubusercontent.com/DonIsaac/zlint/refs/tags/v0.7.7/zlint.schema.json",
"rules": {
"unsafe-undefined": "error",
"homeless-try": "warn"
}
}