Registry / devops / yaml-schema-lint

yaml-schema-lint

JSON →
library1.1.1jsnpmunverified

A CLI tool to lint YAML files against JSON schemas using the yaml-language-server programmatic API. It validates syntax and schema compliance, loading schemas from a VS Code-style settings file and automatically from schemastore.org. Version 1.1.1 is current, with a release cadence of occasional updates. Key differentiators include: uses the same schema resolution logic as VS Code, supports custom tags, caching of Schema Store catalog, and multiple output formats (GitLab CodeQuality, JSON). Requires Node.js >=20.

devopsserializationtesting
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

CLI tool primarily used from command line, but this is the programmatic API entry point.

import { lint } from 'yaml-schema-lint'

TypeScript type-only import for options interface.

import type { YamlSchemaLintOptions } from 'yaml-schema-lint'

ESM default export available since v1.0.0.

import yamlSchemaLint from 'yaml-schema-lint'

Shows both CLI usage and programmatic API with all options.

// Install globally or locally // npm install --global yaml-schema-lint // Command line usage: // yaml-schema-lint '**/*.yml' --settings-path .vscode/settings.json // Programmatic usage (ESM): import { lint } from 'yaml-schema-lint'; const results = await lint({ patterns: ['**/*.yml'], settingsPath: '.vscode/settings.json', noSchemaStore: false, cacheDir: '.cache/yaml-schema-lint', cacheTTL: 86400, format: 'gitlab-codequality', ignore: '**/node_modules/**', failOnWarnings: true, failOnNoFiles: true, debug: false, }); console.log(results); // Returns an object with { diagnostics, summary }
yaml-schema-lint --version
Debug
Known footguns
breakingv1.0.0 changed default behavior to fail on warnings (exits with non-zero when warnings are found).
gotchaGlob patterns must be quoted to prevent shell expansion (e.g., '**/*.yml' not **/*.yml).
deprecatedThe --github-annotations option was removed in v0.2.0-beta.2.
gotchaSchema Store catalog caching uses default TTL of 24h; stale schemas may cause false positives/negatives.
gotchaIf no files match the pattern, the tool exits with an error by default (since v1.0.0).
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
10 hits · last 30 days
gptbot
3
ahrefsbot
3
claudebot
3
bingbot
1
Resources