📄 RuleDocsPage¶
📊 Analysis Summary¶
| Metric | Count |
|---|---|
| 🔧 Functions | 2 |
| 🧱 Classes | 1 |
| 📦 Imports | 4 |
| 📊 Variables & Constants | 1 |
| 📐 Interfaces | 1 |
| 📑 Type Aliases | 1 |
📚 Table of Contents¶
🛠️ File Location:¶
📂 packages/website/plugins/generated-rule-docs/RuleDocsPage.ts
📦 Imports¶
| Name | Source |
|---|---|
ESLintPluginRuleModule |
@typescript-eslint/eslint-plugin/use-at-your-own-risk/rules |
fromMarkdown |
mdast-util-from-markdown |
VFileWithStem |
../utils/rules |
findHeadingIndex |
../utils/rules |
Variables & Constants¶
| Name | Type | Kind | Value | Exported |
|---|---|---|---|---|
requiredHeadingNames |
readonly ["How to Use", "Options", "W... |
const | [ 'How to Use', 'Options', 'When Not To Use It', 'Related To', ] as const |
✓ |
Functions¶
RuleDocsPage.#recreateHeadingIndices(): RequiredHeadingIndices¶
Returns: RequiredHeadingIndices
Calls:
findHeadingIndex (from ../utils/rules)
Code
RuleDocsPage.spliceChildren(start: number, deleteCount: number, items: (string | unist.Node)[]): void¶
Parameters:
startnumberdeleteCountnumberitems(string | unist.Node)[]
Returns: void
Calls:
this.#children.spliceitems.mapfromMarkdown (from mdast-util-from-markdown)this.#recreateHeadingIndices
Code
Classes¶
RuleDocsPage¶
Class Code
export class RuleDocsPage {
#children: unist.Node[];
#file: Readonly<VFileWithStem>;
#headingIndices: RequiredHeadingIndices;
#rule: Readonly<ESLintPluginRuleModule>;
constructor(
children: unist.Node[],
file: Readonly<VFileWithStem>,
rule: Readonly<ESLintPluginRuleModule>,
) {
this.#children = children;
this.#file = file;
this.#headingIndices = this.#recreateHeadingIndices();
this.#rule = rule;
}
#recreateHeadingIndices(): RequiredHeadingIndices {
return {
howToUse: findHeadingIndex(this.#children, 2, requiredHeadingNames[0]),
options: findHeadingIndex(this.#children, 2, requiredHeadingNames[1]),
whenNotToUseIt: findHeadingIndex(
this.#children,
2,
requiredHeadingNames[2],
),
};
}
spliceChildren(
start: number,
deleteCount: number,
...items: (string | unist.Node)[]
): void {
this.#children.splice(
start,
deleteCount,
...items.map(item =>
typeof item === 'string' ? fromMarkdown(item) : item,
),
);
this.#headingIndices = this.#recreateHeadingIndices();
}
get children(): readonly unist.Node[] {
return this.#children;
}
get file(): Readonly<VFileWithStem> {
return this.#file;
}
get headingIndices(): Readonly<RequiredHeadingIndices> {
return this.#headingIndices;
}
get rule(): Readonly<ESLintPluginRuleModule> {
return this.#rule;
}
}
Methods (2) — full entries under Functions
| Method | Signature |
|---|---|
#recreateHeadingIndices |
(): RequiredHeadingIndices |
spliceChildren |
(start: number, deleteCount: number, items: (string \| unist.Node)[]): void |
Interfaces¶
RequiredHeadingIndices¶
Interface Code
Properties¶
| Name | Type | Optional | Description |
|---|---|---|---|
howToUse |
number |
✗ | not shown |
options |
number |
✗ | not shown |
whenNotToUseIt |
number |
✗ | not shown |
Type Aliases¶
HeadingName¶
Generated by Syntax Scribe