You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+202Lines changed: 202 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,6 +16,9 @@ or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any addi
16
16
## Table of Contents
17
17
18
18
[Dev Environment](#dev-environment)
19
+
[Rule Factory System](#rule-factory-system)
20
+
[Creating New Rules](#creating-new-rules)
21
+
[Utility Functions](#utility-functions)
19
22
[Pull requests](#pull-requests)
20
23
21
24
## Dev Environment
@@ -61,6 +64,205 @@ To ensure a consistent and productive development environment, install the follo
61
64
- [Prettier ESLint](https://marketplace.visualstudio.com/items?itemName=rvest.vs-code-prettier-eslint) — Format code with Prettier and ESLint integration.
62
65
- [markdownlint](https://marketplace.visualstudio.com/items?itemName=DavidAnson.vscode-markdownlint) — Linting and style checks for Markdown files.
63
66
67
+
## Rule Factory System
68
+
69
+
This plugin uses a powerful rule factory system that provides consistent behavior across accessibility rules. The factory system is built around the `ruleFactory`functionin`lib/util/ruleFactory.ts` and several utility functions for validating accessible labeling.
70
+
71
+
### Core Concept
72
+
73
+
The rule factory centralizes common accessibility validation patterns, making it easy to create new rules with consistent behavior. Instead of implementing validation logic from scratch, rules can leverage the factory's built-in utilities.
Copy file name to clipboardExpand all lines: README.md
+63Lines changed: 63 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -90,6 +90,69 @@ This plugin does a static code analysis of the React JSX to spot accessibility i
90
90
91
91
As the plugin can only catch errors in static source code, please use it in combination with [@axe-core/react](https://github.com/dequelabs/axe-core-npm/tree/develop/packages/react) to test the accessibility of the rendered DOM. Consider these tools just as one step of a larger a11y testing process and always test your apps with assistive technology.
92
92
93
+
## Architecture & Development
94
+
95
+
### Rule Factory System
96
+
97
+
This plugin leverages a powerful rule factory system that provides consistent behavior across accessibility rules. The factory system includes several utility functions for validating accessible labeling:
The utility performs source code analysis to validate that `aria-labelledby` references point to actual elements with matching IDs, ensuring robust accessibility validation.
134
+
135
+
### Creating New Rules
136
+
137
+
To create a new accessibility rule, use the rule factory system:
138
+
139
+
```typescript
140
+
import { ruleFactory, LabeledControlConfig } from '../util/ruleFactory';
0 commit comments