Skip to content

Commit

Permalink
refactor: consistent failed var names
Browse files Browse the repository at this point in the history
  • Loading branch information
uncenter committed Dec 27, 2023
1 parent bb01400 commit 044a96f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions scripts/lint/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const stylesheets = walk(join(REPO_ROOT, "styles", subDir), {
match: [/\.user.css$/],
});

let errored;
let failed;

for await (const entry of stylesheets) {
const repodir = dirname(entry.path);
Expand All @@ -37,7 +37,7 @@ for await (const entry of stylesheets) {
// try to compile the less file, report any errors
less.render(content, { lint: true, globalVars }).then().catch(
(err) => {
errored = true;
failed = true;
log(
err.message,
{ file, startLine: err.line, endLine: err.line, content },
Expand All @@ -48,15 +48,15 @@ for await (const entry of stylesheets) {

// advanced linting with stylelint
if (await lint(entry, content, flags.fix) === false) {
errored = true;
failed = true;
}
}

// if any files are missing, cause the workflow to fail
if (await checkForMissingFiles() === false) {
errored = true;
failed = true;
}

if (errored) {
if (failed) {
Deno.exit(1);
}
6 changes: 3 additions & 3 deletions scripts/lint/stylelint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ import { log } from "@/lint/logger.ts";
export const lint = async (entry: WalkEntry, content: string, fix: boolean) => {
const file = relative(REPO_ROOT, entry.path);

let success = true;
let failed = false;

await stylelint.lint({ files: entry.path, fix })
.then(({ results }) => {
results.map((result) => {
if (result.warnings.length > 0) {
success = false;
failed = true;
}

result.warnings.map((warning) => {
Expand All @@ -41,5 +41,5 @@ export const lint = async (entry: WalkEntry, content: string, fix: boolean) => {
});
});

return success;
return !failed;
};

0 comments on commit 044a96f

Please sign in to comment.