Appearance
Rules
The 9 smart-forms/ rules, and the blocks each one is built from. Each rule has its own page in the rules library, with what it checks, an example form and its lint cases.
Every rule works the same way. It reads the selected versions, finds the expressions a Smart Forms component actually reads, compares what that component does, from the facts, with what the form expects, from core's analysis, and reports where they differ. A rule never runs Smart Forms or evaluates an expression.
When it cannot tell, it stays silent. If core has no analysis for a site, for example because the text does not parse, the rule reports nothing there. It also leaves a problem to the core rule that reports the same cause; for example, a reference-only expression is sdc/external-expression's.
| Rule | Severity | Reports | Built from |
|---|---|---|---|
unsupported-expression-language | error | An expression Smart Forms ignores because of its language | Site eligibility, language facts |
expression-evaluated-as-fhirpath | error | An expression Smart Forms evaluates as FHIRPath, whatever its language | Site eligibility |
questionnaire-variable-unavailable | error | A reference to %questionnaire or %qitem, which Smart Forms does not supply | Site eligibility, name facts, core's references |
unsupported-query-embedding | error | A {{…}} embedding in an x-fhir-query that population does not fill as written | Site eligibility, embedding facts, sourceQueries and launchContext readers |
variable-name-collision | error | A name declared on two elements, or named like a sourceQueries result, which Smart Forms stores as one value | Population model, stored names, variable facts |
repeating-group-variable | warning | A variable on or below a repeating group whose value differs between repetitions, of which Smart Forms keeps one | Site eligibility, variable facts, core's uses |
named-expression-not-referenceable | error | A reference to a named expression Smart Forms does not make available, or a name an answerExpression cannot get | Site eligibility, Population model, stored names, prerequisites, launchContext reader |
forward-variable-reference | warning | A variable that references a variable or itemPopulationContext population evaluates after it | Site eligibility, Population model, core's dependencies |
unsupported-template-extract-context | error | A templateExtractContext written as a valueExpression, which template extraction ignores | Template reader, extraction facts. Runs only when template-extract is selected. |
Findings of plugin rules can be suppressed like any other, but a suppression is never judged stale just because the rule reported nothing: only built-in rules record where they completed a check. See Suppressions and fingerprints.
Schema
Code
In packages/plugin-smart-forms/src/rules/:
- one file per rule, named after it, such as
variable-name-collision.ts. Each hasmeta: its description, default severity and the documentationsdc-lint explainprints. language-sites.ts: which sites the rules that report at an expression check.
The lint cases are in test/cases/: a folder per rule, and source-queries for the supplied names. Adding a rule explains how to add one, and each slice of the design plan records why a rule works the way it does.