driftdetect-detectors 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/accessibility/alt-text.d.ts +63 -0
- package/dist/accessibility/alt-text.d.ts.map +1 -0
- package/dist/accessibility/alt-text.js +100 -0
- package/dist/accessibility/alt-text.js.map +1 -0
- package/dist/accessibility/aria-roles.d.ts +65 -0
- package/dist/accessibility/aria-roles.d.ts.map +1 -0
- package/dist/accessibility/aria-roles.js +87 -0
- package/dist/accessibility/aria-roles.js.map +1 -0
- package/dist/accessibility/focus-management.d.ts +62 -0
- package/dist/accessibility/focus-management.d.ts.map +1 -0
- package/dist/accessibility/focus-management.js +88 -0
- package/dist/accessibility/focus-management.js.map +1 -0
- package/dist/accessibility/heading-hierarchy.d.ts +66 -0
- package/dist/accessibility/heading-hierarchy.d.ts.map +1 -0
- package/dist/accessibility/heading-hierarchy.js +94 -0
- package/dist/accessibility/heading-hierarchy.js.map +1 -0
- package/dist/accessibility/index.d.ts +25 -0
- package/dist/accessibility/index.d.ts.map +1 -0
- package/dist/accessibility/index.js +21 -0
- package/dist/accessibility/index.js.map +1 -0
- package/dist/accessibility/keyboard-nav.d.ts +63 -0
- package/dist/accessibility/keyboard-nav.d.ts.map +1 -0
- package/dist/accessibility/keyboard-nav.js +86 -0
- package/dist/accessibility/keyboard-nav.js.map +1 -0
- package/dist/accessibility/semantic-html.d.ts +76 -0
- package/dist/accessibility/semantic-html.d.ts.map +1 -0
- package/dist/accessibility/semantic-html.js +204 -0
- package/dist/accessibility/semantic-html.js.map +1 -0
- package/dist/api/client-patterns.d.ts +121 -0
- package/dist/api/client-patterns.d.ts.map +1 -0
- package/dist/api/client-patterns.js +478 -0
- package/dist/api/client-patterns.js.map +1 -0
- package/dist/api/error-format.d.ts +140 -0
- package/dist/api/error-format.d.ts.map +1 -0
- package/dist/api/error-format.js +614 -0
- package/dist/api/error-format.js.map +1 -0
- package/dist/api/http-methods.d.ts +255 -0
- package/dist/api/http-methods.d.ts.map +1 -0
- package/dist/api/http-methods.js +890 -0
- package/dist/api/http-methods.js.map +1 -0
- package/dist/api/index.d.ts +16 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +37 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/pagination.d.ts +133 -0
- package/dist/api/pagination.d.ts.map +1 -0
- package/dist/api/pagination.js +521 -0
- package/dist/api/pagination.js.map +1 -0
- package/dist/api/response-envelope.d.ts +261 -0
- package/dist/api/response-envelope.d.ts.map +1 -0
- package/dist/api/response-envelope.js +1050 -0
- package/dist/api/response-envelope.js.map +1 -0
- package/dist/api/retry-patterns.d.ts +117 -0
- package/dist/api/retry-patterns.d.ts.map +1 -0
- package/dist/api/retry-patterns.js +480 -0
- package/dist/api/retry-patterns.js.map +1 -0
- package/dist/api/route-structure.d.ts +128 -0
- package/dist/api/route-structure.d.ts.map +1 -0
- package/dist/api/route-structure.js +738 -0
- package/dist/api/route-structure.js.map +1 -0
- package/dist/auth/audit-logging.d.ts +80 -0
- package/dist/auth/audit-logging.d.ts.map +1 -0
- package/dist/auth/audit-logging.js +370 -0
- package/dist/auth/audit-logging.js.map +1 -0
- package/dist/auth/index.d.ts +33 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +49 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/middleware-usage.d.ts +65 -0
- package/dist/auth/middleware-usage.d.ts.map +1 -0
- package/dist/auth/middleware-usage.js +192 -0
- package/dist/auth/middleware-usage.js.map +1 -0
- package/dist/auth/permission-checks.d.ts +60 -0
- package/dist/auth/permission-checks.d.ts.map +1 -0
- package/dist/auth/permission-checks.js +159 -0
- package/dist/auth/permission-checks.js.map +1 -0
- package/dist/auth/rbac-patterns.d.ts +68 -0
- package/dist/auth/rbac-patterns.d.ts.map +1 -0
- package/dist/auth/rbac-patterns.js +143 -0
- package/dist/auth/rbac-patterns.js.map +1 -0
- package/dist/auth/resource-ownership.d.ts +77 -0
- package/dist/auth/resource-ownership.d.ts.map +1 -0
- package/dist/auth/resource-ownership.js +324 -0
- package/dist/auth/resource-ownership.js.map +1 -0
- package/dist/auth/token-handling.d.ts +64 -0
- package/dist/auth/token-handling.d.ts.map +1 -0
- package/dist/auth/token-handling.js +151 -0
- package/dist/auth/token-handling.js.map +1 -0
- package/dist/base/ast-detector.d.ts +421 -0
- package/dist/base/ast-detector.d.ts.map +1 -0
- package/dist/base/ast-detector.js +699 -0
- package/dist/base/ast-detector.js.map +1 -0
- package/dist/base/base-detector.d.ts +366 -0
- package/dist/base/base-detector.d.ts.map +1 -0
- package/dist/base/base-detector.js +170 -0
- package/dist/base/base-detector.js.map +1 -0
- package/dist/base/index.d.ts +12 -0
- package/dist/base/index.d.ts.map +1 -0
- package/dist/base/index.js +17 -0
- package/dist/base/index.js.map +1 -0
- package/dist/base/regex-detector.d.ts +421 -0
- package/dist/base/regex-detector.d.ts.map +1 -0
- package/dist/base/regex-detector.js +537 -0
- package/dist/base/regex-detector.js.map +1 -0
- package/dist/base/structural-detector.d.ts +424 -0
- package/dist/base/structural-detector.d.ts.map +1 -0
- package/dist/base/structural-detector.js +731 -0
- package/dist/base/structural-detector.js.map +1 -0
- package/dist/base/types.d.ts +53 -0
- package/dist/base/types.d.ts.map +1 -0
- package/dist/base/types.js +5 -0
- package/dist/base/types.js.map +1 -0
- package/dist/components/component-structure.d.ts +163 -0
- package/dist/components/component-structure.d.ts.map +1 -0
- package/dist/components/component-structure.js +500 -0
- package/dist/components/component-structure.js.map +1 -0
- package/dist/components/composition.d.ts +287 -0
- package/dist/components/composition.d.ts.map +1 -0
- package/dist/components/composition.js +1123 -0
- package/dist/components/composition.js.map +1 -0
- package/dist/components/duplicate-detection.d.ts +251 -0
- package/dist/components/duplicate-detection.d.ts.map +1 -0
- package/dist/components/duplicate-detection.js +804 -0
- package/dist/components/duplicate-detection.js.map +1 -0
- package/dist/components/index.d.ts +16 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +51 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/near-duplicate.d.ts +402 -0
- package/dist/components/near-duplicate.d.ts.map +1 -0
- package/dist/components/near-duplicate.js +1090 -0
- package/dist/components/near-duplicate.js.map +1 -0
- package/dist/components/props-patterns.d.ts +194 -0
- package/dist/components/props-patterns.d.ts.map +1 -0
- package/dist/components/props-patterns.js +795 -0
- package/dist/components/props-patterns.js.map +1 -0
- package/dist/components/ref-forwarding.d.ts +250 -0
- package/dist/components/ref-forwarding.d.ts.map +1 -0
- package/dist/components/ref-forwarding.js +832 -0
- package/dist/components/ref-forwarding.js.map +1 -0
- package/dist/components/state-patterns.d.ts +291 -0
- package/dist/components/state-patterns.d.ts.map +1 -0
- package/dist/components/state-patterns.js +970 -0
- package/dist/components/state-patterns.js.map +1 -0
- package/dist/config/config-validation.d.ts +74 -0
- package/dist/config/config-validation.d.ts.map +1 -0
- package/dist/config/config-validation.js +446 -0
- package/dist/config/config-validation.js.map +1 -0
- package/dist/config/default-values.d.ts +72 -0
- package/dist/config/default-values.d.ts.map +1 -0
- package/dist/config/default-values.js +386 -0
- package/dist/config/default-values.js.map +1 -0
- package/dist/config/env-naming.d.ts +73 -0
- package/dist/config/env-naming.d.ts.map +1 -0
- package/dist/config/env-naming.js +429 -0
- package/dist/config/env-naming.js.map +1 -0
- package/dist/config/environment-detection.d.ts +72 -0
- package/dist/config/environment-detection.d.ts.map +1 -0
- package/dist/config/environment-detection.js +400 -0
- package/dist/config/environment-detection.js.map +1 -0
- package/dist/config/feature-flags.d.ts +72 -0
- package/dist/config/feature-flags.d.ts.map +1 -0
- package/dist/config/feature-flags.js +384 -0
- package/dist/config/feature-flags.js.map +1 -0
- package/dist/config/index.d.ts +27 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +43 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/required-optional.d.ts +71 -0
- package/dist/config/required-optional.d.ts.map +1 -0
- package/dist/config/required-optional.js +344 -0
- package/dist/config/required-optional.js.map +1 -0
- package/dist/data-access/connection-pooling.d.ts +63 -0
- package/dist/data-access/connection-pooling.d.ts.map +1 -0
- package/dist/data-access/connection-pooling.js +297 -0
- package/dist/data-access/connection-pooling.js.map +1 -0
- package/dist/data-access/dto-patterns.d.ts +64 -0
- package/dist/data-access/dto-patterns.d.ts.map +1 -0
- package/dist/data-access/dto-patterns.js +291 -0
- package/dist/data-access/dto-patterns.js.map +1 -0
- package/dist/data-access/index.d.ts +31 -0
- package/dist/data-access/index.d.ts.map +1 -0
- package/dist/data-access/index.js +49 -0
- package/dist/data-access/index.js.map +1 -0
- package/dist/data-access/n-plus-one.d.ts +60 -0
- package/dist/data-access/n-plus-one.d.ts.map +1 -0
- package/dist/data-access/n-plus-one.js +264 -0
- package/dist/data-access/n-plus-one.js.map +1 -0
- package/dist/data-access/query-patterns.d.ts +64 -0
- package/dist/data-access/query-patterns.d.ts.map +1 -0
- package/dist/data-access/query-patterns.js +314 -0
- package/dist/data-access/query-patterns.js.map +1 -0
- package/dist/data-access/repository-pattern.d.ts +62 -0
- package/dist/data-access/repository-pattern.d.ts.map +1 -0
- package/dist/data-access/repository-pattern.js +257 -0
- package/dist/data-access/repository-pattern.js.map +1 -0
- package/dist/data-access/transaction-patterns.d.ts +61 -0
- package/dist/data-access/transaction-patterns.d.ts.map +1 -0
- package/dist/data-access/transaction-patterns.js +277 -0
- package/dist/data-access/transaction-patterns.js.map +1 -0
- package/dist/data-access/validation-patterns.d.ts +62 -0
- package/dist/data-access/validation-patterns.d.ts.map +1 -0
- package/dist/data-access/validation-patterns.js +301 -0
- package/dist/data-access/validation-patterns.js.map +1 -0
- package/dist/documentation/deprecation.d.ts +62 -0
- package/dist/documentation/deprecation.d.ts.map +1 -0
- package/dist/documentation/deprecation.js +83 -0
- package/dist/documentation/deprecation.js.map +1 -0
- package/dist/documentation/example-code.d.ts +64 -0
- package/dist/documentation/example-code.d.ts.map +1 -0
- package/dist/documentation/example-code.js +79 -0
- package/dist/documentation/example-code.js.map +1 -0
- package/dist/documentation/index.d.ts +22 -0
- package/dist/documentation/index.d.ts.map +1 -0
- package/dist/documentation/index.js +19 -0
- package/dist/documentation/index.js.map +1 -0
- package/dist/documentation/jsdoc-patterns.d.ts +72 -0
- package/dist/documentation/jsdoc-patterns.d.ts.map +1 -0
- package/dist/documentation/jsdoc-patterns.js +92 -0
- package/dist/documentation/jsdoc-patterns.js.map +1 -0
- package/dist/documentation/readme-structure.d.ts +67 -0
- package/dist/documentation/readme-structure.d.ts.map +1 -0
- package/dist/documentation/readme-structure.js +76 -0
- package/dist/documentation/readme-structure.js.map +1 -0
- package/dist/documentation/todo-patterns.d.ts +67 -0
- package/dist/documentation/todo-patterns.d.ts.map +1 -0
- package/dist/documentation/todo-patterns.js +73 -0
- package/dist/documentation/todo-patterns.js.map +1 -0
- package/dist/errors/async-errors.d.ts +72 -0
- package/dist/errors/async-errors.d.ts.map +1 -0
- package/dist/errors/async-errors.js +214 -0
- package/dist/errors/async-errors.js.map +1 -0
- package/dist/errors/circuit-breaker.d.ts +53 -0
- package/dist/errors/circuit-breaker.d.ts.map +1 -0
- package/dist/errors/circuit-breaker.js +241 -0
- package/dist/errors/circuit-breaker.js.map +1 -0
- package/dist/errors/error-codes.d.ts +73 -0
- package/dist/errors/error-codes.d.ts.map +1 -0
- package/dist/errors/error-codes.js +211 -0
- package/dist/errors/error-codes.js.map +1 -0
- package/dist/errors/error-logging.d.ts +73 -0
- package/dist/errors/error-logging.d.ts.map +1 -0
- package/dist/errors/error-logging.js +256 -0
- package/dist/errors/error-logging.js.map +1 -0
- package/dist/errors/error-propagation.d.ts +73 -0
- package/dist/errors/error-propagation.d.ts.map +1 -0
- package/dist/errors/error-propagation.js +244 -0
- package/dist/errors/error-propagation.js.map +1 -0
- package/dist/errors/exception-hierarchy.d.ts +75 -0
- package/dist/errors/exception-hierarchy.d.ts.map +1 -0
- package/dist/errors/exception-hierarchy.js +259 -0
- package/dist/errors/exception-hierarchy.js.map +1 -0
- package/dist/errors/index.d.ts +31 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +49 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/errors/try-catch-placement.d.ts +73 -0
- package/dist/errors/try-catch-placement.d.ts.map +1 -0
- package/dist/errors/try-catch-placement.js +214 -0
- package/dist/errors/try-catch-placement.js.map +1 -0
- package/dist/index.d.ts +221 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +245 -0
- package/dist/index.js.map +1 -0
- package/dist/logging/context-fields.d.ts +48 -0
- package/dist/logging/context-fields.d.ts.map +1 -0
- package/dist/logging/context-fields.js +160 -0
- package/dist/logging/context-fields.js.map +1 -0
- package/dist/logging/correlation-ids.d.ts +44 -0
- package/dist/logging/correlation-ids.d.ts.map +1 -0
- package/dist/logging/correlation-ids.js +144 -0
- package/dist/logging/correlation-ids.js.map +1 -0
- package/dist/logging/health-checks.d.ts +45 -0
- package/dist/logging/health-checks.d.ts.map +1 -0
- package/dist/logging/health-checks.js +165 -0
- package/dist/logging/health-checks.js.map +1 -0
- package/dist/logging/index.d.ts +31 -0
- package/dist/logging/index.d.ts.map +1 -0
- package/dist/logging/index.js +49 -0
- package/dist/logging/index.js.map +1 -0
- package/dist/logging/log-levels.d.ts +46 -0
- package/dist/logging/log-levels.d.ts.map +1 -0
- package/dist/logging/log-levels.js +178 -0
- package/dist/logging/log-levels.js.map +1 -0
- package/dist/logging/metric-naming.d.ts +46 -0
- package/dist/logging/metric-naming.d.ts.map +1 -0
- package/dist/logging/metric-naming.js +157 -0
- package/dist/logging/metric-naming.js.map +1 -0
- package/dist/logging/pii-redaction.d.ts +44 -0
- package/dist/logging/pii-redaction.d.ts.map +1 -0
- package/dist/logging/pii-redaction.js +166 -0
- package/dist/logging/pii-redaction.js.map +1 -0
- package/dist/logging/structured-format.d.ts +53 -0
- package/dist/logging/structured-format.d.ts.map +1 -0
- package/dist/logging/structured-format.js +235 -0
- package/dist/logging/structured-format.js.map +1 -0
- package/dist/performance/bundle-size.d.ts +79 -0
- package/dist/performance/bundle-size.d.ts.map +1 -0
- package/dist/performance/bundle-size.js +276 -0
- package/dist/performance/bundle-size.js.map +1 -0
- package/dist/performance/caching-patterns.d.ts +78 -0
- package/dist/performance/caching-patterns.d.ts.map +1 -0
- package/dist/performance/caching-patterns.js +257 -0
- package/dist/performance/caching-patterns.js.map +1 -0
- package/dist/performance/code-splitting.d.ts +86 -0
- package/dist/performance/code-splitting.d.ts.map +1 -0
- package/dist/performance/code-splitting.js +447 -0
- package/dist/performance/code-splitting.js.map +1 -0
- package/dist/performance/debounce-throttle.d.ts +75 -0
- package/dist/performance/debounce-throttle.d.ts.map +1 -0
- package/dist/performance/debounce-throttle.js +232 -0
- package/dist/performance/debounce-throttle.js.map +1 -0
- package/dist/performance/index.d.ts +28 -0
- package/dist/performance/index.d.ts.map +1 -0
- package/dist/performance/index.js +39 -0
- package/dist/performance/index.js.map +1 -0
- package/dist/performance/lazy-loading.d.ts +75 -0
- package/dist/performance/lazy-loading.d.ts.map +1 -0
- package/dist/performance/lazy-loading.js +233 -0
- package/dist/performance/lazy-loading.js.map +1 -0
- package/dist/performance/memoization.d.ts +75 -0
- package/dist/performance/memoization.d.ts.map +1 -0
- package/dist/performance/memoization.js +251 -0
- package/dist/performance/memoization.js.map +1 -0
- package/dist/registry/detector-registry.d.ts +266 -0
- package/dist/registry/detector-registry.d.ts.map +1 -0
- package/dist/registry/detector-registry.js +526 -0
- package/dist/registry/detector-registry.js.map +1 -0
- package/dist/registry/index.d.ts +10 -0
- package/dist/registry/index.d.ts.map +1 -0
- package/dist/registry/index.js +10 -0
- package/dist/registry/index.js.map +1 -0
- package/dist/registry/loader.d.ts +232 -0
- package/dist/registry/loader.d.ts.map +1 -0
- package/dist/registry/loader.js +419 -0
- package/dist/registry/loader.js.map +1 -0
- package/dist/registry/types.d.ts +111 -0
- package/dist/registry/types.d.ts.map +1 -0
- package/dist/registry/types.js +19 -0
- package/dist/registry/types.js.map +1 -0
- package/dist/security/csp-headers.d.ts +78 -0
- package/dist/security/csp-headers.d.ts.map +1 -0
- package/dist/security/csp-headers.js +401 -0
- package/dist/security/csp-headers.js.map +1 -0
- package/dist/security/csrf-protection.d.ts +72 -0
- package/dist/security/csrf-protection.d.ts.map +1 -0
- package/dist/security/csrf-protection.js +344 -0
- package/dist/security/csrf-protection.js.map +1 -0
- package/dist/security/index.d.ts +30 -0
- package/dist/security/index.d.ts.map +1 -0
- package/dist/security/index.js +48 -0
- package/dist/security/index.js.map +1 -0
- package/dist/security/input-sanitization.d.ts +74 -0
- package/dist/security/input-sanitization.d.ts.map +1 -0
- package/dist/security/input-sanitization.js +373 -0
- package/dist/security/input-sanitization.js.map +1 -0
- package/dist/security/rate-limiting.d.ts +81 -0
- package/dist/security/rate-limiting.d.ts.map +1 -0
- package/dist/security/rate-limiting.js +535 -0
- package/dist/security/rate-limiting.js.map +1 -0
- package/dist/security/secret-management.d.ts +83 -0
- package/dist/security/secret-management.d.ts.map +1 -0
- package/dist/security/secret-management.js +547 -0
- package/dist/security/secret-management.js.map +1 -0
- package/dist/security/sql-injection.d.ts +76 -0
- package/dist/security/sql-injection.d.ts.map +1 -0
- package/dist/security/sql-injection.js +383 -0
- package/dist/security/sql-injection.js.map +1 -0
- package/dist/security/xss-prevention.d.ts +80 -0
- package/dist/security/xss-prevention.d.ts.map +1 -0
- package/dist/security/xss-prevention.js +416 -0
- package/dist/security/xss-prevention.js.map +1 -0
- package/dist/structural/barrel-exports.d.ts +178 -0
- package/dist/structural/barrel-exports.d.ts.map +1 -0
- package/dist/structural/barrel-exports.js +553 -0
- package/dist/structural/barrel-exports.js.map +1 -0
- package/dist/structural/circular-deps.d.ts +140 -0
- package/dist/structural/circular-deps.d.ts.map +1 -0
- package/dist/structural/circular-deps.js +422 -0
- package/dist/structural/circular-deps.js.map +1 -0
- package/dist/structural/co-location.d.ts +202 -0
- package/dist/structural/co-location.d.ts.map +1 -0
- package/dist/structural/co-location.js +640 -0
- package/dist/structural/co-location.js.map +1 -0
- package/dist/structural/directory-structure.d.ts +151 -0
- package/dist/structural/directory-structure.d.ts.map +1 -0
- package/dist/structural/directory-structure.js +457 -0
- package/dist/structural/directory-structure.js.map +1 -0
- package/dist/structural/file-naming.d.ts +61 -0
- package/dist/structural/file-naming.d.ts.map +1 -0
- package/dist/structural/file-naming.js +231 -0
- package/dist/structural/file-naming.js.map +1 -0
- package/dist/structural/import-ordering.d.ts +212 -0
- package/dist/structural/import-ordering.d.ts.map +1 -0
- package/dist/structural/import-ordering.js +821 -0
- package/dist/structural/import-ordering.js.map +1 -0
- package/dist/structural/index.d.ts +23 -0
- package/dist/structural/index.d.ts.map +1 -0
- package/dist/structural/index.js +26 -0
- package/dist/structural/index.js.map +1 -0
- package/dist/structural/module-boundaries.d.ts +164 -0
- package/dist/structural/module-boundaries.d.ts.map +1 -0
- package/dist/structural/module-boundaries.js +616 -0
- package/dist/structural/module-boundaries.js.map +1 -0
- package/dist/structural/package-boundaries.d.ts +182 -0
- package/dist/structural/package-boundaries.d.ts.map +1 -0
- package/dist/structural/package-boundaries.js +602 -0
- package/dist/structural/package-boundaries.js.map +1 -0
- package/dist/styling/class-naming.d.ts +263 -0
- package/dist/styling/class-naming.d.ts.map +1 -0
- package/dist/styling/class-naming.js +892 -0
- package/dist/styling/class-naming.js.map +1 -0
- package/dist/styling/color-usage.d.ts +213 -0
- package/dist/styling/color-usage.d.ts.map +1 -0
- package/dist/styling/color-usage.js +732 -0
- package/dist/styling/color-usage.js.map +1 -0
- package/dist/styling/design-tokens.d.ts +212 -0
- package/dist/styling/design-tokens.d.ts.map +1 -0
- package/dist/styling/design-tokens.js +748 -0
- package/dist/styling/design-tokens.js.map +1 -0
- package/dist/styling/index.d.ts +16 -0
- package/dist/styling/index.d.ts.map +1 -0
- package/dist/styling/index.js +56 -0
- package/dist/styling/index.js.map +1 -0
- package/dist/styling/responsive.d.ts +304 -0
- package/dist/styling/responsive.d.ts.map +1 -0
- package/dist/styling/responsive.js +888 -0
- package/dist/styling/responsive.js.map +1 -0
- package/dist/styling/spacing-scale.d.ts +248 -0
- package/dist/styling/spacing-scale.d.ts.map +1 -0
- package/dist/styling/spacing-scale.js +865 -0
- package/dist/styling/spacing-scale.js.map +1 -0
- package/dist/styling/tailwind-patterns.d.ts +305 -0
- package/dist/styling/tailwind-patterns.d.ts.map +1 -0
- package/dist/styling/tailwind-patterns.js +1181 -0
- package/dist/styling/tailwind-patterns.js.map +1 -0
- package/dist/styling/typography.d.ts +281 -0
- package/dist/styling/typography.d.ts.map +1 -0
- package/dist/styling/typography.js +1004 -0
- package/dist/styling/typography.js.map +1 -0
- package/dist/styling/z-index-scale.d.ts +270 -0
- package/dist/styling/z-index-scale.d.ts.map +1 -0
- package/dist/styling/z-index-scale.js +714 -0
- package/dist/styling/z-index-scale.js.map +1 -0
- package/dist/testing/co-location.d.ts +42 -0
- package/dist/testing/co-location.d.ts.map +1 -0
- package/dist/testing/co-location.js +134 -0
- package/dist/testing/co-location.js.map +1 -0
- package/dist/testing/describe-naming.d.ts +47 -0
- package/dist/testing/describe-naming.d.ts.map +1 -0
- package/dist/testing/describe-naming.js +150 -0
- package/dist/testing/describe-naming.js.map +1 -0
- package/dist/testing/file-naming.d.ts +44 -0
- package/dist/testing/file-naming.d.ts.map +1 -0
- package/dist/testing/file-naming.js +131 -0
- package/dist/testing/file-naming.js.map +1 -0
- package/dist/testing/fixture-patterns.d.ts +52 -0
- package/dist/testing/fixture-patterns.d.ts.map +1 -0
- package/dist/testing/fixture-patterns.js +228 -0
- package/dist/testing/fixture-patterns.js.map +1 -0
- package/dist/testing/index.d.ts +31 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +49 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/testing/mock-patterns.d.ts +53 -0
- package/dist/testing/mock-patterns.d.ts.map +1 -0
- package/dist/testing/mock-patterns.js +264 -0
- package/dist/testing/mock-patterns.js.map +1 -0
- package/dist/testing/setup-teardown.d.ts +55 -0
- package/dist/testing/setup-teardown.d.ts.map +1 -0
- package/dist/testing/setup-teardown.js +262 -0
- package/dist/testing/setup-teardown.js.map +1 -0
- package/dist/testing/test-structure.d.ts +51 -0
- package/dist/testing/test-structure.d.ts.map +1 -0
- package/dist/testing/test-structure.js +225 -0
- package/dist/testing/test-structure.js.map +1 -0
- package/dist/types/any-usage.d.ts +99 -0
- package/dist/types/any-usage.d.ts.map +1 -0
- package/dist/types/any-usage.js +641 -0
- package/dist/types/any-usage.js.map +1 -0
- package/dist/types/file-location.d.ts +76 -0
- package/dist/types/file-location.d.ts.map +1 -0
- package/dist/types/file-location.js +395 -0
- package/dist/types/file-location.js.map +1 -0
- package/dist/types/generic-patterns.d.ts +97 -0
- package/dist/types/generic-patterns.d.ts.map +1 -0
- package/dist/types/generic-patterns.js +615 -0
- package/dist/types/generic-patterns.js.map +1 -0
- package/dist/types/index.d.ts +31 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +43 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/interface-vs-type.d.ts +81 -0
- package/dist/types/interface-vs-type.d.ts.map +1 -0
- package/dist/types/interface-vs-type.js +440 -0
- package/dist/types/interface-vs-type.js.map +1 -0
- package/dist/types/naming-conventions.d.ts +84 -0
- package/dist/types/naming-conventions.d.ts.map +1 -0
- package/dist/types/naming-conventions.js +455 -0
- package/dist/types/naming-conventions.js.map +1 -0
- package/dist/types/type-assertions.d.ts +98 -0
- package/dist/types/type-assertions.d.ts.map +1 -0
- package/dist/types/type-assertions.js +639 -0
- package/dist/types/type-assertions.js.map +1 -0
- package/dist/types/utility-types.d.ts +110 -0
- package/dist/types/utility-types.d.ts.map +1 -0
- package/dist/types/utility-types.js +547 -0
- package/dist/types/utility-types.js.map +1 -0
- package/package.json +44 -0
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Alt Text Detector - Alt text pattern detection
|
|
3
|
+
* @requirements 20.6 - Alt text patterns
|
|
4
|
+
*/
|
|
5
|
+
import type { Violation, QuickFix, PatternCategory, Language } from 'driftdetect-core';
|
|
6
|
+
import { RegexDetector } from '../base/regex-detector.js';
|
|
7
|
+
import type { DetectionContext, DetectionResult } from '../base/base-detector.js';
|
|
8
|
+
export type AltTextPatternType = 'img-alt' | 'decorative-alt' | 'svg-title' | 'icon-label' | 'figure-caption';
|
|
9
|
+
export type AltTextViolationType = 'missing-alt' | 'empty-alt-non-decorative' | 'redundant-alt';
|
|
10
|
+
export interface AltTextPatternInfo {
|
|
11
|
+
type: AltTextPatternType;
|
|
12
|
+
file: string;
|
|
13
|
+
line: number;
|
|
14
|
+
column: number;
|
|
15
|
+
matchedText: string;
|
|
16
|
+
altText?: string | undefined;
|
|
17
|
+
context?: string | undefined;
|
|
18
|
+
}
|
|
19
|
+
export interface AltTextViolationInfo {
|
|
20
|
+
type: AltTextViolationType;
|
|
21
|
+
file: string;
|
|
22
|
+
line: number;
|
|
23
|
+
column: number;
|
|
24
|
+
matchedText: string;
|
|
25
|
+
issue: string;
|
|
26
|
+
suggestedFix?: string | undefined;
|
|
27
|
+
severity: 'high' | 'medium' | 'low';
|
|
28
|
+
}
|
|
29
|
+
export interface AltTextAnalysis {
|
|
30
|
+
patterns: AltTextPatternInfo[];
|
|
31
|
+
violations: AltTextViolationInfo[];
|
|
32
|
+
imgWithAltCount: number;
|
|
33
|
+
decorativeCount: number;
|
|
34
|
+
confidence: number;
|
|
35
|
+
}
|
|
36
|
+
export declare const IMG_ALT_PATTERNS: readonly [RegExp, RegExp];
|
|
37
|
+
export declare const DECORATIVE_ALT_PATTERNS: readonly [RegExp, RegExp, RegExp];
|
|
38
|
+
export declare const SVG_TITLE_PATTERNS: readonly [RegExp, RegExp];
|
|
39
|
+
export declare const ICON_LABEL_PATTERNS: readonly [RegExp, RegExp, RegExp];
|
|
40
|
+
export declare const FIGURE_CAPTION_PATTERNS: readonly [RegExp, RegExp];
|
|
41
|
+
export declare const MISSING_ALT_PATTERNS: readonly [RegExp];
|
|
42
|
+
export declare const REDUNDANT_ALT_PATTERNS: readonly [RegExp];
|
|
43
|
+
export declare function shouldExcludeFile(filePath: string): boolean;
|
|
44
|
+
export declare function detectImgAlt(content: string, filePath: string): AltTextPatternInfo[];
|
|
45
|
+
export declare function detectDecorativeAlt(content: string, filePath: string): AltTextPatternInfo[];
|
|
46
|
+
export declare function detectSvgTitle(content: string, filePath: string): AltTextPatternInfo[];
|
|
47
|
+
export declare function detectIconLabel(content: string, filePath: string): AltTextPatternInfo[];
|
|
48
|
+
export declare function detectFigureCaption(content: string, filePath: string): AltTextPatternInfo[];
|
|
49
|
+
export declare function detectMissingAltViolations(content: string, filePath: string): AltTextViolationInfo[];
|
|
50
|
+
export declare function detectRedundantAltViolations(content: string, filePath: string): AltTextViolationInfo[];
|
|
51
|
+
export declare function analyzeAltText(content: string, filePath: string): AltTextAnalysis;
|
|
52
|
+
export declare class AltTextDetector extends RegexDetector {
|
|
53
|
+
readonly id = "accessibility/alt-text";
|
|
54
|
+
readonly name = "Alt Text Detector";
|
|
55
|
+
readonly description = "Detects alt text patterns for images and icons";
|
|
56
|
+
readonly category: PatternCategory;
|
|
57
|
+
readonly subcategory = "alt-text";
|
|
58
|
+
readonly supportedLanguages: Language[];
|
|
59
|
+
detect(context: DetectionContext): Promise<DetectionResult>;
|
|
60
|
+
generateQuickFix(_violation: Violation): QuickFix | null;
|
|
61
|
+
}
|
|
62
|
+
export declare function createAltTextDetector(): AltTextDetector;
|
|
63
|
+
//# sourceMappingURL=alt-text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alt-text.d.ts","sourceRoot":"","sources":["../../src/accessibility/alt-text.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACvF,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,KAAK,EAAE,gBA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OAAO,CAAC,eAAe,CAAC;IAOjE,gBAAgB,CAAC,UAAU,EAAE,SAAS,GAAG,QAAQ,GAAG,IAAI;CACzD;AAED,wBAAgB,qBAAqB,IAAI,eAAe,CAAkC"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Alt Text Detector - Alt text pattern detection
|
|
3
|
+
* @requirements 20.6 - Alt text patterns
|
|
4
|
+
*/
|
|
5
|
+
import { RegexDetector } from '../base/regex-detector.js';
|
|
6
|
+
export const IMG_ALT_PATTERNS = [/<img[^>]*alt\s*=\s*['"`][^'"`]+['"`]/gi, /alt\s*=\s*\{[^}]+\}/g];
|
|
7
|
+
export const DECORATIVE_ALT_PATTERNS = [/<img[^>]*alt\s*=\s*['"`]['"`]/gi, /alt\s*=\s*['"`]['"`]/g, /role\s*=\s*['"`]presentation['"`]/gi];
|
|
8
|
+
export const SVG_TITLE_PATTERNS = [/<title>[^<]+<\/title>/gi, /<svg[^>]*aria-label/gi];
|
|
9
|
+
export const ICON_LABEL_PATTERNS = [/aria-label\s*=\s*['"`][^'"`]+['"`]/gi, /sr-only/g, /visually-hidden/g];
|
|
10
|
+
export const FIGURE_CAPTION_PATTERNS = [/<figcaption>/gi, /<figcaption[^>]*>/gi];
|
|
11
|
+
export const MISSING_ALT_PATTERNS = [/<img(?![^>]*alt\s*=)[^>]*>/gi];
|
|
12
|
+
export const REDUNDANT_ALT_PATTERNS = [/alt\s*=\s*['"`](?:image|picture|photo|icon|logo)\s*(?:of)?\s*['"`]/gi];
|
|
13
|
+
export function shouldExcludeFile(filePath) {
|
|
14
|
+
return [/\.test\.[jt]sx?$/, /\.spec\.[jt]sx?$/, /__tests__\//, /node_modules\//, /\.min\.[jt]s$/].some((p) => p.test(filePath));
|
|
15
|
+
}
|
|
16
|
+
function detectPatterns(content, filePath, patterns, type) {
|
|
17
|
+
const results = [];
|
|
18
|
+
const lines = content.split('\n');
|
|
19
|
+
for (let i = 0; i < lines.length; i++) {
|
|
20
|
+
const line = lines[i];
|
|
21
|
+
for (const pattern of patterns) {
|
|
22
|
+
const regex = new RegExp(pattern.source, pattern.flags);
|
|
23
|
+
let match;
|
|
24
|
+
while ((match = regex.exec(line)) !== null) {
|
|
25
|
+
const altMatch = match[0].match(/alt\s*=\s*['"`]([^'"`]*)['"`]/i);
|
|
26
|
+
results.push({ type, file: filePath, line: i + 1, column: match.index + 1, matchedText: match[0], altText: altMatch ? altMatch[1] : undefined, context: line.trim() });
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return results;
|
|
31
|
+
}
|
|
32
|
+
export function detectImgAlt(content, filePath) { return detectPatterns(content, filePath, IMG_ALT_PATTERNS, 'img-alt'); }
|
|
33
|
+
export function detectDecorativeAlt(content, filePath) { return detectPatterns(content, filePath, DECORATIVE_ALT_PATTERNS, 'decorative-alt'); }
|
|
34
|
+
export function detectSvgTitle(content, filePath) { return detectPatterns(content, filePath, SVG_TITLE_PATTERNS, 'svg-title'); }
|
|
35
|
+
export function detectIconLabel(content, filePath) { return detectPatterns(content, filePath, ICON_LABEL_PATTERNS, 'icon-label'); }
|
|
36
|
+
export function detectFigureCaption(content, filePath) { return detectPatterns(content, filePath, FIGURE_CAPTION_PATTERNS, 'figure-caption'); }
|
|
37
|
+
export function detectMissingAltViolations(content, filePath) {
|
|
38
|
+
const results = [];
|
|
39
|
+
const lines = content.split('\n');
|
|
40
|
+
for (let i = 0; i < lines.length; i++) {
|
|
41
|
+
const line = lines[i];
|
|
42
|
+
for (const pattern of MISSING_ALT_PATTERNS) {
|
|
43
|
+
const regex = new RegExp(pattern.source, pattern.flags);
|
|
44
|
+
let match;
|
|
45
|
+
while ((match = regex.exec(line)) !== null) {
|
|
46
|
+
results.push({ type: 'missing-alt', file: filePath, line: i + 1, column: match.index + 1, matchedText: match[0], issue: 'Image missing alt attribute', suggestedFix: 'Add alt="" for decorative or descriptive alt for meaningful images', severity: 'high' });
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return results;
|
|
51
|
+
}
|
|
52
|
+
export function detectRedundantAltViolations(content, filePath) {
|
|
53
|
+
const results = [];
|
|
54
|
+
const lines = content.split('\n');
|
|
55
|
+
for (let i = 0; i < lines.length; i++) {
|
|
56
|
+
const line = lines[i];
|
|
57
|
+
for (const pattern of REDUNDANT_ALT_PATTERNS) {
|
|
58
|
+
const regex = new RegExp(pattern.source, pattern.flags);
|
|
59
|
+
let match;
|
|
60
|
+
while ((match = regex.exec(line)) !== null) {
|
|
61
|
+
results.push({ type: 'redundant-alt', file: filePath, line: i + 1, column: match.index + 1, matchedText: match[0], issue: 'Redundant alt text (image/photo/icon)', suggestedFix: 'Describe the image content, not that it is an image', severity: 'low' });
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return results;
|
|
66
|
+
}
|
|
67
|
+
export function analyzeAltText(content, filePath) {
|
|
68
|
+
if (shouldExcludeFile(filePath))
|
|
69
|
+
return { patterns: [], violations: [], imgWithAltCount: 0, decorativeCount: 0, confidence: 1.0 };
|
|
70
|
+
const patterns = [...detectImgAlt(content, filePath), ...detectDecorativeAlt(content, filePath), ...detectSvgTitle(content, filePath), ...detectIconLabel(content, filePath), ...detectFigureCaption(content, filePath)];
|
|
71
|
+
const violations = [...detectMissingAltViolations(content, filePath), ...detectRedundantAltViolations(content, filePath)];
|
|
72
|
+
const imgWithAltCount = patterns.filter((p) => p.type === 'img-alt').length;
|
|
73
|
+
const decorativeCount = patterns.filter((p) => p.type === 'decorative-alt').length;
|
|
74
|
+
let confidence = 0.7;
|
|
75
|
+
if (patterns.length > 0)
|
|
76
|
+
confidence += 0.15;
|
|
77
|
+
if (violations.length === 0)
|
|
78
|
+
confidence += 0.1;
|
|
79
|
+
confidence = Math.min(confidence, 0.95);
|
|
80
|
+
return { patterns, violations, imgWithAltCount, decorativeCount, confidence };
|
|
81
|
+
}
|
|
82
|
+
export class AltTextDetector extends RegexDetector {
|
|
83
|
+
id = 'accessibility/alt-text';
|
|
84
|
+
name = 'Alt Text Detector';
|
|
85
|
+
description = 'Detects alt text patterns for images and icons';
|
|
86
|
+
category = 'accessibility';
|
|
87
|
+
subcategory = 'alt-text';
|
|
88
|
+
supportedLanguages = ['typescript', 'javascript'];
|
|
89
|
+
async detect(context) {
|
|
90
|
+
if (!this.supportsLanguage(context.language))
|
|
91
|
+
return this.createEmptyResult();
|
|
92
|
+
const analysis = analyzeAltText(context.content, context.file);
|
|
93
|
+
if (analysis.patterns.length === 0 && analysis.violations.length === 0)
|
|
94
|
+
return this.createEmptyResult();
|
|
95
|
+
return this.createResult([], [], analysis.confidence, { custom: { patterns: analysis.patterns, violations: analysis.violations, imgWithAltCount: analysis.imgWithAltCount, decorativeCount: analysis.decorativeCount } });
|
|
96
|
+
}
|
|
97
|
+
generateQuickFix(_violation) { return null; }
|
|
98
|
+
}
|
|
99
|
+
export function createAltTextDetector() { return new AltTextDetector(); }
|
|
100
|
+
//# sourceMappingURL=alt-text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alt-text.js","sourceRoot":"","sources":["../../src/accessibility/alt-text.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAU1D,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,wCAAwC,EAAE,sBAAsB,CAAU,CAAC;AAC5G,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,iCAAiC,EAAE,uBAAuB,EAAE,qCAAqC,CAAU,CAAC;AACpJ,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,yBAAyB,EAAE,uBAAuB,CAAU,CAAC;AAChG,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,sCAAsC,EAAE,UAAU,EAAE,kBAAkB,CAAU,CAAC;AACrH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,gBAAgB,EAAE,qBAAqB,CAAU,CAAC;AAC1F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AAQ,EAAE,QAAQ,CAAC,QAAQ,EAAE,UAAU,EAAE,QAAQ,CAAC,UAAU,EAAE,eAAe,EAAE,QAAQ,CAAC,eAAe,EAAE,eAAe,EAAE,QAAQ,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;IAC5N,CAAC;IAED,gBAAgB,CAAC,UAAqB,IAAqB,OAAO,IAAI,CAAC,CAAC,CAAC;CAC1E;AAED,MAAM,UAAU,qBAAqB,KAAsB,OAAO,IAAI,eAAe,EAAE,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ARIA Roles Detector - ARIA role pattern detection
|
|
3
|
+
* @requirements 20.2 - ARIA role patterns
|
|
4
|
+
*/
|
|
5
|
+
import type { Violation, QuickFix, PatternCategory, Language } from 'driftdetect-core';
|
|
6
|
+
import { RegexDetector } from '../base/regex-detector.js';
|
|
7
|
+
import type { DetectionContext, DetectionResult } from '../base/base-detector.js';
|
|
8
|
+
export type AriaRolesPatternType = 'aria-role' | 'aria-label' | 'aria-describedby' | 'aria-hidden' | 'aria-live' | 'aria-expanded' | 'aria-controls';
|
|
9
|
+
export type AriaRolesViolationType = 'redundant-role' | 'missing-aria-label' | 'invalid-role';
|
|
10
|
+
export interface AriaRolesPatternInfo {
|
|
11
|
+
type: AriaRolesPatternType;
|
|
12
|
+
file: string;
|
|
13
|
+
line: number;
|
|
14
|
+
column: number;
|
|
15
|
+
matchedText: string;
|
|
16
|
+
role?: string | undefined;
|
|
17
|
+
context?: string | undefined;
|
|
18
|
+
}
|
|
19
|
+
export interface AriaRolesViolationInfo {
|
|
20
|
+
type: AriaRolesViolationType;
|
|
21
|
+
file: string;
|
|
22
|
+
line: number;
|
|
23
|
+
column: number;
|
|
24
|
+
matchedText: string;
|
|
25
|
+
issue: string;
|
|
26
|
+
suggestedFix?: string | undefined;
|
|
27
|
+
severity: 'high' | 'medium' | 'low';
|
|
28
|
+
}
|
|
29
|
+
export interface AriaRolesAnalysis {
|
|
30
|
+
patterns: AriaRolesPatternInfo[];
|
|
31
|
+
violations: AriaRolesViolationInfo[];
|
|
32
|
+
ariaRoleCount: number;
|
|
33
|
+
ariaLabelCount: number;
|
|
34
|
+
confidence: number;
|
|
35
|
+
}
|
|
36
|
+
export declare const ARIA_ROLE_PATTERNS: readonly [RegExp];
|
|
37
|
+
export declare const ARIA_LABEL_PATTERNS: readonly [RegExp, RegExp];
|
|
38
|
+
export declare const ARIA_DESCRIBEDBY_PATTERNS: readonly [RegExp];
|
|
39
|
+
export declare const ARIA_HIDDEN_PATTERNS: readonly [RegExp];
|
|
40
|
+
export declare const ARIA_LIVE_PATTERNS: readonly [RegExp];
|
|
41
|
+
export declare const ARIA_EXPANDED_PATTERNS: readonly [RegExp];
|
|
42
|
+
export declare const ARIA_CONTROLS_PATTERNS: readonly [RegExp];
|
|
43
|
+
export declare const REDUNDANT_ROLE_PATTERNS: readonly [RegExp, RegExp, RegExp];
|
|
44
|
+
export declare function shouldExcludeFile(filePath: string): boolean;
|
|
45
|
+
export declare function detectAriaRole(content: string, filePath: string): AriaRolesPatternInfo[];
|
|
46
|
+
export declare function detectAriaLabel(content: string, filePath: string): AriaRolesPatternInfo[];
|
|
47
|
+
export declare function detectAriaDescribedby(content: string, filePath: string): AriaRolesPatternInfo[];
|
|
48
|
+
export declare function detectAriaHidden(content: string, filePath: string): AriaRolesPatternInfo[];
|
|
49
|
+
export declare function detectAriaLive(content: string, filePath: string): AriaRolesPatternInfo[];
|
|
50
|
+
export declare function detectAriaExpanded(content: string, filePath: string): AriaRolesPatternInfo[];
|
|
51
|
+
export declare function detectAriaControls(content: string, filePath: string): AriaRolesPatternInfo[];
|
|
52
|
+
export declare function detectRedundantRoleViolations(content: string, filePath: string): AriaRolesViolationInfo[];
|
|
53
|
+
export declare function analyzeAriaRoles(content: string, filePath: string): AriaRolesAnalysis;
|
|
54
|
+
export declare class AriaRolesDetector extends RegexDetector {
|
|
55
|
+
readonly id = "accessibility/aria-roles";
|
|
56
|
+
readonly name = "ARIA Roles Detector";
|
|
57
|
+
readonly description = "Detects ARIA role and attribute patterns";
|
|
58
|
+
readonly category: PatternCategory;
|
|
59
|
+
readonly subcategory = "aria-roles";
|
|
60
|
+
readonly supportedLanguages: Language[];
|
|
61
|
+
detect(context: DetectionContext): Promise<DetectionResult>;
|
|
62
|
+
generateQuickFix(_violation: Violation): QuickFix | null;
|
|
63
|
+
}
|
|
64
|
+
export declare function createAriaRolesDetector(): AriaRolesDetector;
|
|
65
|
+
//# sourceMappingURL=aria-roles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aria-roles.d.ts","sourceRoot":"","sources":["../../src/accessibility/aria-roles.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACvF,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAElF,MAAM,MAAM,oBAAoB,GAAG,WAAW,GAAG,YAAY,GAAG,kBAAkB,GAAG,aAAa,GAAG,WAAW,GAAG,eAAe,GAAG,eAAe,CAAC;AACrJ,MAAM,MAAM,sBAAsB,GAAG,gBAAgB,GAAG,oBAAoB,GAAG,cAAc,CAAC;AAE9F,MAAM,WAAW,oBAAoB;IAAG,IAAI,EAAE,oBAAoB,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAAE;AAC/L,MAAM,WAAW,sBAAsB;IAAG,IAAI,EAAE,sBAAsB,CAAC;I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GAAG,oBAAoB,EAAE,CAAmF;AAC9K,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,oBAAoB,EAAE,CAA+E;AACxK,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,oBAAoB,EAAE,CAAuF;AACpL,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,oBAAoB,EAAE,CAAuF;AAEpL,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,sBAAsB,EAAE,CAczG;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,iBAAiB,CAQrF;AAED,qBAAa,iBAAkB,SAAQ,aAAa;IAClD,QAAQ,CAAC,EAAE,8BAA8B;IACzC,QAAQ,CAAC,IAAI,yBAAyB;IACtC,QAAQ,CAAC,WAAW,8CAA8C;IAClE,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAmB;IACrD,QAAQ,CAAC,WAAW,gBAAgB;IACpC,QAAQ,CAAC,kBAAkB,EAAE,QAAQ,EAAE,CAAgC;IAEjE,MAAM,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC;IAOjE,gBAAgB,CAAC,UAAU,EAAE,SAAS,GAAG,QAAQ,GAAG,IAAI;CACzD;AAED,wBAAgB,uBAAuB,IAAI,iBAAiB,CAAoC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ARIA Roles Detector - ARIA role pattern detection
|
|
3
|
+
* @requirements 20.2 - ARIA role patterns
|
|
4
|
+
*/
|
|
5
|
+
import { RegexDetector } from '../base/regex-detector.js';
|
|
6
|
+
export const ARIA_ROLE_PATTERNS = [/role\s*=\s*['"`](\w+)['"`]/gi];
|
|
7
|
+
export const ARIA_LABEL_PATTERNS = [/aria-label\s*=\s*['"`][^'"`]+['"`]/gi, /aria-labelledby\s*=\s*['"`][^'"`]+['"`]/gi];
|
|
8
|
+
export const ARIA_DESCRIBEDBY_PATTERNS = [/aria-describedby\s*=\s*['"`][^'"`]+['"`]/gi];
|
|
9
|
+
export const ARIA_HIDDEN_PATTERNS = [/aria-hidden\s*=\s*['"`](?:true|false)['"`]/gi];
|
|
10
|
+
export const ARIA_LIVE_PATTERNS = [/aria-live\s*=\s*['"`](?:polite|assertive|off)['"`]/gi];
|
|
11
|
+
export const ARIA_EXPANDED_PATTERNS = [/aria-expanded\s*=\s*['"`]?(?:true|false|\{[^}]+\})['"`]?/gi];
|
|
12
|
+
export const ARIA_CONTROLS_PATTERNS = [/aria-controls\s*=\s*['"`][^'"`]+['"`]/gi];
|
|
13
|
+
export const REDUNDANT_ROLE_PATTERNS = [/<button[^>]*role\s*=\s*['"`]button['"`]/gi, /<a[^>]*role\s*=\s*['"`]link['"`]/gi, /<nav[^>]*role\s*=\s*['"`]navigation['"`]/gi];
|
|
14
|
+
export function shouldExcludeFile(filePath) {
|
|
15
|
+
return [/\.test\.[jt]sx?$/, /\.spec\.[jt]sx?$/, /__tests__\//, /node_modules\//, /\.min\.[jt]s$/].some((p) => p.test(filePath));
|
|
16
|
+
}
|
|
17
|
+
function detectPatterns(content, filePath, patterns, type) {
|
|
18
|
+
const results = [];
|
|
19
|
+
const lines = content.split('\n');
|
|
20
|
+
for (let i = 0; i < lines.length; i++) {
|
|
21
|
+
const line = lines[i];
|
|
22
|
+
for (const pattern of patterns) {
|
|
23
|
+
const regex = new RegExp(pattern.source, pattern.flags);
|
|
24
|
+
let match;
|
|
25
|
+
while ((match = regex.exec(line)) !== null) {
|
|
26
|
+
results.push({ type, file: filePath, line: i + 1, column: match.index + 1, matchedText: match[0], role: match[1], context: line.trim() });
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return results;
|
|
31
|
+
}
|
|
32
|
+
export function detectAriaRole(content, filePath) { return detectPatterns(content, filePath, ARIA_ROLE_PATTERNS, 'aria-role'); }
|
|
33
|
+
export function detectAriaLabel(content, filePath) { return detectPatterns(content, filePath, ARIA_LABEL_PATTERNS, 'aria-label'); }
|
|
34
|
+
export function detectAriaDescribedby(content, filePath) { return detectPatterns(content, filePath, ARIA_DESCRIBEDBY_PATTERNS, 'aria-describedby'); }
|
|
35
|
+
export function detectAriaHidden(content, filePath) { return detectPatterns(content, filePath, ARIA_HIDDEN_PATTERNS, 'aria-hidden'); }
|
|
36
|
+
export function detectAriaLive(content, filePath) { return detectPatterns(content, filePath, ARIA_LIVE_PATTERNS, 'aria-live'); }
|
|
37
|
+
export function detectAriaExpanded(content, filePath) { return detectPatterns(content, filePath, ARIA_EXPANDED_PATTERNS, 'aria-expanded'); }
|
|
38
|
+
export function detectAriaControls(content, filePath) { return detectPatterns(content, filePath, ARIA_CONTROLS_PATTERNS, 'aria-controls'); }
|
|
39
|
+
export function detectRedundantRoleViolations(content, filePath) {
|
|
40
|
+
const results = [];
|
|
41
|
+
const lines = content.split('\n');
|
|
42
|
+
for (let i = 0; i < lines.length; i++) {
|
|
43
|
+
const line = lines[i];
|
|
44
|
+
for (const pattern of REDUNDANT_ROLE_PATTERNS) {
|
|
45
|
+
const regex = new RegExp(pattern.source, pattern.flags);
|
|
46
|
+
let match;
|
|
47
|
+
while ((match = regex.exec(line)) !== null) {
|
|
48
|
+
results.push({ type: 'redundant-role', file: filePath, line: i + 1, column: match.index + 1, matchedText: match[0], issue: 'Redundant ARIA role on semantic element', suggestedFix: 'Remove redundant role attribute', severity: 'low' });
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return results;
|
|
53
|
+
}
|
|
54
|
+
export function analyzeAriaRoles(content, filePath) {
|
|
55
|
+
if (shouldExcludeFile(filePath))
|
|
56
|
+
return { patterns: [], violations: [], ariaRoleCount: 0, ariaLabelCount: 0, confidence: 1.0 };
|
|
57
|
+
const patterns = [...detectAriaRole(content, filePath), ...detectAriaLabel(content, filePath), ...detectAriaDescribedby(content, filePath), ...detectAriaHidden(content, filePath), ...detectAriaLive(content, filePath), ...detectAriaExpanded(content, filePath), ...detectAriaControls(content, filePath)];
|
|
58
|
+
const violations = [...detectRedundantRoleViolations(content, filePath)];
|
|
59
|
+
const ariaRoleCount = patterns.filter((p) => p.type === 'aria-role').length;
|
|
60
|
+
const ariaLabelCount = patterns.filter((p) => p.type === 'aria-label').length;
|
|
61
|
+
let confidence = 0.7;
|
|
62
|
+
if (patterns.length > 0)
|
|
63
|
+
confidence += 0.15;
|
|
64
|
+
if (violations.length === 0)
|
|
65
|
+
confidence += 0.1;
|
|
66
|
+
confidence = Math.min(confidence, 0.95);
|
|
67
|
+
return { patterns, violations, ariaRoleCount, ariaLabelCount, confidence };
|
|
68
|
+
}
|
|
69
|
+
export class AriaRolesDetector extends RegexDetector {
|
|
70
|
+
id = 'accessibility/aria-roles';
|
|
71
|
+
name = 'ARIA Roles Detector';
|
|
72
|
+
description = 'Detects ARIA role and attribute patterns';
|
|
73
|
+
category = 'accessibility';
|
|
74
|
+
subcategory = 'aria-roles';
|
|
75
|
+
supportedLanguages = ['typescript', 'javascript'];
|
|
76
|
+
async detect(context) {
|
|
77
|
+
if (!this.supportsLanguage(context.language))
|
|
78
|
+
return this.createEmptyResult();
|
|
79
|
+
const analysis = analyzeAriaRoles(context.content, context.file);
|
|
80
|
+
if (analysis.patterns.length === 0 && analysis.violations.length === 0)
|
|
81
|
+
return this.createEmptyResult();
|
|
82
|
+
return this.createResult([], [], analysis.confidence, { custom: { patterns: analysis.patterns, violations: analysis.violations, ariaRoleCount: analysis.ariaRoleCount, ariaLabelCount: analysis.ariaLabelCount } });
|
|
83
|
+
}
|
|
84
|
+
generateQuickFix(_violation) { return null; }
|
|
85
|
+
}
|
|
86
|
+
export function createAriaRolesDetector() { return new AriaRolesDetector(); }
|
|
87
|
+
//# sourceMappingURL=aria-roles.js.map
|
|
@@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CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;IACtN,CAAC;IAED,gBAAgB,CAAC,UAAqB,IAAqB,OAAO,IAAI,CAAC,CAAC,CAAC;CAC1E;AAED,MAAM,UAAU,uBAAuB,KAAwB,OAAO,IAAI,iBAAiB,EAAE,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Focus Management Detector - Focus management pattern detection
|
|
3
|
+
* @requirements 20.4 - Focus management patterns
|
|
4
|
+
*/
|
|
5
|
+
import type { Violation, QuickFix, PatternCategory, Language } from 'driftdetect-core';
|
|
6
|
+
import { RegexDetector } from '../base/regex-detector.js';
|
|
7
|
+
import type { DetectionContext, DetectionResult } from '../base/base-detector.js';
|
|
8
|
+
export type FocusManagementPatternType = 'focus-visible' | 'focus-within' | 'use-focus' | 'auto-focus' | 'focus-ref' | 'focus-ring';
|
|
9
|
+
export type FocusManagementViolationType = 'outline-none' | 'missing-focus-indicator';
|
|
10
|
+
export interface FocusManagementPatternInfo {
|
|
11
|
+
type: FocusManagementPatternType;
|
|
12
|
+
file: string;
|
|
13
|
+
line: number;
|
|
14
|
+
column: number;
|
|
15
|
+
matchedText: string;
|
|
16
|
+
context?: string | undefined;
|
|
17
|
+
}
|
|
18
|
+
export interface FocusManagementViolationInfo {
|
|
19
|
+
type: FocusManagementViolationType;
|
|
20
|
+
file: string;
|
|
21
|
+
line: number;
|
|
22
|
+
column: number;
|
|
23
|
+
matchedText: string;
|
|
24
|
+
issue: string;
|
|
25
|
+
suggestedFix?: string | undefined;
|
|
26
|
+
severity: 'high' | 'medium' | 'low';
|
|
27
|
+
}
|
|
28
|
+
export interface FocusManagementAnalysis {
|
|
29
|
+
patterns: FocusManagementPatternInfo[];
|
|
30
|
+
violations: FocusManagementViolationInfo[];
|
|
31
|
+
focusPatternCount: number;
|
|
32
|
+
hasFocusVisible: boolean;
|
|
33
|
+
confidence: number;
|
|
34
|
+
}
|
|
35
|
+
export declare const FOCUS_VISIBLE_PATTERNS: readonly [RegExp, RegExp, RegExp];
|
|
36
|
+
export declare const FOCUS_WITHIN_PATTERNS: readonly [RegExp, RegExp];
|
|
37
|
+
export declare const USE_FOCUS_PATTERNS: readonly [RegExp, RegExp, RegExp];
|
|
38
|
+
export declare const AUTO_FOCUS_PATTERNS: readonly [RegExp, RegExp];
|
|
39
|
+
export declare const FOCUS_REF_PATTERNS: readonly [RegExp, RegExp, RegExp];
|
|
40
|
+
export declare const FOCUS_RING_PATTERNS: readonly [RegExp, RegExp, RegExp];
|
|
41
|
+
export declare const OUTLINE_NONE_PATTERNS: readonly [RegExp, RegExp, RegExp];
|
|
42
|
+
export declare function shouldExcludeFile(filePath: string): boolean;
|
|
43
|
+
export declare function detectFocusVisible(content: string, filePath: string): FocusManagementPatternInfo[];
|
|
44
|
+
export declare function detectFocusWithin(content: string, filePath: string): FocusManagementPatternInfo[];
|
|
45
|
+
export declare function detectUseFocus(content: string, filePath: string): FocusManagementPatternInfo[];
|
|
46
|
+
export declare function detectAutoFocus(content: string, filePath: string): FocusManagementPatternInfo[];
|
|
47
|
+
export declare function detectFocusRef(content: string, filePath: string): FocusManagementPatternInfo[];
|
|
48
|
+
export declare function detectFocusRing(content: string, filePath: string): FocusManagementPatternInfo[];
|
|
49
|
+
export declare function detectOutlineNoneViolations(content: string, filePath: string): FocusManagementViolationInfo[];
|
|
50
|
+
export declare function analyzeFocusManagement(content: string, filePath: string): FocusManagementAnalysis;
|
|
51
|
+
export declare class FocusManagementDetector extends RegexDetector {
|
|
52
|
+
readonly id = "accessibility/focus-management";
|
|
53
|
+
readonly name = "Focus Management Detector";
|
|
54
|
+
readonly description = "Detects focus management patterns";
|
|
55
|
+
readonly category: PatternCategory;
|
|
56
|
+
readonly subcategory = "focus-management";
|
|
57
|
+
readonly supportedLanguages: Language[];
|
|
58
|
+
detect(context: DetectionContext): Promise<DetectionResult>;
|
|
59
|
+
generateQuickFix(_violation: Violation): QuickFix | null;
|
|
60
|
+
}
|
|
61
|
+
export declare function createFocusManagementDetector(): FocusManagementDetector;
|
|
62
|
+
//# sourceMappingURL=focus-management.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"focus-management.d.ts","sourceRoot":"","sources":["../../src/accessibility/focus-management.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACvF,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAElF,MAAM,MAAM,0BAA0B,GAAG,eAAe,GAAG,cAAc,GAAG,WAAW,GAAG,YAAY,GAAG,WAAW,GAAG,YAAY,CAAC;AACpI,MAAM,MAAM,4BAA4B,GAAG,cAAc,GAAG,yBAAyB,CAAC;AAEtF,MAAM,WAAW,0BAA0B;IAAG,IAAI,EAAE,0BAA0B,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAAE;AAChL,MAAM,WAAW,4BAA4B;IAAG,IAAI,EAAE,4BAA4B,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,QAAQ,EAAE,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;CAAE;AAC7O,MAAM,WAAW,uBAAuB;IAAG,QAAQ,EAAE,0BAA0B,EAAE,CAAC;IAAC,UAAU,EAAE,4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AE,MAAM,GAAG,uBAAuB,CAQjG;AAED,qBAAa,uBAAwB,SAAQ,aAAa;IACxD,QAAQ,CAAC,EAAE,oCAAoC;IAC/C,QAAQ,CAAC,IAAI,+BAA+B;IAC5C,QAAQ,CAAC,WAAW,uCAAuC;IAC3D,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAmB;IACrD,QAAQ,CAAC,WAAW,sBAAsB;IAC1C,QAAQ,CAAC,kBAAkB,EAAE,QAAQ,EAAE,CAAgC;IAEjE,MAAM,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC;IAOjE,gBAAgB,CAAC,UAAU,EAAE,SAAS,GAAG,QAAQ,GAAG,IAAI;CACzD;AAED,wBAAgB,6BAA6B,IAAI,uBAAuB,CAA0C"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Focus Management Detector - Focus management pattern detection
|
|
3
|
+
* @requirements 20.4 - Focus management patterns
|
|
4
|
+
*/
|
|
5
|
+
import { RegexDetector } from '../base/regex-detector.js';
|
|
6
|
+
export const FOCUS_VISIBLE_PATTERNS = [/:focus-visible/g, /focus-visible:/g, /focusVisible/g];
|
|
7
|
+
export const FOCUS_WITHIN_PATTERNS = [/:focus-within/g, /focus-within:/g];
|
|
8
|
+
export const USE_FOCUS_PATTERNS = [/useFocus\s*\(/g, /useFocusRing/g, /useFocusWithin/g];
|
|
9
|
+
export const AUTO_FOCUS_PATTERNS = [/autoFocus/g, /autofocus/g];
|
|
10
|
+
export const FOCUS_REF_PATTERNS = [/\.focus\s*\(\)/g, /ref\.current\.focus/g, /focusRef/g];
|
|
11
|
+
export const FOCUS_RING_PATTERNS = [/ring-/g, /focus:ring/g, /focus-ring/g];
|
|
12
|
+
export const OUTLINE_NONE_PATTERNS = [/outline:\s*none/gi, /outline:\s*0/gi, /outline-none/g];
|
|
13
|
+
export function shouldExcludeFile(filePath) {
|
|
14
|
+
return [/\.test\.[jt]sx?$/, /\.spec\.[jt]sx?$/, /__tests__\//, /node_modules\//, /\.min\.[jt]s$/].some((p) => p.test(filePath));
|
|
15
|
+
}
|
|
16
|
+
function detectPatterns(content, filePath, patterns, type) {
|
|
17
|
+
const results = [];
|
|
18
|
+
const lines = content.split('\n');
|
|
19
|
+
for (let i = 0; i < lines.length; i++) {
|
|
20
|
+
const line = lines[i];
|
|
21
|
+
for (const pattern of patterns) {
|
|
22
|
+
const regex = new RegExp(pattern.source, pattern.flags);
|
|
23
|
+
let match;
|
|
24
|
+
while ((match = regex.exec(line)) !== null) {
|
|
25
|
+
results.push({ type, file: filePath, line: i + 1, column: match.index + 1, matchedText: match[0], context: line.trim() });
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return results;
|
|
30
|
+
}
|
|
31
|
+
export function detectFocusVisible(content, filePath) { return detectPatterns(content, filePath, FOCUS_VISIBLE_PATTERNS, 'focus-visible'); }
|
|
32
|
+
export function detectFocusWithin(content, filePath) { return detectPatterns(content, filePath, FOCUS_WITHIN_PATTERNS, 'focus-within'); }
|
|
33
|
+
export function detectUseFocus(content, filePath) { return detectPatterns(content, filePath, USE_FOCUS_PATTERNS, 'use-focus'); }
|
|
34
|
+
export function detectAutoFocus(content, filePath) { return detectPatterns(content, filePath, AUTO_FOCUS_PATTERNS, 'auto-focus'); }
|
|
35
|
+
export function detectFocusRef(content, filePath) { return detectPatterns(content, filePath, FOCUS_REF_PATTERNS, 'focus-ref'); }
|
|
36
|
+
export function detectFocusRing(content, filePath) { return detectPatterns(content, filePath, FOCUS_RING_PATTERNS, 'focus-ring'); }
|
|
37
|
+
export function detectOutlineNoneViolations(content, filePath) {
|
|
38
|
+
const results = [];
|
|
39
|
+
const lines = content.split('\n');
|
|
40
|
+
for (let i = 0; i < lines.length; i++) {
|
|
41
|
+
const line = lines[i];
|
|
42
|
+
// Skip if line has focus-visible replacement
|
|
43
|
+
if (/focus-visible|focus:ring/.test(line))
|
|
44
|
+
continue;
|
|
45
|
+
for (const pattern of OUTLINE_NONE_PATTERNS) {
|
|
46
|
+
const regex = new RegExp(pattern.source, pattern.flags);
|
|
47
|
+
let match;
|
|
48
|
+
while ((match = regex.exec(line)) !== null) {
|
|
49
|
+
results.push({ type: 'outline-none', file: filePath, line: i + 1, column: match.index + 1, matchedText: match[0], issue: 'Removing outline without alternative focus indicator', suggestedFix: 'Use focus-visible or custom focus ring instead', severity: 'high' });
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return results;
|
|
54
|
+
}
|
|
55
|
+
export function analyzeFocusManagement(content, filePath) {
|
|
56
|
+
if (shouldExcludeFile(filePath))
|
|
57
|
+
return { patterns: [], violations: [], focusPatternCount: 0, hasFocusVisible: false, confidence: 1.0 };
|
|
58
|
+
const patterns = [...detectFocusVisible(content, filePath), ...detectFocusWithin(content, filePath), ...detectUseFocus(content, filePath), ...detectAutoFocus(content, filePath), ...detectFocusRef(content, filePath), ...detectFocusRing(content, filePath)];
|
|
59
|
+
const violations = [...detectOutlineNoneViolations(content, filePath)];
|
|
60
|
+
const focusPatternCount = patterns.length;
|
|
61
|
+
const hasFocusVisible = patterns.some((p) => p.type === 'focus-visible');
|
|
62
|
+
let confidence = 0.7;
|
|
63
|
+
if (patterns.length > 0)
|
|
64
|
+
confidence += 0.15;
|
|
65
|
+
if (violations.length === 0)
|
|
66
|
+
confidence += 0.1;
|
|
67
|
+
confidence = Math.min(confidence, 0.95);
|
|
68
|
+
return { patterns, violations, focusPatternCount, hasFocusVisible, confidence };
|
|
69
|
+
}
|
|
70
|
+
export class FocusManagementDetector extends RegexDetector {
|
|
71
|
+
id = 'accessibility/focus-management';
|
|
72
|
+
name = 'Focus Management Detector';
|
|
73
|
+
description = 'Detects focus management patterns';
|
|
74
|
+
category = 'accessibility';
|
|
75
|
+
subcategory = 'focus-management';
|
|
76
|
+
supportedLanguages = ['typescript', 'javascript'];
|
|
77
|
+
async detect(context) {
|
|
78
|
+
if (!this.supportsLanguage(context.language))
|
|
79
|
+
return this.createEmptyResult();
|
|
80
|
+
const analysis = analyzeFocusManagement(context.content, context.file);
|
|
81
|
+
if (analysis.patterns.length === 0 && analysis.violations.length === 0)
|
|
82
|
+
return this.createEmptyResult();
|
|
83
|
+
return this.createResult([], [], analysis.confidence, { custom: { patterns: analysis.patterns, violations: analysis.violations, focusPatternCount: analysis.focusPatternCount, hasFocusVisible: analysis.hasFocusVisible } });
|
|
84
|
+
}
|
|
85
|
+
generateQuickFix(_violation) { return null; }
|
|
86
|
+
}
|
|
87
|
+
export function createFocusManagementDetector() { return new FocusManagementDetector(); }
|
|
88
|
+
//# sourceMappingURL=focus-management.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"focus-management.js","sourceRoot":"","sources":["../../src/accessibility/focus-management.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAU1D,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,iBAAiB,EAAE,iBAAiB,EAAE,eAAe,CAAU,CAAC;AACvG,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,gBAAgB,EAAE,gBAAgB,CAAU,CAAC;AACnF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,gBAAgB,EAAE,eAAe,EAAE,iBAAiB,CAAU,CAAC;AAClG,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,YAAY,EAAE,YAAY,CAAU,CAAC;AACzE,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,iBAAiB,EAAE,sBAAsB,EAAE,WAAW,CAAU,CAAC;AACpG,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,QAAQ,EAAE,aAAa,EAAE,aAAa,CAAU,CAAC;AACrF,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,mBAAmB,EAAE,gBAAgB,EAAE,eAAe,CAAU,CAAC;AAEvG,MAAM,UAAU,iBAAiB,CAAC,QAAgB;IAChD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AAE,QAAQ,CAAC,UAAU,EAAE,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAAE,UAAU,EAAE,QAAQ,CAAC,UAAU,EAAE,iBAAiB,EAAE,QAAQ,CAAC,iBAAiB,EAAE,eAAe,EAAE,QAAQ,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;IAChO,CAAC;IAED,gBAAgB,CAAC,UAAqB,IAAqB,OAAO,IAAI,CAAC,CAAC,CAAC;CAC1E;AAED,MAAM,UAAU,6BAA6B,KAA8B,OAAO,IAAI,uBAAuB,EAAE,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Heading Hierarchy Detector - Heading hierarchy pattern detection
|
|
3
|
+
* @requirements 20.5 - Heading hierarchy patterns
|
|
4
|
+
*/
|
|
5
|
+
import type { Violation, QuickFix, PatternCategory, Language } from 'driftdetect-core';
|
|
6
|
+
import { RegexDetector } from '../base/regex-detector.js';
|
|
7
|
+
import type { DetectionContext, DetectionResult } from '../base/base-detector.js';
|
|
8
|
+
export type HeadingHierarchyPatternType = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'heading-component';
|
|
9
|
+
export type HeadingHierarchyViolationType = 'skipped-heading' | 'multiple-h1' | 'empty-heading';
|
|
10
|
+
export interface HeadingHierarchyPatternInfo {
|
|
11
|
+
type: HeadingHierarchyPatternType;
|
|
12
|
+
file: string;
|
|
13
|
+
line: number;
|
|
14
|
+
column: number;
|
|
15
|
+
matchedText: string;
|
|
16
|
+
level?: number | undefined;
|
|
17
|
+
context?: string | undefined;
|
|
18
|
+
}
|
|
19
|
+
export interface HeadingHierarchyViolationInfo {
|
|
20
|
+
type: HeadingHierarchyViolationType;
|
|
21
|
+
file: string;
|
|
22
|
+
line: number;
|
|
23
|
+
column: number;
|
|
24
|
+
matchedText: string;
|
|
25
|
+
issue: string;
|
|
26
|
+
suggestedFix?: string | undefined;
|
|
27
|
+
severity: 'high' | 'medium' | 'low';
|
|
28
|
+
}
|
|
29
|
+
export interface HeadingHierarchyAnalysis {
|
|
30
|
+
patterns: HeadingHierarchyPatternInfo[];
|
|
31
|
+
violations: HeadingHierarchyViolationInfo[];
|
|
32
|
+
headingCount: number;
|
|
33
|
+
hasH1: boolean;
|
|
34
|
+
confidence: number;
|
|
35
|
+
}
|
|
36
|
+
export declare const H1_PATTERNS: readonly [RegExp, RegExp];
|
|
37
|
+
export declare const H2_PATTERNS: readonly [RegExp, RegExp];
|
|
38
|
+
export declare const H3_PATTERNS: readonly [RegExp, RegExp];
|
|
39
|
+
export declare const H4_PATTERNS: readonly [RegExp, RegExp];
|
|
40
|
+
export declare const H5_PATTERNS: readonly [RegExp, RegExp];
|
|
41
|
+
export declare const H6_PATTERNS: readonly [RegExp, RegExp];
|
|
42
|
+
export declare const HEADING_COMPONENT_PATTERNS: readonly [RegExp, RegExp];
|
|
43
|
+
export declare const EMPTY_HEADING_PATTERNS: readonly [RegExp];
|
|
44
|
+
export declare function shouldExcludeFile(filePath: string): boolean;
|
|
45
|
+
export declare function detectH1(content: string, filePath: string): HeadingHierarchyPatternInfo[];
|
|
46
|
+
export declare function detectH2(content: string, filePath: string): HeadingHierarchyPatternInfo[];
|
|
47
|
+
export declare function detectH3(content: string, filePath: string): HeadingHierarchyPatternInfo[];
|
|
48
|
+
export declare function detectH4(content: string, filePath: string): HeadingHierarchyPatternInfo[];
|
|
49
|
+
export declare function detectH5(content: string, filePath: string): HeadingHierarchyPatternInfo[];
|
|
50
|
+
export declare function detectH6(content: string, filePath: string): HeadingHierarchyPatternInfo[];
|
|
51
|
+
export declare function detectHeadingComponent(content: string, filePath: string): HeadingHierarchyPatternInfo[];
|
|
52
|
+
export declare function detectMultipleH1Violations(content: string, filePath: string): HeadingHierarchyViolationInfo[];
|
|
53
|
+
export declare function detectEmptyHeadingViolations(content: string, filePath: string): HeadingHierarchyViolationInfo[];
|
|
54
|
+
export declare function analyzeHeadingHierarchy(content: string, filePath: string): HeadingHierarchyAnalysis;
|
|
55
|
+
export declare class HeadingHierarchyDetector extends RegexDetector {
|
|
56
|
+
readonly id = "accessibility/heading-hierarchy";
|
|
57
|
+
readonly name = "Heading Hierarchy Detector";
|
|
58
|
+
readonly description = "Detects heading hierarchy patterns";
|
|
59
|
+
readonly category: PatternCategory;
|
|
60
|
+
readonly subcategory = "heading-hierarchy";
|
|
61
|
+
readonly supportedLanguages: Language[];
|
|
62
|
+
detect(context: DetectionContext): Promise<DetectionResult>;
|
|
63
|
+
generateQuickFix(_violation: Violation): QuickFix | null;
|
|
64
|
+
}
|
|
65
|
+
export declare function createHeadingHierarchyDetector(): HeadingHierarchyDetector;
|
|
66
|
+
//# sourceMappingURL=heading-hierarchy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"heading-hierarchy.d.ts","sourceRoot":"","sources":["../../src/accessibility/heading-hierarchy.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACvF,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAElF,MAAM,MAAM,2BAA2B,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,mBAAmB,CAAC;AACxG,MAAM,MAAM,6BAA6B,GAAG,iBAAiB,GAAG,aAAa,GAAG,eAAe,CAAC;AAEhG,MAAM,WAAW,2BAA2B;IAAG,IAAI,EAAE,2BAA2B,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,G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