YAML Config Lint

raw JSON →
1.0.1 verified Fri May 01 auth: no javascript

This package (v1.0.1) is a CLI tool for linting multiline JSON configuration embedded inside YAML files. It allows you to specify YAML keys containing JSON strings and validates them using jsonlint. The tool is built with oclif and requires Node.js >=12.0.0. It ships TypeScript type declarations. There is no known release cadence; the project appears to be a single-version release. Key differentiators include simple CLI usage with glob support for files and dot-notation for nested keys, making it easy to validate inline JSON in Kubernetes ConfigMaps or similar YAML structures.

error Parse error on line 2: {...}
cause Invalid JSON inside the YAML value.
fix
Fix the JSON syntax in the YAML file (e.g., missing commas, brackets).
error '-k' is required
cause Missing the --keys option when running the CLI.
fix
Add -k <key> to the command, e.g., -k data.pokemon
error Cannot find module 'yaml-config-lint'
cause Package not installed or CommonJS require used incorrectly.
fix
Install the package and use ESM import, or run via npx.
breaking The package may have breaking changes in future versions; current version is 1.0.1 with no changelog.
fix Pin version in package.json if using programmatic API.
gotcha The CLI requires both -f and -k flags; missing one will cause a usage error.
fix Always provide both --files and --keys options.
gotcha The package only validates JSON inside YAML, not the YAML structure itself.
fix Use a separate YAML linter (e.g., yamllint) for YAML syntax validation.
deprecated Node.js 12 is EOL; the engine requirement may cause issues on newer Node versions.
fix Use Node.js 14 or newer, but verify compatibility.
npm install yaml-config-lint
yarn add yaml-config-lint
pnpm add yaml-config-lint

Shows basic usage: create a YAML file with a JSON string under a nested key, then run the CLI to validate it.

// Create a sample YAML file with embedded JSON
echo 'data:
  pokemon: |
    {
      "ability": {
        "name": "imposter",
        "url": "https://pokeapi.co/api/v2/ability/150/"
      },
      "is_hidden": true,
      "slot": 3
    }' > sample.yaml

// Run the linter
npx yaml-config-lint -f sample.yaml -k data.pokemon