Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on May 15, 2025. It is now read-only.

Commit 66472b0

Browse files
committed
chore: clean up lint file
1 parent cd010ba commit 66472b0

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

lint.ts

+11-4
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@ import grayMatter from "gray-matter";
55

66
const files = await readdir(".", { withFileTypes: true });
77
const dirs = files.filter(
8-
(f) => f.isDirectory() && !f.name.startsWith(".") && f.name !== "node_modules"
8+
(f) =>
9+
f.isDirectory() && !f.name.startsWith(".") && f.name !== "node_modules",
910
);
1011

1112
let badExit = false;
1213

1314
// error reports an error to the console and sets badExit to true
1415
// so that the process will exit with a non-zero exit code.
15-
const error = (...data: any[]) => {
16+
const error = (...data: unknown[]) => {
1617
console.error(...data);
1718
badExit = true;
1819
};
@@ -22,15 +23,20 @@ const verifyCodeBlocks = (
2223
res = {
2324
codeIsTF: false,
2425
codeIsHCL: false,
25-
}
26+
},
2627
) => {
2728
for (const token of tokens) {
2829
// Check in-depth.
2930
if (token.type === "list") {
3031
verifyCodeBlocks(token.items, res);
3132
continue;
3233
}
34+
3335
if (token.type === "list_item") {
36+
if (token.tokens === undefined) {
37+
throw new Error("Tokens are missing for type list_item");
38+
}
39+
3440
verifyCodeBlocks(token.tokens, res);
3541
continue;
3642
}
@@ -80,8 +86,9 @@ for (const dir of dirs) {
8086
if (!data.maintainer_github) {
8187
error(dir.name, "missing maintainer_github");
8288
}
89+
8390
try {
84-
await stat(path.join(".", dir.name, data.icon));
91+
await stat(path.join(".", dir.name, data.icon ?? ""));
8592
} catch (ex) {
8693
error(dir.name, "icon does not exist", data.icon);
8794
}

0 commit comments

Comments
 (0)