lightdash lint command validates your Lightdash Code files (models, charts, dashboards) against JSON schemas. This helps you catch configuration errors before deploying changes.
Why use linting?
Linting is especially valuable when:- Developing with AI tools - AI copilots like Cursor, Claude Code, or Kilo Code can generate Lightdash YAML files, but may produce invalid configurations. Running
lightdash lintafter each change validates the output. - Working with dashboards as code - When editing chart or dashboard YAML files manually, linting catches typos and structural errors.
- CI/CD pipelines - Add linting to your deployment workflow to prevent invalid configurations from reaching production.
Basic usage
Validate all Lightdash Code files in the current directory:Output formats
CLI output (default)
The default output shows errors in a human-readable format with file paths and line numbers:Verbose output
Use--verbose to see all validated files, including those that passed:
SARIF JSON output
For CI/CD integration, use SARIF (Static Analysis Results Interchange Format) output:What gets validated
The lint command validates three types of files against their JSON schemas:| File type | Identified by | Schema |
|---|---|---|
| Models | type: model in YAML | model-as-code-1.0.json |
| Charts | metricQuery property | chart-as-code-1.0.json |
| Dashboards | tiles property | dashboard-as-code-1.0.json |
Using lint with AI coding tools
Recommended: Install Lightdash Skills first. Before manually configuring your AI tool, run
lightdash install-skills to install the Lightdash Skills. The skills already know to use lightdash lint for validation, so you don’t need to configure anything manually.lightdash lint to validate YAML files as part of its workflow. The skills include best practices for schema validation built-in.
Manual configuration (without skills)
If you’re not using Lightdash Skills, you can manually configure your AI copilot to use linting:-
Prompt the AI to run lint after changes - Add instructions like “Always run
lightdash lintafter making changes to validate the YAML.” -
Provide schema references - Give your AI tool the schema URLs so it understands the expected format:
- Models:
https://raw.githubusercontent.com/lightdash/lightdash/main/packages/common/src/schemas/json/model-as-code-1.0.json - Charts:
https://raw.githubusercontent.com/lightdash/lightdash/main/packages/common/src/schemas/json/chart-as-code-1.0.json - Dashboards:
https://raw.githubusercontent.com/lightdash/lightdash/main/packages/common/src/schemas/json/dashboard-as-code-1.0.json
- Models:
- Iterate on errors - When lint reports errors, have the AI fix them before proceeding.
CI/CD integration
Add linting to your CI/CD pipeline to prevent invalid configurations from being deployed.GitHub Actions example
Using SARIF with GitHub Code Scanning
To integrate lint results with GitHub’s code scanning:Common errors and fixes
Missing required properties
Invalid property type
Unknown properties
Related
- Lightdash YAML - Define your semantic layer in YAML without dbt
- Dashboards as code - Manage charts and dashboards as YAML files
- Lightdash CLI reference - Full command reference