Skip to content

Commit

Permalink
Merge pull request #843 from Automattic/rules-page-improvements
Browse files Browse the repository at this point in the history
Rules page improvements
  • Loading branch information
elijah-potter authored Mar 7, 2025
2 parents 2d41b25 + 36ea05b commit 18eb9b1
Showing 1 changed file with 31 additions and 8 deletions.
39 changes: 31 additions & 8 deletions packages/web/src/routes/docs/rules/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,23 +1,46 @@
<script module lang="ts">
import { LocalLinter } from 'harper.js';
import { LocalLinter, type LintConfig } from 'harper.js';
import {
Table,
TableBody,
TableBodyCell,
TableBodyRow,
TableHead,
TableHeadCell
} from 'flowbite-svelte';
export const prerender = true;
export const frontmatter = {
title: 'Rules'
};
let info: Record<string, string> = $state({});
let descriptions: Record<string, string> = $state({});
let default_config: LintConfig = $state({});
let linter = new LocalLinter();
linter.getLintDescriptions().then(async (v) => {
info = v;
console.log(v);
descriptions = v;
});
linter.getDefaultLintConfig().then(async (v) => {
default_config = v;
});
</script>

<p>This page is an incomplete list of the various grammatical rules Harper checks for.</p>

{#each Object.entries(info) as [name, description]}
<h2>{name}</h2>
<p>{description}</p>
{/each}
<Table>
<TableHead>
<TableHeadCell>Name</TableHeadCell>
<TableHeadCell>Enabled by Default</TableHeadCell>
<TableHeadCell>Description</TableHeadCell>
</TableHead>
<TableBody>
{#each Object.entries(descriptions) as [name, description]}
<TableBodyRow>
<TableBodyCell>{name}</TableBodyCell>
<TableBodyCell>{default_config[name] ? '✔️' : ''}</TableBodyCell>
<TableBodyCell tdClass="px-6 py-4 font-medium">{description}</TableBodyCell>
</TableBodyRow>
{/each}
</TableBody>
</Table>

0 comments on commit 18eb9b1

Please sign in to comment.