Skip to content

Linting & Type-Checking

chant includes a built-in linter that validates your resource files. Run it with:

Terminal window
chant lint

A clean project produces no output. Errors and warnings are printed to stderr:

src/data-bucket.ts:5:3 error [EVL001] expression in property "name" is not statically evaluable
src/api.ts:12:1 error [EVL002] resource declaration must not be inside an if statement

Lint runs two layers in one pass:

  1. Evaluability rules (EVL) — ensures all resource property expressions can be statically evaluated. See Evaluability Rules.
  2. Correctness & style rules (COR) — structural constraints like missing exports, circular dependencies, naming conventions. See Correctness Rules.

Additionally, chant build runs post-synth checks against the serialized output (YAML, JSON, etc.). These lexicon-specific rules catch issues that only manifest in the generated output — for example, security misconfigurations, missing health probes, or invalid container commands. See your lexicon’s lint rules documentation for the full list.

FlagFormat
(default)Styled terminal output
--format jsonJSON array of diagnostics
--format sarifSARIF 2.1.0 for CI integrations
Terminal window
chant lint --format json

Re-run lint automatically on file changes:

Terminal window
chant lint --watch

Rules are configured in chant.config.ts. See Rule Configuration.