Workflow
Linting
Featurevisor provides a CLI command to lint your definition files, making sure they are all valid and won't cause any issues when you build your datafiles.
Usage#
Run:
$ npx featurevisor lintAnd it will show you the errors in your definition files, if any.
If any errors are found, it will terminate with a non-zero exit code.
CLI options#
keyPattern#
You can also filter keys using regex patterns:
$ npx featurevisor lint --keyPattern="myKeyHere"entityType#
If you want to filter it down further by entity type:
$ npx featurevisor lint --keyPattern="myKeyHere" --entityType="feature"Possible values for --entityType:
attributesegmentfeaturegrouptest
json#
If you want machine-readable lint output, pass --json:
$ npx featurevisor lint --jsonThe output format is always an object with an errors array:
{ "errors": [ { "filePath": "segments/my-segment.yml", "entityType": "segment", "key": "my-segment", "message": "Required", "path": ["conditions", 0, "attribute"], "code": "invalid_type" } ]}If no lint errors are found, output is:
{ "errors": []}To pretty-print JSON output:
$ npx featurevisor lint --json --prettyThe --pretty flag is only applied when --json is passed.
In JSON mode, lint still exits with non-zero status when errors are found, and exits with 0 when no errors are found.
NPM scripts#
If you are using npm scripts for linting your Featurevisor project like this:
{ "scripts": { "lint": "featurevisor lint" }}You can then pass your options in CLI after --:
$ npm run lint -- --keyPattern="myKeyHere"
