Skip to content

Commit

Permalink
run prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreasMadsen committed Jan 12, 2024
1 parent c47f250 commit 617ecbe
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 18 deletions.
23 changes: 10 additions & 13 deletions github-action/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,17 @@ async function run() {
for (const result of results) {
for (const error of result.error) {
const { diag, hover } = error;
const hoverMessage = (hover && MarkupContent.is(hover.contents)) ? `\n\n${marked(hover.contents.value)}` : ''
const hoverMessage =
hover && MarkupContent.is(hover.contents) ? `\n\n${marked(hover.contents.value)}` : '';


core.error(
diag.message + hoverMessage,
{
title: `${diag.message}${diag.source ? ' ' + diag.source + '.' : ''}`,
file: result.filePath,
startLine: diag.range.start.line + 1,
endLine: diag.range.end.line + 1,
startColumn: diag.range.start.character,
endColumn: diag.range.end.character,
},
);
core.error(diag.message + hoverMessage, {
title: `${diag.message}${diag.source ? ' ' + diag.source + '.' : ''}`,
file: result.filePath,
startLine: diag.range.start.line + 1,
endLine: diag.range.end.line + 1,
startColumn: diag.range.start.character,
endColumn: diag.range.end.character,
});
}
}

Expand Down
12 changes: 7 additions & 5 deletions src/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ interface FileValidationResult {
error: {
diag: Diagnostic;
hover: Hover | null;
}[]
}[];
}

/**
Expand Down Expand Up @@ -122,7 +122,7 @@ export async function getValidationResults(files: string[], settings?: Settings)
disableAdditionalProperties: false,
customTags: [],
});
const yamlHover = new YAMLHover(schemaService, telemetry)
const yamlHover = new YAMLHover(schemaService, telemetry);

return await Promise.all(
files.map(async (relativePath: string) => {
Expand All @@ -135,8 +135,8 @@ export async function getValidationResults(files: string[], settings?: Settings)
filePath,
error: diagnostics.map((diagnostics, index) => ({
diag: diagnostics,
hover: hovers[index]
}))
hover: hovers[index],
})),
};
}),
).then((rs) => rs.filter((r) => r.error.length > 0));
Expand All @@ -163,7 +163,9 @@ async function validateAndOutput(files: string[], settings: Settings) {
const { diag, hover } = error;
const sourceMessage = diag.source ? ` ${diag.source}` : '';
console.error(
`${result.filePath}:${diag.range.start.line + 1}:${diag.range.start.character + 1}: ${diag.message}${sourceMessage}`,
`${result.filePath}:${diag.range.start.line + 1}:${diag.range.start.character + 1}: ${
diag.message
}${sourceMessage}`,
);
}
}
Expand Down

0 comments on commit 617ecbe

Please sign in to comment.