https://github.com/junaidrahim/yaml-config-lint
Lint multiline json config in yaml files
https://github.com/junaidrahim/yaml-config-lint
Last synced: 10 months ago
JSON representation
Lint multiline json config in yaml files
- Host: GitHub
- URL: https://github.com/junaidrahim/yaml-config-lint
- Owner: junaidrahim
- Created: 2021-12-11T16:24:10.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-04-18T08:51:01.000Z (about 4 years ago)
- Last Synced: 2025-04-15T12:18:29.541Z (about 1 year ago)
- Language: TypeScript
- Homepage:
- Size: 57.6 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# YAML Config Lint
Lint multiline json config in yaml files
## Installation

```bash
npm i -g yaml-config-lint
```
## Usage
```bash
Lint multiline data inside YAML files
USAGE
$ ycl
OPTIONS
-f, --files=files (required) Input File(s)
-h, --help show CLI help
-k, --keys=keys (required) Keys you want to validate
-v, --version show CLI version
```
- `-f` can be a file name or a glob pattern
- `-k` is the key in the yaml data whose content you want to lint, nested keys can be selected by using `.`
For Example
```yaml
// pokemon.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: game-demo
data:
pokemon: |
{
"ability": {
"name": "imposter",
"url": "https://pokeapi.co/api/v2/ability/150/"
},
"is_hidden": true,
"slot": 3
}
```
```sh
$ ycl -k data.pokemon -f pokemon.yaml
Running YAML Config Lint:
✅ jsonlint successful: pokemon.yaml
```
In case of incorrect JSON like this
```yaml
// pokemon.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: game-demo
data:
pokemon: |
{
"ability"
"name": "imposter",
"url": "https://pokeapi.co/api/v2/ability/150/"
},
"is_hidden": true,
"slot": 3
}
```
```sh
$ ycl -k data.pokemon pokemon.yaml
Running YAML Config Lint:
jsonlint error in: pokemon.yaml
Parse error on line 2:
{ "ability" "name": "imposter",
----------------^
Expecting 'EOF', '}', ':', ',', ']', got 'STRING'
```