Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async (
text: string,
{ checkConfig }: { checkConfig: LintJson },
editor: any
): Promise> => {
const codeMirrorDoc = editor.getDoc();
const docs = yaml.parseAllDocuments(text);
if (docs.length === 0) {
return [];
}
// Assumption
const doc = docs[0];
const lints: Array = [];
doc.errors.forEach(error => {
lints.push({
message: error.message,
severity: "error",
type: "syntax",
from: codeMirrorDoc.posFromIndex(
error.source.range ? error.source.range.start : 0
) as any,
to: codeMirrorDoc.posFromIndex(
error.source.range ? error.source.range.end : Number.MAX_SAFE_INTEGER