ci(lint): exit with error when issues are found (#419)

This commit is contained in:
uncenter authored and GitHub committed 2023-12-28 02:38:10 +01:00
1 parent 2064cb869e
commit d520b24b53
2 files changed
+14 -9

No files matched your search

+4 -6
View File
@@ -10,10 +10,8 @@ import "npm:stylelint-config-recommended";
import { REPO_ROOT } from "@/deps.ts";
import { log } from "@/lint/logger.ts";
export const lint = async (entry: WalkEntry, content: string, fix: boolean) => {
const file = relative(REPO_ROOT, entry.path);
await stylelint.lint({ files: entry.path, fix })
export const lint = (entry: WalkEntry, content: string, fix: boolean) =>
stylelint.lint({ files: entry.path, fix })
.then(({ results }) => {
results.map((result) => {
result.warnings.map((warning) => {
@@ -24,7 +22,7 @@ export const lint = async (entry: WalkEntry, content: string, fix: boolean) => {
) ?? "unspecified stylelint error";
log(message, {
file,
file: relative(REPO_ROOT, entry.path),
startLine: warning.line,
endLine: warning.endLine,
startColumn: warning.column,
@@ -32,6 +30,6 @@ export const lint = async (entry: WalkEntry, content: string, fix: boolean) => {
content,
}, warning.severity);
});
if (result.warnings.length > 0) throw new Error("stylelint error");
});
});
};