Skip to content

Commit

Permalink
render a list of rules
Browse files Browse the repository at this point in the history
  • Loading branch information
bartlomieju committed Dec 11, 2024
1 parent f4967ae commit b3a3c2c
Show file tree
Hide file tree
Showing 121 changed files with 36 additions and 3 deletions.
1 change: 1 addition & 0 deletions _config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ site.ignore(
(path) => path.match(/\/reference_gen.*.ts/) !== null,
(path) => path.includes("/reference_gen/node_modules"),
(path) => path.includes("/reference_gen/node_descriptions"),
(path) => path.includes("/lint_rules"),
"examples",
// "deploy",
// "examples.page.tsx",
Expand Down
1 change: 1 addition & 0 deletions deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
32 changes: 32 additions & 0 deletions runtime/_data.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Sidebar } from "../types.ts";
import { walk } from "jsr:@std/fs";
import { basename } from "jsr:@std/path";
import { parse as yamlParse } from "jsr:@std/yaml";

export const sidebar = [
Expand Down Expand Up @@ -389,3 +390,34 @@ export async function generateNodeCompatability() {
return content;
}).join("\n\n");
}

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));
let content = `<ul>`;
lintRules.forEach((rule) => {
content += `<li><b>${rule.name}</b></li>`;
});
content += `</ul>`;
return content;
}
5 changes: 2 additions & 3 deletions runtime/reference/cli/lint.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@ oldUrl:
- /runtime/manual/tools/linter/
- /runtime/reference/cli/linter/
command: lint
templateEngine: [vto, md]
---

## Available rules

For a complete list of supported rules, visit
[the deno_lint rule documentation](https://lint.deno.land).

This is some JSX:

{ 2 + 2 }
{{ await generateLintRuleList() }}

## Ignore directives

Expand Down

0 comments on commit b3a3c2c

Please sign in to comment.