UNPKG

sicua

Version:

A tool for analyzing project structure and dependencies

80 lines (79 loc) 2.91 kB
/** * Individual validator functions for accessibility rules * Updated to use enhanced text extraction and context analysis */ import { JSXElementInfo, AccessibilityViolation } from "../types/accessibilityTypes"; export declare class RuleValidators { /** * Images must have alt text - WCAG 1.1.1 (Level A) */ static validateImageAlt(element: JSXElementInfo): AccessibilityViolation | null; /** * Form inputs must have labels - WCAG 1.3.1 (Level A) */ static validateInputLabel(element: JSXElementInfo, allElements?: JSXElementInfo[]): AccessibilityViolation | null; /** * Buttons must have accessible text - WCAG 4.1.2 (Level A) */ static validateButtonText(element: JSXElementInfo): AccessibilityViolation | null; /** * Check if button is icon-only (has only decorative children) */ private static isIconOnlyButton; /** * Links must have accessible text - WCAG 4.1.2 (Level A) */ static validateLinkText(element: JSXElementInfo): AccessibilityViolation | null; /** * Validate ARIA roles are valid - WCAG 4.1.2 (Level A) */ static validateAriaRole(element: JSXElementInfo): AccessibilityViolation | null; /** * Helper method to create invalid role error */ private static createInvalidRoleError; /** * Check if a role expression is obviously invalid */ private static isObviouslyInvalidRole; /** * Interactive elements should not have onClick without proper role */ static validateInteractiveRole(element: JSXElementInfo): AccessibilityViolation | null; /** * Form elements should have proper labels or fieldsets */ static validateFormStructure(element: JSXElementInfo): AccessibilityViolation | null; /** * Heading hierarchy should be logical */ static validateHeadingHierarchy(elements: JSXElementInfo[]): AccessibilityViolation[]; /** * Check for missing lang attribute on html element */ static validateLangAttribute(element: JSXElementInfo): AccessibilityViolation | null; /** * Check if an expression likely contains a valid locale value */ private static isLikelyLocaleExpression; /** * Validate language code format */ private static isValidLanguageCode; /** * Check for duplicate IDs within component */ static validateUniqueIds(elements: JSXElementInfo[]): AccessibilityViolation[]; /** * Check ARIA attributes have valid values */ static validateAriaAttributes(element: JSXElementInfo): AccessibilityViolation | null; /** * Check if an expression is likely a valid boolean expression for ARIA attributes */ private static isLikelyValidBooleanExpression; /** * Check if an expression is obviously invalid for ARIA attributes */ private static isObviouslyInvalidAriaValue; }