Documentation

Lint rules

Lint rules

leadtype lint validates source MDX before generation. Run it in CI to fail PRs on schema and link issues before they reach a build. CLI flags are documented in the CLI reference — this page covers the rules, schemas, and library API.

Rules

Grouped by what they catch.

Frontmatter rules

RuleSeverityCatches
schemaerrorRequired field missing or wrong type.
unknown-fieldwarn (default)Top-level field not in the active schema.
parse-errorerrorYAML frontmatter or meta.json won't parse.

unknown-field upgrades to error with --error-unknown. Treat parse-error as the highest priority — it blocks every other check.

RuleSeverityCatches
invalid-linkerrorA /docs/... link points to a route that doesn't exist.
unresolved-placeholdererrorA docs URL still contains {framework} or similar.
cross-framework-linkerrorA framework-scoped page links to another framework's docs.

Linting renders MDX through the default remark stack before walking links — same flattening the converter performs, so link checks see the final URLs.

Library API

OptionDescription
srcDirRequired. Root of .md, .mdx, and meta.json files.
changelogDirSubdirectory under srcDir validated against the changelog schema.
ignoreGlob patterns relative to srcDir. Defaults shown below.
unknownFieldSeverity"warn" or "error" for fields outside the schema. Default: "warn".
schemas.frontmatterCustom Valibot schema for docs page frontmatter.
schemas.changelogFrontmatterCustom Valibot schema for changelog frontmatter.
schemas.metaCustom Valibot schema for meta.json.

Default ignore patterns: **/shared/**, **/_shared/**, **/_partials/**, **/node_modules/**.

Result shape

Required-field failures are reported as schema violations — that's the public rule for missing or invalid required fields.

Default schemas

Docs frontmatter

FieldRequiredType
titleYesnon-empty string
descriptionNostring
iconNostring
deprecatedNoboolean
deprecatedReasonNostring
experimentalNoboolean
canaryNoboolean
newNoboolean
draftNoboolean
tagsNostring array
groupNostring or string array
availableInNoarray of { framework, url?, title? }
fullNoboolean

lastModified and lastAuthor are produced by the converter when --enrich-git is set. Don't author them.

Changelog frontmatter

FieldRequiredType
titleYesnon-empty string
versionYesSemVer string
dateYesISO-8601 or parseable date
descriptionNostring
iconNostring
typeNorelease, improvement, retired, or deprecation
tagsNostring array
canaryNoboolean
authorsNostring or string array
draftNoboolean

meta.json

FieldRequiredType
pagesYesstring array
titleNonon-empty string
rootNoboolean
iconNostring
defaultOpenNoboolean
nav.sidebarNosection or combined
nav.labelNostring
nav.modeNostring

Custom schemas

Pass a Valibot schema to extend or replace the defaults:

Once you provide a custom schema, unknown-field warnings apply to that schema. Add --error-unknown in CI to keep your contract strict.

Practical guidance

  • Run lint before leadtype generate so content errors fail fast.
  • Use --format github in GitHub Actions and --format json in any other CI.
  • Treat unresolved-placeholder as a content bug first — usually a missing entry in availableIn or a stale URL template.
  • After a docs move, lint and run meta.json updates together; they drift at the same time.

For wiring lint into pipelines, see Validate in CI.