Overview
@diagnostic controls warnings for one line, the next line, or a block of code. Suppress false positives without disabling diagnostics for your entire addon.
Syntax
disable-next-line
Suppress diagnostics on the next line only:disable-line
Suppress diagnostics on the current line. Place it inline:Block disable/enable
Disable diagnostics for a section, then enable them again:File-wide disable
A---@diagnostic disable with no matching enable suppresses diagnostics for the rest of the file:
Multiple codes
Suppress multiple diagnostics at once:Common codes to suppress
| Code | When to suppress |
|---|---|
undefined-global | Global used that’s defined externally (e.g., from another file loaded at runtime) |
param-type-mismatch | Passing a compatible type that differs from the annotation, or a known false positive |
unused | Variable used as documentation or placeholder |
inject-field | Adding fields to a type outside its definition intentionally |
Alternative: configure globally
If you suppress the same diagnostic often, disable it or change its severity in.gluarc.json:
.gluarc.json