Skip to content

chant lint

llms.txt lists every page for an agent
chant lint [path] [flags]

chant lint loads the project at the given path, runs all configured lint rules, and reports diagnostics. Each diagnostic includes a rule ID (e.g. COR010, EVL001) alongside the file location and message.

FlagTypeDefaultDescription
--formatstringstylishOutput format: stylish, json, or sarif
--fixboolfalseAuto-fix fixable issues
-w, --watchboolfalseWatch for file changes and re-lint
--root-onlyboolfalseAt the root of a declared workspace, lint the root project alone instead of refusing. See At a workspace root
--sandboxboolfalseRun any project source the lint has to execute in one isolated child process rather than in the chant process. The same boundary as chant build --sandbox; composes with --watch
Terminal window
# Lint current directory
chant lint
# JSON output for CI
chant lint --format json
# SARIF for GitHub Code Scanning
chant lint --format sarif > results.sarif
# Auto-fix
chant lint --fix
# Watch mode
chant lint --watch
# Keep project source out of the chant process
chant lint --sandbox

Each lexicon the project loads can ship post-synth checks, which read the built output rather than the source (SQLCH101 for a ClickHouse engine the pinned server does not have, for example). chant lint builds the lint path in memory, as chant build would, without writing anything, then runs every loaded lexicon’s post-synth checks over the result. Their findings are reported with the source rules, under the check’s own ID. lint.rules changes their severity or turns them off, and lint.presets applies as it does in chant build. A post-synth finding has no source line, so it is reported at 1:1 in the file that declared the resource it names, or at the config file when it names none.

When the lint path does not build, each build error is reported as a LEX002 error and the post-synth checks are skipped. Like LEX001, LEX002 is not a rule and cannot be turned off. A project whose lexicons ship no post-synth checks is not built at all.

A lexicon the project declares in chant.config.* but that cannot be resolved is reported as a LEX001 error against the config file, with the same message chant build gives for the same project. The lint exits 1, and the diagnostic appears in --format json and --format sarif like any other. This covers a lexicon package that is not installed and a chant.config.ts that fails to load, so a CI job that lints before it builds cannot report green on a project the build refuses.

LEX001 is not a rule, so it has no severity setting and no chant-disable form. What it reports is that the lint could not assemble the rule set the project asked for.

A project that declares and imports no lexicon lints under the core rules alone.

At the root of a declared workspace, chant lint refuses with the code WSP000 and exits 1, as chant build does. The members have left the root project, and chant workspace lint lints each of them with its own chant. With --root-only, or rootOnly: true in the root’s chant.config.ts, the root project is linted on its own. Member directories and example-group matches are then left out of it. Linting inside a member is never refused.

CodeMeaning
0No errors found
1Lint errors found, including a lexicon post-synth error, a declared lexicon that could not be resolved, a lint path that does not build (LEX002), or WSP000 at a workspace root

chant