1
0
mirror of https://github.com/simple-icons/simple-icons.git synced 2024-11-16 00:59:07 +02:00
simple-icons/scripts/lint/jsonlint.js
2024-03-24 18:38:18 +01:00

22 lines
636 B
JavaScript
Executable File

#!/usr/bin/env node
/**
* @fileoverview
* CLI tool to run jsonschema on the simple-icons.json data file.
*/
import process from 'node:process';
import {Validator} from 'jsonschema';
import {getIconsData} from '../../sdk.mjs';
import {getJsonSchemaData} from '../utils.js';
const icons = await getIconsData();
const schema = await getJsonSchemaData();
const validator = new Validator();
const result = validator.validate({icons}, schema);
if (result.errors.length > 0) {
for (const error of result.errors) console.error(error);
console.error(`Found ${result.errors.length} error(s) in simple-icons.json`);
process.exit(1);
}