Crate formspec_lint

Crate formspec_lint 

Source
Expand description

Formspec Linter — 8-pass static analysis and validation pipeline.

Pass 1 (E100): Document type detection Pass 1b (E101): JSON Schema validation against embedded schemas Pass 2 (E200/E201): Tree indexing, duplicate key/path detection Pass 3 (E300/E301/E302/W300): Reference validation — bind paths, shape targets, optionSets Pass 3b (E600/E601/E602): Extension resolution against registry documents Pass 4 (E400): FEL expression compilation Pass 5 (E500): Dependency cycle detection Pass 6 (W700-W711/E710): Theme — token validation, reference integrity, page semantics Pass 7 (E800-E807/W800-W804): Components — tree validation, type compatibility, bind resolution

§Documentation

  • Human overview: crate README.md (pass map, options, module layout).
  • API reference: cargo doc -p formspec-lint --no-deps --open.
  • Markdown API export: docs/rustdoc-md/API.md (see README; regenerate with npm run docs:formspec-lint).

Modules§

component_matrix
Component/dataType compatibility matrix for the 12 built-in input components.
dependencies
Pass 5: Dependency analysis — builds a dependency graph from compiled expressions and detects cycles via DFS.
expressions
Pass 4: Expression compilation — parses all FEL expression slots in a definition, producing CompiledExpression structs for downstream dependency analysis (pass 5) and E400 diagnostics for parse errors.
extensions
Pass 3b: Extension validation (E600/E601/E602).
pass_component
Pass 7: Component document semantic checks (E800-E807, W800-W804).
pass_theme
Pass 6: Theme document semantic checks (W700-W711, E710).
references
Pass 3: Reference validation — checks bind paths and shape targets resolve against the item tree.
tree
Pass 2: Tree indexing — flattens the item tree into a lookup index.

Structs§

LintDiagnostic
A lint diagnostic.
LintOptions
Options for the lint pipeline.
LintResult
Result of linting.

Enums§

LintMode
Controls which diagnostics are emitted.
LintSeverity
Severity of a lint diagnostic (sorting, validity, and JSON wire values).

Functions§

lint
Run the full lint pipeline on a Formspec document with default options.
lint_result_to_json_value
Serialize a LintResult for host bindings.
lint_with_options
Run the full lint pipeline with explicit options.
sort_diagnostics
Sort diagnostics: pass ASC, severity (error > warning > info), path ASC.