Directives
UpdatedA comment that starts with --@alloy- steers the diagnostics of one file: the compiler's, the lints, and the checker's type errors, which the language server drops on the silenced lines before the editor sees them. The editor lists the directives after --, --@, or --!, and on an empty line. alloy doc alloy-ignore explains one.
--@alloy-nocheck this file: nothing is reported --@alloy-ignore the solver misreads this the next line with code is silent local x = y.z --@alloy-ignore at the end of a line: that line --@alloy-expect-error a negative count the next line must hold an error --@alloy-ignore-start raw_require every line under here, up to the end --@alloy-ignore-end closes it --@alloy-lint raw_require=allow this lint's level, for this file --@alloy-preserve `alloy flux --fix` leaves the next line
Text after --@alloy-ignore and --@alloy-expect-error is the reason. An expectation with no reason draws the missing_reason lint, and the reason comes back in the error the directive draws when its line goes clean, so a stale one is easy to place.
Use ignore for a line the new solver gets wrong. Use expect-error where the error is the point, a test of a lint or a contract: it silences the line, and reports when the line comes clean, so a fix that makes the directive stale shows. Luau's own --!strict, --!nonstrict, and --!nocheck pass through and set the checker's mode for the file.
--@alloy-lint, --@alloy-ignore-start, and --@alloy-ignore-end sit on a line of their own. --@alloy-ignore, --@alloy-expect-error, and --@alloy-preserve sit on their own line or at the end of a line with code.
A directive the compiler cannot accept is a DirectiveError on its own line: a name no directive has, a lint or a level --@alloy-lint does not know, an --@alloy-ignore-start with no end, and an --@alloy-ignore-end that closes nothing.
Every diagnostic carries the book section it belongs to as its code, Alloy(4.2); the number links to the section in the editor, and alloy doc 4.2 prints it.
A directive or `@allow`. The attribute @allow(lint) quiets a named lint over the declaration or the statement it sits on, and it moves with that code when the code moves. Use it when one lint is wrong about one item. Use a directive when the thing to quiet is not an item or not a lint: one line the checker misreads, a run of statements inside a body, a level for the whole file, or a generated file. alloy doc @allow has the details.
--@alloy-ignore does, and is an error itself when that line comes clean.--@alloy-nocheckSilences every diagnostic in the file, on any line: the compiler's, the lints, and the checker's.--@alloy-lintSets a lint's level for one file, over the [lint] table of alloy.toml.--@alloy-preserveKeeps alloy flux --fix and the editor's quick fix off one line.