Auto fix capabilities for multiple high value rules Accessibility Rules #167
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements comprehensive auto-fix functionality across multiple FluentUI accessibility rules, enabling developers to automatically resolve common accessibility issues with eslint --fix. The enhancement significantly improves developer experience while teaching proper accessibility patterns.
🚀 Key Features
Enhanced Rule Factory with Auto-Fix Support
4 Auto-fix Strategies:
aria-label-placeholder: Adds aria-label="" for developer completion
aria-label-suggestion: Provides contextual label suggestions
add-required-prop: Adds missing required properties with defaults
custom: Supports complex custom fix logic
Backward Compatible: Existing rules continue working unchanged
Type Safe: Full TypeScript support with proper type definitions
Rules Enhanced with Auto-Fix
InfoLabel → Adds aria-label="Info"
MenuButton → Adds aria-label="Open menu"
Card → Adds aria-label="Card"
Image → Adds alt="" placeholder
Spinner → Adds complete ARIA live region pattern:
ProgressBar → Adds full ARIA progressbar pattern:
Auto-fix all accessibility issues
npx eslint --fix src/
Fix specific files
npx eslint --fix src/components/InfoLabel.tsx