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,714 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Z-Index Scale Detector - Z-index pattern consistency detection
|
|
3
|
+
*
|
|
4
|
+
* Detects z-index patterns including:
|
|
5
|
+
* - Standard z-index scale values (0, 10, 20, 30, 40, 50, auto)
|
|
6
|
+
* - Tailwind z-index classes (z-0, z-10, z-20, z-30, z-40, z-50, z-auto)
|
|
7
|
+
* - CSS z-index properties
|
|
8
|
+
* - Theme z-index usage
|
|
9
|
+
* - Arbitrary z-index values that don't follow a scale
|
|
10
|
+
* - Magic number z-index values (e.g., z-index: 9999, z-index: 999999)
|
|
11
|
+
*
|
|
12
|
+
* Flags inconsistent z-index usage:
|
|
13
|
+
* - Hardcoded arbitrary z-index values not on a standard scale
|
|
14
|
+
* - Magic number z-index values (very high values like 9999)
|
|
15
|
+
* - Tailwind arbitrary z-index values (z-[100])
|
|
16
|
+
*
|
|
17
|
+
* @requirements 9.7 - THE Styling_Detector SHALL detect z-index scale adherence
|
|
18
|
+
*/
|
|
19
|
+
import { RegexDetector } from '../base/index.js';
|
|
20
|
+
// ============================================================================
|
|
21
|
+
// Constants
|
|
22
|
+
// ============================================================================
|
|
23
|
+
/**
|
|
24
|
+
* Standard z-index scale values (Tailwind-like 10-based scale)
|
|
25
|
+
*/
|
|
26
|
+
export const Z_INDEX_SCALE = [0, 10, 20, 30, 40, 50];
|
|
27
|
+
/**
|
|
28
|
+
* Extended z-index scale values (common additional values)
|
|
29
|
+
*/
|
|
30
|
+
export const Z_INDEX_SCALE_EXTENDED = [0, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100];
|
|
31
|
+
/**
|
|
32
|
+
* Common semantic z-index values
|
|
33
|
+
*/
|
|
34
|
+
export const SEMANTIC_Z_INDEX_VALUES = {
|
|
35
|
+
base: 0,
|
|
36
|
+
dropdown: 10,
|
|
37
|
+
sticky: 20,
|
|
38
|
+
fixed: 30,
|
|
39
|
+
modalBackdrop: 40,
|
|
40
|
+
modal: 50,
|
|
41
|
+
popover: 60,
|
|
42
|
+
tooltip: 70,
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Magic number threshold - values above this are considered magic numbers
|
|
46
|
+
*/
|
|
47
|
+
export const MAGIC_NUMBER_THRESHOLD = 100;
|
|
48
|
+
/**
|
|
49
|
+
* Very high magic number threshold - values above this are definitely problematic
|
|
50
|
+
*/
|
|
51
|
+
export const HIGH_MAGIC_NUMBER_THRESHOLD = 999;
|
|
52
|
+
/**
|
|
53
|
+
* Tailwind z-index class patterns
|
|
54
|
+
* Matches: z-0, z-10, z-20, z-30, z-40, z-50, z-auto
|
|
55
|
+
*/
|
|
56
|
+
export const TAILWIND_Z_INDEX_PATTERN = /\bz-(\d+|auto)\b/g;
|
|
57
|
+
/**
|
|
58
|
+
* Tailwind arbitrary z-index value patterns (e.g., z-[100], z-[9999])
|
|
59
|
+
*/
|
|
60
|
+
export const TAILWIND_ARBITRARY_Z_INDEX_PATTERN = /\bz-\[(-?\d+)\]/g;
|
|
61
|
+
/**
|
|
62
|
+
* CSS custom property patterns for z-index
|
|
63
|
+
*/
|
|
64
|
+
export const CSS_Z_INDEX_PROPERTY_PATTERN = /var\(\s*--(?:z-index|zindex|z)[-_]?([a-zA-Z0-9_-]*)\s*(?:,\s*[^)]+)?\)/g;
|
|
65
|
+
/**
|
|
66
|
+
* Theme z-index object patterns
|
|
67
|
+
*/
|
|
68
|
+
export const THEME_Z_INDEX_PATTERNS = [
|
|
69
|
+
// theme.zIndex.*, theme.z.*
|
|
70
|
+
/theme\.(?:zIndex|z)\.([a-zA-Z0-9_.[\]]+)/g,
|
|
71
|
+
// ${theme.zIndex.*} in template literals
|
|
72
|
+
/\$\{theme\.(?:zIndex|z)\.([a-zA-Z0-9_.[\]]+)\}/g,
|
|
73
|
+
// props.theme.zIndex.*
|
|
74
|
+
/props\.theme\.(?:zIndex|z)\.([a-zA-Z0-9_.[\]]+)/g,
|
|
75
|
+
];
|
|
76
|
+
/**
|
|
77
|
+
* CSS z-index property pattern
|
|
78
|
+
* Matches: z-index: 10, zIndex: 10
|
|
79
|
+
*/
|
|
80
|
+
export const CSS_Z_INDEX_VALUE_PATTERN = /(?:z-index|zIndex)\s*:\s*(-?\d+|auto|inherit|initial|unset|revert)/gi;
|
|
81
|
+
/**
|
|
82
|
+
* Hardcoded z-index value pattern (in CSS or JS)
|
|
83
|
+
*/
|
|
84
|
+
export const HARDCODED_Z_INDEX_PATTERN = /(?:z-index|zIndex)\s*:\s*(-?\d+)\b/gi;
|
|
85
|
+
/**
|
|
86
|
+
* Allowed z-index values (common exceptions)
|
|
87
|
+
*/
|
|
88
|
+
export const ALLOWED_Z_INDEX_VALUES = new Set([
|
|
89
|
+
'auto',
|
|
90
|
+
'inherit',
|
|
91
|
+
'initial',
|
|
92
|
+
'unset',
|
|
93
|
+
'revert',
|
|
94
|
+
'-1',
|
|
95
|
+
'0',
|
|
96
|
+
'1',
|
|
97
|
+
]);
|
|
98
|
+
/**
|
|
99
|
+
* File patterns to exclude from arbitrary z-index detection
|
|
100
|
+
*/
|
|
101
|
+
export const EXCLUDED_FILE_PATTERNS = [
|
|
102
|
+
/\.test\.[jt]sx?$/,
|
|
103
|
+
/\.spec\.[jt]sx?$/,
|
|
104
|
+
/\.stories\.[jt]sx?$/,
|
|
105
|
+
/design-tokens?\//,
|
|
106
|
+
/tokens?\//,
|
|
107
|
+
/theme\//,
|
|
108
|
+
/\.config\.[jt]s$/,
|
|
109
|
+
/tailwind\.config/,
|
|
110
|
+
];
|
|
111
|
+
// ============================================================================
|
|
112
|
+
// Helper Functions
|
|
113
|
+
// ============================================================================
|
|
114
|
+
/**
|
|
115
|
+
* Check if a file should be excluded from arbitrary z-index detection
|
|
116
|
+
*/
|
|
117
|
+
export function shouldExcludeFile(filePath) {
|
|
118
|
+
return EXCLUDED_FILE_PATTERNS.some(pattern => pattern.test(filePath));
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Check if a value is in the allowed z-index values list
|
|
122
|
+
*/
|
|
123
|
+
export function isAllowedZIndexValue(value) {
|
|
124
|
+
return ALLOWED_Z_INDEX_VALUES.has(value.toLowerCase().trim());
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Check if a z-index value is on the standard scale
|
|
128
|
+
*/
|
|
129
|
+
export function isOnZIndexScale(value) {
|
|
130
|
+
return Z_INDEX_SCALE.includes(value);
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Check if a z-index value is on the extended scale
|
|
134
|
+
*/
|
|
135
|
+
export function isOnExtendedZIndexScale(value) {
|
|
136
|
+
return Z_INDEX_SCALE_EXTENDED.includes(value);
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Check if a z-index value is a magic number
|
|
140
|
+
*/
|
|
141
|
+
export function isMagicNumber(value) {
|
|
142
|
+
const absValue = Math.abs(value);
|
|
143
|
+
return absValue > MAGIC_NUMBER_THRESHOLD && !isOnExtendedZIndexScale(absValue);
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Check if a z-index value is a very high magic number
|
|
147
|
+
*/
|
|
148
|
+
export function isHighMagicNumber(value) {
|
|
149
|
+
return Math.abs(value) > HIGH_MAGIC_NUMBER_THRESHOLD;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Find the nearest value on the z-index scale
|
|
153
|
+
*/
|
|
154
|
+
export function findNearestZIndexValue(value) {
|
|
155
|
+
const absValue = Math.abs(value);
|
|
156
|
+
let nearest = Z_INDEX_SCALE[0];
|
|
157
|
+
let minDiff = Math.abs(absValue - nearest);
|
|
158
|
+
for (const scaleValue of Z_INDEX_SCALE) {
|
|
159
|
+
const diff = Math.abs(absValue - scaleValue);
|
|
160
|
+
if (diff < minDiff) {
|
|
161
|
+
minDiff = diff;
|
|
162
|
+
nearest = scaleValue;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
// Handle the case where nearest is 0 - always return positive 0
|
|
166
|
+
if (nearest === 0) {
|
|
167
|
+
return 0;
|
|
168
|
+
}
|
|
169
|
+
return value < 0 ? -nearest : nearest;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Suggest a z-index scale value for an arbitrary value
|
|
173
|
+
*/
|
|
174
|
+
export function suggestZIndexValue(value) {
|
|
175
|
+
if (isHighMagicNumber(value)) {
|
|
176
|
+
return `Use a semantic z-index value (e.g., z-50 for modals) instead of ${value}`;
|
|
177
|
+
}
|
|
178
|
+
const nearest = findNearestZIndexValue(value);
|
|
179
|
+
if (value < 0) {
|
|
180
|
+
return `Use z-index: -1 or a CSS custom property like var(--z-index-below)`;
|
|
181
|
+
}
|
|
182
|
+
if (nearest === 0) {
|
|
183
|
+
return `Use z-0 or z-index: 0`;
|
|
184
|
+
}
|
|
185
|
+
return `Use z-${nearest} or z-index: ${nearest}`;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Check if a position is inside a comment
|
|
189
|
+
*/
|
|
190
|
+
function isInsideComment(content, index) {
|
|
191
|
+
const beforeIndex = content.slice(0, index);
|
|
192
|
+
// Check for single-line comment
|
|
193
|
+
const lastNewline = beforeIndex.lastIndexOf('\n');
|
|
194
|
+
const currentLine = beforeIndex.slice(lastNewline + 1);
|
|
195
|
+
if (currentLine.includes('//')) {
|
|
196
|
+
const commentStart = currentLine.indexOf('//');
|
|
197
|
+
const positionInLine = index - lastNewline - 1;
|
|
198
|
+
if (positionInLine > commentStart) {
|
|
199
|
+
return true;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
// Check for multi-line comment
|
|
203
|
+
const lastBlockCommentStart = beforeIndex.lastIndexOf('/*');
|
|
204
|
+
const lastBlockCommentEnd = beforeIndex.lastIndexOf('*/');
|
|
205
|
+
if (lastBlockCommentStart > lastBlockCommentEnd) {
|
|
206
|
+
return true;
|
|
207
|
+
}
|
|
208
|
+
return false;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Detect Tailwind z-index classes in content
|
|
212
|
+
*/
|
|
213
|
+
export function detectTailwindZIndex(content, file) {
|
|
214
|
+
const results = [];
|
|
215
|
+
const lines = content.split('\n');
|
|
216
|
+
const regex = new RegExp(TAILWIND_Z_INDEX_PATTERN.source, TAILWIND_Z_INDEX_PATTERN.flags);
|
|
217
|
+
let match;
|
|
218
|
+
while ((match = regex.exec(content)) !== null) {
|
|
219
|
+
// Skip if inside a comment
|
|
220
|
+
if (isInsideComment(content, match.index)) {
|
|
221
|
+
continue;
|
|
222
|
+
}
|
|
223
|
+
const beforeMatch = content.slice(0, match.index);
|
|
224
|
+
const lineNumber = beforeMatch.split('\n').length;
|
|
225
|
+
const lastNewline = beforeMatch.lastIndexOf('\n');
|
|
226
|
+
const column = match.index - lastNewline;
|
|
227
|
+
results.push({
|
|
228
|
+
type: 'tailwind-z-index',
|
|
229
|
+
file,
|
|
230
|
+
line: lineNumber,
|
|
231
|
+
column,
|
|
232
|
+
matchedText: match[0],
|
|
233
|
+
zIndexValue: match[1] || match[0],
|
|
234
|
+
context: lines[lineNumber - 1] || '',
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
return results;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Detect Tailwind arbitrary z-index values
|
|
241
|
+
*/
|
|
242
|
+
export function detectTailwindArbitraryZIndex(content, file) {
|
|
243
|
+
const results = [];
|
|
244
|
+
const lines = content.split('\n');
|
|
245
|
+
const regex = new RegExp(TAILWIND_ARBITRARY_Z_INDEX_PATTERN.source, TAILWIND_ARBITRARY_Z_INDEX_PATTERN.flags);
|
|
246
|
+
let match;
|
|
247
|
+
while ((match = regex.exec(content)) !== null) {
|
|
248
|
+
const value = match[1] || '';
|
|
249
|
+
const numericValue = parseInt(value, 10);
|
|
250
|
+
// Skip if inside a comment
|
|
251
|
+
if (isInsideComment(content, match.index)) {
|
|
252
|
+
continue;
|
|
253
|
+
}
|
|
254
|
+
const beforeMatch = content.slice(0, match.index);
|
|
255
|
+
const lineNumber = beforeMatch.split('\n').length;
|
|
256
|
+
const lastNewline = beforeMatch.lastIndexOf('\n');
|
|
257
|
+
const column = match.index - lastNewline;
|
|
258
|
+
const endColumn = column + match[0].length;
|
|
259
|
+
const type = isHighMagicNumber(numericValue)
|
|
260
|
+
? 'magic-number'
|
|
261
|
+
: numericValue < 0
|
|
262
|
+
? 'negative-arbitrary'
|
|
263
|
+
: 'tailwind-arbitrary';
|
|
264
|
+
results.push({
|
|
265
|
+
type,
|
|
266
|
+
file,
|
|
267
|
+
line: lineNumber,
|
|
268
|
+
column,
|
|
269
|
+
endLine: lineNumber,
|
|
270
|
+
endColumn,
|
|
271
|
+
value: match[0],
|
|
272
|
+
numericValue,
|
|
273
|
+
suggestedValue: suggestZIndexValue(numericValue),
|
|
274
|
+
lineContent: lines[lineNumber - 1] || '',
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
return results;
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Detect CSS custom property usage for z-index
|
|
281
|
+
*/
|
|
282
|
+
export function detectCSSZIndexProperties(content, file) {
|
|
283
|
+
const results = [];
|
|
284
|
+
const lines = content.split('\n');
|
|
285
|
+
const regex = new RegExp(CSS_Z_INDEX_PROPERTY_PATTERN.source, CSS_Z_INDEX_PROPERTY_PATTERN.flags);
|
|
286
|
+
let match;
|
|
287
|
+
while ((match = regex.exec(content)) !== null) {
|
|
288
|
+
// Skip if inside a comment
|
|
289
|
+
if (isInsideComment(content, match.index)) {
|
|
290
|
+
continue;
|
|
291
|
+
}
|
|
292
|
+
const beforeMatch = content.slice(0, match.index);
|
|
293
|
+
const lineNumber = beforeMatch.split('\n').length;
|
|
294
|
+
const lastNewline = beforeMatch.lastIndexOf('\n');
|
|
295
|
+
const column = match.index - lastNewline;
|
|
296
|
+
results.push({
|
|
297
|
+
type: 'css-z-index-property',
|
|
298
|
+
file,
|
|
299
|
+
line: lineNumber,
|
|
300
|
+
column,
|
|
301
|
+
matchedText: match[0],
|
|
302
|
+
zIndexValue: match[1] || '',
|
|
303
|
+
context: lines[lineNumber - 1] || '',
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
return results;
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Detect theme z-index object usage
|
|
310
|
+
*/
|
|
311
|
+
export function detectThemeZIndex(content, file) {
|
|
312
|
+
const results = [];
|
|
313
|
+
const lines = content.split('\n');
|
|
314
|
+
for (const pattern of THEME_Z_INDEX_PATTERNS) {
|
|
315
|
+
const regex = new RegExp(pattern.source, pattern.flags);
|
|
316
|
+
let match;
|
|
317
|
+
while ((match = regex.exec(content)) !== null) {
|
|
318
|
+
// Skip if inside a comment
|
|
319
|
+
if (isInsideComment(content, match.index)) {
|
|
320
|
+
continue;
|
|
321
|
+
}
|
|
322
|
+
const beforeMatch = content.slice(0, match.index);
|
|
323
|
+
const lineNumber = beforeMatch.split('\n').length;
|
|
324
|
+
const lastNewline = beforeMatch.lastIndexOf('\n');
|
|
325
|
+
const column = match.index - lastNewline;
|
|
326
|
+
results.push({
|
|
327
|
+
type: 'theme-z-index',
|
|
328
|
+
file,
|
|
329
|
+
line: lineNumber,
|
|
330
|
+
column,
|
|
331
|
+
matchedText: match[0],
|
|
332
|
+
zIndexValue: match[1] || match[0],
|
|
333
|
+
context: lines[lineNumber - 1] || '',
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
return results;
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Detect CSS z-index values (both valid and arbitrary)
|
|
341
|
+
*/
|
|
342
|
+
export function detectCSSZIndexValues(content, file) {
|
|
343
|
+
const patterns = [];
|
|
344
|
+
const arbitrary = [];
|
|
345
|
+
const lines = content.split('\n');
|
|
346
|
+
const regex = new RegExp(HARDCODED_Z_INDEX_PATTERN.source, HARDCODED_Z_INDEX_PATTERN.flags);
|
|
347
|
+
let match;
|
|
348
|
+
while ((match = regex.exec(content)) !== null) {
|
|
349
|
+
const value = match[1] || '';
|
|
350
|
+
// Skip allowed values
|
|
351
|
+
if (isAllowedZIndexValue(value)) {
|
|
352
|
+
continue;
|
|
353
|
+
}
|
|
354
|
+
// Skip if inside a comment
|
|
355
|
+
if (isInsideComment(content, match.index)) {
|
|
356
|
+
continue;
|
|
357
|
+
}
|
|
358
|
+
const beforeMatch = content.slice(0, match.index);
|
|
359
|
+
const lineNumber = beforeMatch.split('\n').length;
|
|
360
|
+
const lastNewline = beforeMatch.lastIndexOf('\n');
|
|
361
|
+
const column = match.index - lastNewline;
|
|
362
|
+
const lineContent = lines[lineNumber - 1] || '';
|
|
363
|
+
// Skip CSS custom property definitions
|
|
364
|
+
if (/^\s*--[a-zA-Z0-9_-]+\s*:/.test(lineContent)) {
|
|
365
|
+
continue;
|
|
366
|
+
}
|
|
367
|
+
const numericValue = parseInt(value, 10);
|
|
368
|
+
// Check if value is on scale
|
|
369
|
+
if (isOnExtendedZIndexScale(numericValue)) {
|
|
370
|
+
patterns.push({
|
|
371
|
+
type: 'css-z-index-value',
|
|
372
|
+
file,
|
|
373
|
+
line: lineNumber,
|
|
374
|
+
column,
|
|
375
|
+
matchedText: match[0],
|
|
376
|
+
zIndexValue: value,
|
|
377
|
+
context: lineContent,
|
|
378
|
+
});
|
|
379
|
+
}
|
|
380
|
+
else {
|
|
381
|
+
// Arbitrary value
|
|
382
|
+
const endColumn = column + match[0].length;
|
|
383
|
+
const type = isHighMagicNumber(numericValue)
|
|
384
|
+
? 'magic-number'
|
|
385
|
+
: numericValue < 0
|
|
386
|
+
? 'negative-arbitrary'
|
|
387
|
+
: 'arbitrary-value';
|
|
388
|
+
arbitrary.push({
|
|
389
|
+
type,
|
|
390
|
+
file,
|
|
391
|
+
line: lineNumber,
|
|
392
|
+
column,
|
|
393
|
+
endLine: lineNumber,
|
|
394
|
+
endColumn,
|
|
395
|
+
value: match[0],
|
|
396
|
+
numericValue,
|
|
397
|
+
suggestedValue: suggestZIndexValue(numericValue),
|
|
398
|
+
lineContent,
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
return { patterns, arbitrary };
|
|
403
|
+
}
|
|
404
|
+
/**
|
|
405
|
+
* Analyze z-index scale patterns in a file
|
|
406
|
+
*/
|
|
407
|
+
export function analyzeZIndexScale(content, file) {
|
|
408
|
+
// Skip excluded files for arbitrary value detection
|
|
409
|
+
const skipArbitraryDetection = shouldExcludeFile(file);
|
|
410
|
+
// Detect z-index patterns
|
|
411
|
+
const tailwindZIndex = detectTailwindZIndex(content, file);
|
|
412
|
+
const cssZIndexProperties = detectCSSZIndexProperties(content, file);
|
|
413
|
+
const themeZIndex = detectThemeZIndex(content, file);
|
|
414
|
+
const cssZIndexResult = detectCSSZIndexValues(content, file);
|
|
415
|
+
const zIndexPatterns = [
|
|
416
|
+
...tailwindZIndex,
|
|
417
|
+
...cssZIndexProperties,
|
|
418
|
+
...themeZIndex,
|
|
419
|
+
...cssZIndexResult.patterns,
|
|
420
|
+
];
|
|
421
|
+
// Detect arbitrary values (unless file is excluded)
|
|
422
|
+
let arbitraryValues = [];
|
|
423
|
+
if (!skipArbitraryDetection) {
|
|
424
|
+
const tailwindArbitrary = detectTailwindArbitraryZIndex(content, file);
|
|
425
|
+
arbitraryValues = [...tailwindArbitrary, ...cssZIndexResult.arbitrary];
|
|
426
|
+
}
|
|
427
|
+
// Calculate confidence
|
|
428
|
+
const hasZIndexPatterns = zIndexPatterns.length > 0;
|
|
429
|
+
const hasArbitraryValues = arbitraryValues.length > 0;
|
|
430
|
+
let scaleAdherenceConfidence = 0;
|
|
431
|
+
if (hasZIndexPatterns && !hasArbitraryValues) {
|
|
432
|
+
scaleAdherenceConfidence = 1.0;
|
|
433
|
+
}
|
|
434
|
+
else if (hasZIndexPatterns && hasArbitraryValues) {
|
|
435
|
+
const ratio = zIndexPatterns.length / (zIndexPatterns.length + arbitraryValues.length);
|
|
436
|
+
scaleAdherenceConfidence = ratio;
|
|
437
|
+
}
|
|
438
|
+
else if (!hasZIndexPatterns && hasArbitraryValues) {
|
|
439
|
+
scaleAdherenceConfidence = 0;
|
|
440
|
+
}
|
|
441
|
+
else {
|
|
442
|
+
scaleAdherenceConfidence = 0.5; // No z-index detected
|
|
443
|
+
}
|
|
444
|
+
return {
|
|
445
|
+
zIndexPatterns,
|
|
446
|
+
arbitraryValues,
|
|
447
|
+
usesTailwindZIndex: tailwindZIndex.length > 0,
|
|
448
|
+
usesCSSZIndexProperties: cssZIndexProperties.length > 0,
|
|
449
|
+
usesThemeZIndex: themeZIndex.length > 0,
|
|
450
|
+
usesCSSZIndex: cssZIndexResult.patterns.length > 0,
|
|
451
|
+
scaleAdherenceConfidence,
|
|
452
|
+
};
|
|
453
|
+
}
|
|
454
|
+
// ============================================================================
|
|
455
|
+
// Z-Index Scale Detector Class
|
|
456
|
+
// ============================================================================
|
|
457
|
+
/**
|
|
458
|
+
* Detector for z-index scale adherence patterns
|
|
459
|
+
*
|
|
460
|
+
* Identifies consistent z-index patterns and flags arbitrary values
|
|
461
|
+
* that don't follow the established scale.
|
|
462
|
+
*
|
|
463
|
+
* @requirements 9.7 - THE Styling_Detector SHALL detect z-index scale adherence
|
|
464
|
+
*/
|
|
465
|
+
export class ZIndexScaleDetector extends RegexDetector {
|
|
466
|
+
id = 'styling/z-index-scale';
|
|
467
|
+
category = 'styling';
|
|
468
|
+
subcategory = 'z-index-scale';
|
|
469
|
+
name = 'Z-Index Scale Detector';
|
|
470
|
+
description = 'Detects z-index scale adherence and flags arbitrary z-index values and magic numbers';
|
|
471
|
+
supportedLanguages = ['typescript', 'javascript', 'css'];
|
|
472
|
+
/**
|
|
473
|
+
* Detect z-index scale patterns and violations
|
|
474
|
+
*/
|
|
475
|
+
async detect(context) {
|
|
476
|
+
const patterns = [];
|
|
477
|
+
const violations = [];
|
|
478
|
+
// Analyze the file
|
|
479
|
+
const analysis = analyzeZIndexScale(context.content, context.file);
|
|
480
|
+
// Create pattern matches for z-index patterns
|
|
481
|
+
if (analysis.usesTailwindZIndex) {
|
|
482
|
+
patterns.push(this.createTailwindZIndexPattern(context.file, analysis));
|
|
483
|
+
}
|
|
484
|
+
if (analysis.usesCSSZIndexProperties) {
|
|
485
|
+
patterns.push(this.createCSSZIndexPropertyPattern(context.file, analysis));
|
|
486
|
+
}
|
|
487
|
+
if (analysis.usesThemeZIndex) {
|
|
488
|
+
patterns.push(this.createThemeZIndexPattern(context.file, analysis));
|
|
489
|
+
}
|
|
490
|
+
if (analysis.usesCSSZIndex) {
|
|
491
|
+
patterns.push(this.createCSSZIndexPattern(context.file, analysis));
|
|
492
|
+
}
|
|
493
|
+
// Create violations for arbitrary values
|
|
494
|
+
for (const arbitrary of analysis.arbitraryValues) {
|
|
495
|
+
violations.push(this.createArbitraryValueViolation(arbitrary));
|
|
496
|
+
}
|
|
497
|
+
return this.createResult(patterns, violations, analysis.scaleAdherenceConfidence);
|
|
498
|
+
}
|
|
499
|
+
/**
|
|
500
|
+
* Create a pattern match for Tailwind z-index usage
|
|
501
|
+
*/
|
|
502
|
+
createTailwindZIndexPattern(file, analysis) {
|
|
503
|
+
const tailwindPatterns = analysis.zIndexPatterns.filter(p => p.type === 'tailwind-z-index');
|
|
504
|
+
const firstPattern = tailwindPatterns[0];
|
|
505
|
+
return {
|
|
506
|
+
patternId: `${this.id}/tailwind`,
|
|
507
|
+
location: {
|
|
508
|
+
file,
|
|
509
|
+
line: firstPattern?.line || 1,
|
|
510
|
+
column: firstPattern?.column || 1,
|
|
511
|
+
},
|
|
512
|
+
confidence: 1.0,
|
|
513
|
+
isOutlier: false,
|
|
514
|
+
};
|
|
515
|
+
}
|
|
516
|
+
/**
|
|
517
|
+
* Create a pattern match for CSS z-index property usage
|
|
518
|
+
*/
|
|
519
|
+
createCSSZIndexPropertyPattern(file, analysis) {
|
|
520
|
+
const cssPatterns = analysis.zIndexPatterns.filter(p => p.type === 'css-z-index-property');
|
|
521
|
+
const firstPattern = cssPatterns[0];
|
|
522
|
+
return {
|
|
523
|
+
patternId: `${this.id}/css-property`,
|
|
524
|
+
location: {
|
|
525
|
+
file,
|
|
526
|
+
line: firstPattern?.line || 1,
|
|
527
|
+
column: firstPattern?.column || 1,
|
|
528
|
+
},
|
|
529
|
+
confidence: 1.0,
|
|
530
|
+
isOutlier: false,
|
|
531
|
+
};
|
|
532
|
+
}
|
|
533
|
+
/**
|
|
534
|
+
* Create a pattern match for theme z-index usage
|
|
535
|
+
*/
|
|
536
|
+
createThemeZIndexPattern(file, analysis) {
|
|
537
|
+
const themePatterns = analysis.zIndexPatterns.filter(p => p.type === 'theme-z-index');
|
|
538
|
+
const firstPattern = themePatterns[0];
|
|
539
|
+
return {
|
|
540
|
+
patternId: `${this.id}/theme`,
|
|
541
|
+
location: {
|
|
542
|
+
file,
|
|
543
|
+
line: firstPattern?.line || 1,
|
|
544
|
+
column: firstPattern?.column || 1,
|
|
545
|
+
},
|
|
546
|
+
confidence: 1.0,
|
|
547
|
+
isOutlier: false,
|
|
548
|
+
};
|
|
549
|
+
}
|
|
550
|
+
/**
|
|
551
|
+
* Create a pattern match for CSS z-index value usage
|
|
552
|
+
*/
|
|
553
|
+
createCSSZIndexPattern(file, analysis) {
|
|
554
|
+
const cssPatterns = analysis.zIndexPatterns.filter(p => p.type === 'css-z-index-value');
|
|
555
|
+
const firstPattern = cssPatterns[0];
|
|
556
|
+
return {
|
|
557
|
+
patternId: `${this.id}/css-value`,
|
|
558
|
+
location: {
|
|
559
|
+
file,
|
|
560
|
+
line: firstPattern?.line || 1,
|
|
561
|
+
column: firstPattern?.column || 1,
|
|
562
|
+
},
|
|
563
|
+
confidence: 1.0,
|
|
564
|
+
isOutlier: false,
|
|
565
|
+
};
|
|
566
|
+
}
|
|
567
|
+
/**
|
|
568
|
+
* Create a violation for an arbitrary z-index value
|
|
569
|
+
*/
|
|
570
|
+
createArbitraryValueViolation(arbitrary) {
|
|
571
|
+
const typeDescriptions = {
|
|
572
|
+
'arbitrary-value': 'arbitrary z-index value',
|
|
573
|
+
'magic-number': 'magic number z-index',
|
|
574
|
+
'tailwind-arbitrary': 'Tailwind arbitrary z-index',
|
|
575
|
+
'negative-arbitrary': 'arbitrary negative z-index',
|
|
576
|
+
};
|
|
577
|
+
const typeDescription = typeDescriptions[arbitrary.type] || 'arbitrary z-index';
|
|
578
|
+
const severity = arbitrary.type === 'magic-number' ? 'error' : 'warning';
|
|
579
|
+
const violation = {
|
|
580
|
+
id: `${this.id}-${arbitrary.file}-${arbitrary.line}-${arbitrary.column}`,
|
|
581
|
+
patternId: this.id,
|
|
582
|
+
severity,
|
|
583
|
+
file: arbitrary.file,
|
|
584
|
+
range: {
|
|
585
|
+
start: { line: arbitrary.line - 1, character: arbitrary.column - 1 },
|
|
586
|
+
end: { line: arbitrary.endLine - 1, character: arbitrary.endColumn - 1 },
|
|
587
|
+
},
|
|
588
|
+
message: `${typeDescription.charAt(0).toUpperCase() + typeDescription.slice(1)} '${arbitrary.value}' doesn't follow the z-index scale`,
|
|
589
|
+
explanation: this.getExplanation(arbitrary),
|
|
590
|
+
expected: arbitrary.suggestedValue || 'A z-index scale value (0, 10, 20, 30, 40, 50)',
|
|
591
|
+
actual: arbitrary.value,
|
|
592
|
+
aiExplainAvailable: true,
|
|
593
|
+
aiFixAvailable: true,
|
|
594
|
+
firstSeen: new Date(),
|
|
595
|
+
occurrences: 1,
|
|
596
|
+
};
|
|
597
|
+
const quickFix = this.createQuickFixForArbitraryValue(arbitrary);
|
|
598
|
+
if (quickFix !== undefined) {
|
|
599
|
+
violation.quickFix = quickFix;
|
|
600
|
+
}
|
|
601
|
+
return violation;
|
|
602
|
+
}
|
|
603
|
+
/**
|
|
604
|
+
* Get explanation for a z-index violation
|
|
605
|
+
*/
|
|
606
|
+
getExplanation(arbitrary) {
|
|
607
|
+
if (arbitrary.type === 'magic-number') {
|
|
608
|
+
return `Using magic number z-index values like ${arbitrary.numericValue} creates maintenance problems and z-index wars. Use a semantic z-index scale (0, 10, 20, 30, 40, 50) or CSS custom properties to maintain consistent stacking contexts.`;
|
|
609
|
+
}
|
|
610
|
+
if (arbitrary.type === 'negative-arbitrary') {
|
|
611
|
+
return `Arbitrary negative z-index values can cause unexpected stacking behavior. Use z-index: -1 for elements that should appear behind their parent, or use CSS custom properties for consistent negative z-index values.`;
|
|
612
|
+
}
|
|
613
|
+
if (arbitrary.type === 'tailwind-arbitrary') {
|
|
614
|
+
return `Using Tailwind arbitrary z-index values (z-[${arbitrary.numericValue}]) bypasses the design system. Use standard Tailwind z-index classes (z-0, z-10, z-20, z-30, z-40, z-50, z-auto) for consistent stacking.`;
|
|
615
|
+
}
|
|
616
|
+
return `Using arbitrary z-index values instead of scale-based values makes it difficult to maintain consistent stacking contexts across the application. Use values from your z-index scale (0, 10, 20, 30, 40, 50) or CSS custom properties.`;
|
|
617
|
+
}
|
|
618
|
+
/**
|
|
619
|
+
* Create a quick fix for replacing an arbitrary value with a scale value
|
|
620
|
+
*/
|
|
621
|
+
createQuickFixForArbitraryValue(arbitrary) {
|
|
622
|
+
// Only provide quick fix if we have a numeric value
|
|
623
|
+
if (arbitrary.numericValue === undefined) {
|
|
624
|
+
return undefined;
|
|
625
|
+
}
|
|
626
|
+
const nearest = findNearestZIndexValue(arbitrary.numericValue);
|
|
627
|
+
let replacement;
|
|
628
|
+
if (arbitrary.type === 'tailwind-arbitrary') {
|
|
629
|
+
// For Tailwind arbitrary values, suggest the standard class
|
|
630
|
+
replacement = nearest === 0 ? 'z-0' : `z-${nearest}`;
|
|
631
|
+
}
|
|
632
|
+
else {
|
|
633
|
+
// For CSS values, use the nearest scale value
|
|
634
|
+
replacement = `z-index: ${nearest}`;
|
|
635
|
+
}
|
|
636
|
+
return {
|
|
637
|
+
title: `Replace with scale value: ${replacement}`,
|
|
638
|
+
kind: 'quickfix',
|
|
639
|
+
edit: {
|
|
640
|
+
changes: {
|
|
641
|
+
[arbitrary.file]: [
|
|
642
|
+
{
|
|
643
|
+
range: {
|
|
644
|
+
start: { line: arbitrary.line - 1, character: arbitrary.column - 1 },
|
|
645
|
+
end: { line: arbitrary.endLine - 1, character: arbitrary.endColumn - 1 },
|
|
646
|
+
},
|
|
647
|
+
newText: replacement,
|
|
648
|
+
},
|
|
649
|
+
],
|
|
650
|
+
},
|
|
651
|
+
},
|
|
652
|
+
isPreferred: true,
|
|
653
|
+
confidence: 0.7,
|
|
654
|
+
preview: `Replace '${arbitrary.value}' with '${replacement}'`,
|
|
655
|
+
};
|
|
656
|
+
}
|
|
657
|
+
/**
|
|
658
|
+
* Generate a quick fix for a violation
|
|
659
|
+
*/
|
|
660
|
+
generateQuickFix(violation) {
|
|
661
|
+
// Check if this is a z-index violation
|
|
662
|
+
if (!violation.message.includes('z-index')) {
|
|
663
|
+
return null;
|
|
664
|
+
}
|
|
665
|
+
// Extract the value from the message
|
|
666
|
+
const valueMatch = violation.message.match(/['"]([^'"]+)['"]/);
|
|
667
|
+
if (!valueMatch || !valueMatch[1]) {
|
|
668
|
+
return null;
|
|
669
|
+
}
|
|
670
|
+
const value = valueMatch[1];
|
|
671
|
+
// Try to extract numeric value
|
|
672
|
+
const numMatch = value.match(/-?\d+/);
|
|
673
|
+
if (!numMatch) {
|
|
674
|
+
return null;
|
|
675
|
+
}
|
|
676
|
+
const numericValue = parseInt(numMatch[0], 10);
|
|
677
|
+
const nearest = findNearestZIndexValue(numericValue);
|
|
678
|
+
// Determine replacement based on context
|
|
679
|
+
let replacement;
|
|
680
|
+
if (value.startsWith('z-[')) {
|
|
681
|
+
replacement = nearest === 0 ? 'z-0' : `z-${nearest}`;
|
|
682
|
+
}
|
|
683
|
+
else {
|
|
684
|
+
replacement = `z-index: ${nearest}`;
|
|
685
|
+
}
|
|
686
|
+
return {
|
|
687
|
+
title: `Replace with scale value: ${replacement}`,
|
|
688
|
+
kind: 'quickfix',
|
|
689
|
+
edit: {
|
|
690
|
+
changes: {
|
|
691
|
+
[violation.file]: [
|
|
692
|
+
{
|
|
693
|
+
range: violation.range,
|
|
694
|
+
newText: replacement,
|
|
695
|
+
},
|
|
696
|
+
],
|
|
697
|
+
},
|
|
698
|
+
},
|
|
699
|
+
isPreferred: true,
|
|
700
|
+
confidence: 0.7,
|
|
701
|
+
preview: `Replace '${value}' with '${replacement}'`,
|
|
702
|
+
};
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
// ============================================================================
|
|
706
|
+
// Factory Function
|
|
707
|
+
// ============================================================================
|
|
708
|
+
/**
|
|
709
|
+
* Create a new ZIndexScaleDetector instance
|
|
710
|
+
*/
|
|
711
|
+
export function createZIndexScaleDetector() {
|
|
712
|
+
return new ZIndexScaleDetector();
|
|
713
|
+
}
|
|
714
|
+
//# sourceMappingURL=z-index-scale.js.map
|