Workflow
Linting
Linting checks authoring files before you build or deploy datafiles.
Run lint#
Command
$ npx messagevisor lint$ npx messagevisor lint --set=staging$ npx messagevisor lint --json --prettyWhat lint checks#
Entity schema validity#
- required properties are present
- types match (string, boolean, integer, etc.)
- unknown properties are flagged
Attribute and condition validity#
- condition
attributekeys reference defined attribute files - operators are valid for the attribute type
- values are compatible with the attribute type and any other additional constraints
segments/plan-pro.yml
conditions: - attribute: plan # must exist in attributes/plan.yml operator: equals value: pro # must be in plan's enum if enum is definedLocale format preset shape#
- format presets are valid for their format family
dateStyleandtimeStyleare not combined with granular component fields in the same preset- currency codes are plausible ISO 4217 values
Message override structure#
- override
keyvalues are unique within a message - referenced segment keys exist
- condition shapes are valid
Test definitions#
- message test
messagekeys resolve to real message files - segment test
segmentkeys resolve to real segment files - locale test
localekeys resolve to real locale files - target test
targetkeys resolve to real target files
ICU format references (when ICU module is active)#
- named format references in ICU syntax (e.g.
{amount, number, money}) resolve to actual presets in the active locale's formats
Lint in CI#
Lint is designed to be fast and informative. Running it before build in CI catches authoring mistakes early and produces machine-readable output for integration with other tools:
Command
$ npx messagevisor lintLint vs test#
lintvalidates structure and cross-referencestestvalidates runtime behavior
Lint does not evaluate messages. A project can pass lint but have failing tests if authored translations or format presets produce unexpected runtime results.
With sets#
When sets: true, lint runs across all sets by default.
To focus on one set:
Command
$ npx messagevisor lint --set=staging
