Skip to content

Commit

Permalink
add a separate page
Browse files Browse the repository at this point in the history
  • Loading branch information
bartlomieju committed Dec 11, 2024
1 parent 097d201 commit c93b7d2
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
33 changes: 33 additions & 0 deletions lint/_data.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { walk } from "jsr:@std/fs";
import { basename } from "jsr:@std/path";

export const sidebar = [];
export const sectionTitle = "Lint rules";
export const sectionHref = "/lint/";

interface LintRuleDescription {
name: string;
mdContent: string;
}
export async function generateLintRuleList() {
const lintRules: LintRuleDescription[] = [];

for await (
const dirEntry of walk(
new URL(import.meta.resolve("../lint_rules/")),
{ exts: ["md"] },
)
) {
const snakeCaselintRuleName = basename(dirEntry.path).split(".")[0];
const lintRuleName = snakeCaselintRuleName.replaceAll("_", "-");
const mdContent = await Deno.readTextFile(dirEntry.path);
lintRules.push({
name: lintRuleName,
mdContent,
});
}

lintRules.sort((a, b) => a.name.localeCompare(b.name));

return lintRules;
}
12 changes: 12 additions & 0 deletions lint/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
title: Deno linter rules
templateEngine: [vto, md]
---

{{ for lintRule of await generateLintRuleList() }}

## {{ lintRule.name }}

{{ lintRule.mdContent }}

{{ /for }}

0 comments on commit c93b7d2

Please sign in to comment.