File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change 11only_rules :
22 - accessibility_label_for_image
33 - accessibility_trait_for_button
4+ - a11y_swiftui_image_missing_label
5+ - a11y_button_missing_label
6+ - a11y_empty_text
47
58# Configure the rules
69accessibility_label_for_image :
710 severity : error
811
912accessibility_trait_for_button :
1013 severity : error
14+
15+ # Define your custom a11y rules
16+ custom_rules :
17+ a11y_swiftui_image_missing_label :
18+ name : " SwiftUI Image Missing Accessibility Label"
19+ regex : " \\ bImage\\ ((?!.*accessibilityLabel)(?!.*\\ .accessibilityElement\\ (children: \\ .combine\\ ))"
20+ message : " SwiftUI Image needs accessibilityLabel() or .accessibilityHidden(true), unless using .accessibilityElement(children: .combine)"
21+ severity : error
22+
23+ a11y_button_missing_label :
24+ name : " SwiftUI Button Missing Accessibility Label"
25+ regex : " Button\\ s*\\ {[^}]*\\ }\\ s*(?!.*accessibilityLabel)"
26+ message : " SwiftUI Button must have accessibilityLabel() or visible text."
27+ severity : error
28+
29+ a11y_empty_text :
30+ name : " Empty Text() is bad for accessibility"
31+ regex : " Text\\ ([\" ']{2}\\ )"
32+ message : " Empty Text() is not accessible — use hidden or provide a label."
33+ severity : error
You can’t perform that action at this time.
0 commit comments