MCPcopy Index your code
hub / github.com/SchemaStore/schemastore / taskLint

Function taskLint

cli.js:628–670  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

626}
627
628async function taskLint() {
629 const /** @type {{count: number, file: string}[]} */ entries = []
630
631 await forEachFile({
632 actionName: 'lint',
633 async onSchemaFile(schema) {
634 // This checks to be sure $id is a schemastore.org URL.
635 // Commenting out because it is overly aggressive for now.
636 // await assertSchemaHasCorrectMetadata(schema)
637 await assertTopLevelRefIsStandalone(schema)
638 // await assertSchemaNoSmartQuotes(schema)
639
640 try {
641 const errors = schemasafe.lint(schema.json, {
642 // mode: 'strong',
643 requireSchema: true,
644 requireValidation: true,
645 requireStringValidation: false,
646 complexityChecks: true,
647 forbidNoopValues: true,
648
649 extraFormats: false,
650 schemas: {},
651 })
652 for (const err of errors) {
653 console.log(`${schema.name}: ${err.message}`)
654 }
655 entries.push({
656 count: errors.length,
657 file: schema.name,
658 })
659 } catch (err) {
660 console.log(err)
661 return
662 }
663 },
664 })
665
666 entries.sort((a, b) => a.count - b.count)
667 for (const entry of entries) {
668 console.info(`${entry.count}: ${entry.file}`)
669 }
670}
671
672async function taskCheck() {
673 console.info(`===== VALIDATE PRECONDITIONS =====`)

Callers

nothing calls this directly

Calls 1

forEachFileFunction · 0.85

Tested by

no test coverage detected