-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
097d201
commit c93b7d2
Showing
2 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |