Quick Start
Get up and running with FSH Lint in just a few minutes.
Prerequisites
Section titled “Prerequisites”- Rust 1.80 or later (if building from source)
- OR use pre-built binaries
Step 1: Install FSH Lint
Section titled “Step 1: Install FSH Lint”cargo install fsh-lint
Verify the installation:
fsh-lint --version
Step 2: Initialize Configuration
Section titled “Step 2: Initialize Configuration”Create a default configuration file in your FSH project:
cd your-fsh-projectfsh-lint init
This creates fsh-lint.json
with recommended settings:
{ "$schema": "https://octofhir.github.io/fsh-lint-rs/schema/v1.json", "root": true, "linter": { "enabled": true, "rules": { "recommended": true } }}
Step 3: Lint Your Files
Section titled “Step 3: Lint Your Files”Lint all FSH files in the current directory:
fsh-lint lint **/*.fsh
Or lint specific files:
fsh-lint lint input/fsh/profiles.fsh
Step 4: Review Diagnostics
Section titled “Step 4: Review Diagnostics”FSH Lint will show you any issues found:
error[correctness/duplicate-definition]: Duplicate profile definition
> 15 │ Profile: PatientProfile │ ^^^^^^^^^^^^^^ Profile 'PatientProfile' is already defined 16 │ * name 1..1 MS
i First defined at line 8
Step 5: Auto-fix Issues
Section titled “Step 5: Auto-fix Issues”Many issues can be fixed automatically:
fsh-lint lint --fix **/*.fsh
FSH Lint will apply safe fixes and report what was changed.
Step 6: Customize Rules
Section titled “Step 6: Customize Rules”Edit fsh-lint.json
to customize rule behavior:
{ "linter": { "rules": { "recommended": true, "style": { "naming-convention": "error" // Upgrade to error }, "documentation": { "title-required": "off" // Disable this rule } } }}
Next Steps
Section titled “Next Steps”- Configure rules to match your project’s needs
- Learn about built-in rules to understand what FSH Lint checks
- Write custom rules for project-specific validation
- Integrate with CI/CD to automate linting
Common Commands
Section titled “Common Commands”# Lint with automatic fixesfsh-lint lint --fix **/*.fsh
# Lint and show only errorsfsh-lint lint --severity error **/*.fsh
# List all available rulesfsh-lint rules
# Get detailed information about a specific rulefsh-lint rules --detailed style/naming-convention
# Format FSH filesfsh-lint format **/*.fsh
# Format with automatic fixesfsh-lint format --fix **/*.fsh
Help and Support
Section titled “Help and Support”- Run
fsh-lint --help
for command-line help - Run
fsh-lint <command> --help
for command-specific help - Check the Troubleshooting Guide for common issues