Skip to content

Commit

Permalink
Use .ruleset prop in RulesTable
Browse files Browse the repository at this point in the history
  • Loading branch information
hasparus committed Mar 14, 2023
1 parent 0eb7299 commit 642031f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions packages/eslint-plugin/docs/rules/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ See [Configs](/linting/configs) for how to enable recommended rules using config

import RulesTable from "@site/src/components/RulesTable";

<RulesTable />
<RulesTable ruleset="supported-rules" />

## Extension Rules

In some cases, ESLint provides a rule itself, but it doesn't support TypeScript syntax; either it crashes, or it ignores the syntax, or it falsely reports against it.
In these cases, we create what we call an extension rule; a rule within our plugin that has the same functionality, but also supports TypeScript.

<RulesTable extensionRules />
<RulesTable ruleset="extension-rules" />
9 changes: 4 additions & 5 deletions packages/website/src/components/RulesTable/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,15 +119,14 @@ function match(mode: FilterMode, value: boolean): boolean | undefined {
}

export default function RulesTable({
extensionRules,
ruleset,
}: {
extensionRules?: boolean;
ruleset: 'extension-rules' | 'supported-rules';
}): JSX.Element {
const [filters, changeFilter] = useRulesFilters(
extensionRules ? 'extension-rules' : 'supported-rules',
);
const [filters, changeFilter] = useRulesFilters(ruleset);

const rules = useRulesMeta();
const extensionRules = ruleset === 'extension-rules';
const relevantRules = useMemo(
() =>
rules
Expand Down

0 comments on commit 642031f

Please sign in to comment.