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,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* File Location Detector - Type file location pattern detection
|
|
3
|
+
*
|
|
4
|
+
* Detects type file organization patterns including:
|
|
5
|
+
* - Centralized types directories
|
|
6
|
+
* - Co-located type files
|
|
7
|
+
* - Barrel exports for types
|
|
8
|
+
* - Type-only modules
|
|
9
|
+
* - Declaration file patterns
|
|
10
|
+
*
|
|
11
|
+
* @requirements 18.1 - Type file location patterns
|
|
12
|
+
*/
|
|
13
|
+
import type { Violation, QuickFix, PatternCategory, Language } from 'driftdetect-core';
|
|
14
|
+
import { RegexDetector } from '../base/regex-detector.js';
|
|
15
|
+
import type { DetectionContext, DetectionResult } from '../base/base-detector.js';
|
|
16
|
+
export type FileLocationPatternType = 'centralized-types' | 'co-located-types' | 'barrel-export' | 'type-only-module' | 'declaration-file' | 'shared-types' | 'domain-types';
|
|
17
|
+
export type FileLocationViolationType = 'scattered-types' | 'missing-barrel' | 'inconsistent-location' | 'orphaned-types';
|
|
18
|
+
export interface FileLocationPatternInfo {
|
|
19
|
+
type: FileLocationPatternType;
|
|
20
|
+
file: string;
|
|
21
|
+
line: number;
|
|
22
|
+
column: number;
|
|
23
|
+
matchedText: string;
|
|
24
|
+
directory?: string | undefined;
|
|
25
|
+
context?: string | undefined;
|
|
26
|
+
}
|
|
27
|
+
export interface FileLocationViolationInfo {
|
|
28
|
+
type: FileLocationViolationType;
|
|
29
|
+
file: string;
|
|
30
|
+
line: number;
|
|
31
|
+
column: number;
|
|
32
|
+
matchedText: string;
|
|
33
|
+
issue: string;
|
|
34
|
+
suggestedFix?: string | undefined;
|
|
35
|
+
severity: 'high' | 'medium' | 'low';
|
|
36
|
+
}
|
|
37
|
+
export interface FileLocationAnalysis {
|
|
38
|
+
patterns: FileLocationPatternInfo[];
|
|
39
|
+
violations: FileLocationViolationInfo[];
|
|
40
|
+
hasCentralizedTypes: boolean;
|
|
41
|
+
hasCoLocatedTypes: boolean;
|
|
42
|
+
typeDirectories: string[];
|
|
43
|
+
confidence: number;
|
|
44
|
+
}
|
|
45
|
+
export declare const CENTRALIZED_TYPES_PATTERNS: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp];
|
|
46
|
+
export declare const CO_LOCATED_TYPES_PATTERNS: readonly [RegExp, RegExp, RegExp, RegExp];
|
|
47
|
+
export declare const BARREL_EXPORT_PATTERNS: readonly [RegExp, RegExp, RegExp, RegExp, RegExp];
|
|
48
|
+
export declare const TYPE_ONLY_MODULE_PATTERNS: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp];
|
|
49
|
+
export declare const DECLARATION_FILE_PATTERNS: readonly [RegExp, RegExp, RegExp, RegExp, RegExp, RegExp, RegExp];
|
|
50
|
+
export declare const SHARED_TYPES_PATTERNS: readonly [RegExp, RegExp, RegExp, RegExp, RegExp];
|
|
51
|
+
export declare const DOMAIN_TYPES_PATTERNS: readonly [RegExp, RegExp, RegExp, RegExp];
|
|
52
|
+
export declare const SCATTERED_TYPES_PATTERNS: readonly [RegExp, RegExp];
|
|
53
|
+
export declare function shouldExcludeFile(filePath: string): boolean;
|
|
54
|
+
export declare function isTypeFile(filePath: string): boolean;
|
|
55
|
+
export declare function detectCentralizedTypes(content: string, filePath: string): FileLocationPatternInfo[];
|
|
56
|
+
export declare function detectCoLocatedTypes(content: string, filePath: string): FileLocationPatternInfo[];
|
|
57
|
+
export declare function detectBarrelExports(content: string, filePath: string): FileLocationPatternInfo[];
|
|
58
|
+
export declare function detectTypeOnlyModule(content: string, filePath: string): FileLocationPatternInfo[];
|
|
59
|
+
export declare function detectDeclarationFile(content: string, filePath: string): FileLocationPatternInfo[];
|
|
60
|
+
export declare function detectSharedTypes(content: string, filePath: string): FileLocationPatternInfo[];
|
|
61
|
+
export declare function detectDomainTypes(content: string, filePath: string): FileLocationPatternInfo[];
|
|
62
|
+
export declare function detectScatteredTypesViolations(content: string, filePath: string): FileLocationViolationInfo[];
|
|
63
|
+
export declare function detectInconsistentLocationViolations(content: string, filePath: string): FileLocationViolationInfo[];
|
|
64
|
+
export declare function analyzeFileLocation(content: string, filePath: string): FileLocationAnalysis;
|
|
65
|
+
export declare class FileLocationDetector extends RegexDetector {
|
|
66
|
+
readonly id = "types/file-location";
|
|
67
|
+
readonly name = "File Location Detector";
|
|
68
|
+
readonly description = "Detects type file organization patterns and identifies scattered types";
|
|
69
|
+
readonly category: PatternCategory;
|
|
70
|
+
readonly subcategory = "file-location";
|
|
71
|
+
readonly supportedLanguages: Language[];
|
|
72
|
+
detect(context: DetectionContext): Promise<DetectionResult>;
|
|
73
|
+
generateQuickFix(_violation: Violation): QuickFix | null;
|
|
74
|
+
}
|
|
75
|
+
export declare function createFileLocationDetector(): FileLocationDetector;
|
|
76
|
+
//# sourceMappingURL=file-location.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-location.d.ts","sourceRoot":"","sources":["../../src/types/file-location.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;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;AAMlF,MAAM,MAAM,uBAAuB,GAC/B,mBAAmB,GACnB,kBAAkB,GAClB,eAAe,GACf,kBAAkB,GAClB,kBAAkB,GAClB,cAAc,GACd,cAAc,CAAC;AAEnB,MAAM,MAAM,yBAAyB,GACjC,iBAAiB,GACjB,gBAAgB,GAChB,uBAAuB,GACvB,gBAAgB,CAAC;AAErB,MAAM,WAAW,uBAAuB;IACtC,IAAI,EAAE,uBAAuB,CAAC;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC9B;AAED,MAAM,WAAW,yBAAyB;IACxC,I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2
|
+
* File Location Detector - Type file location pattern detection
|
|
3
|
+
*
|
|
4
|
+
* Detects type file organization patterns including:
|
|
5
|
+
* - Centralized types directories
|
|
6
|
+
* - Co-located type files
|
|
7
|
+
* - Barrel exports for types
|
|
8
|
+
* - Type-only modules
|
|
9
|
+
* - Declaration file patterns
|
|
10
|
+
*
|
|
11
|
+
* @requirements 18.1 - Type file location patterns
|
|
12
|
+
*/
|
|
13
|
+
import { RegexDetector } from '../base/regex-detector.js';
|
|
14
|
+
// ============================================================================
|
|
15
|
+
// Constants
|
|
16
|
+
// ============================================================================
|
|
17
|
+
export const CENTRALIZED_TYPES_PATTERNS = [
|
|
18
|
+
/from\s+['"`][@./]*types['"`]/gi,
|
|
19
|
+
/from\s+['"`][@./]*types\/index['"`]/gi,
|
|
20
|
+
/from\s+['"`][@./]*types\/\w+['"`]/gi,
|
|
21
|
+
/from\s+['"`]@types\/\w+['"`]/gi,
|
|
22
|
+
/from\s+['"`]\.\.\/types['"`]/gi,
|
|
23
|
+
/from\s+['"`]\.\.\/\.\.\/types['"`]/gi,
|
|
24
|
+
/import\s+type.*from\s+['"`][@./]*types/gi,
|
|
25
|
+
];
|
|
26
|
+
export const CO_LOCATED_TYPES_PATTERNS = [
|
|
27
|
+
/from\s+['"`]\.\/\w+\.types['"`]/gi,
|
|
28
|
+
/from\s+['"`]\.\/types['"`]/gi,
|
|
29
|
+
/from\s+['"`]\.\/\w+\.d['"`]/gi,
|
|
30
|
+
/import\s+type.*from\s+['"`]\.\//gi,
|
|
31
|
+
];
|
|
32
|
+
export const BARREL_EXPORT_PATTERNS = [
|
|
33
|
+
/export\s+\*\s+from\s+['"`]\.\/\w+['"`]/gi,
|
|
34
|
+
/export\s+\{\s*type\s+\w+/gi,
|
|
35
|
+
/export\s+type\s+\{/gi,
|
|
36
|
+
/export\s+\*\s+as\s+\w+\s+from/gi,
|
|
37
|
+
/export\s+\{[^}]*\}\s+from\s+['"`]\.\/types/gi,
|
|
38
|
+
];
|
|
39
|
+
export const TYPE_ONLY_MODULE_PATTERNS = [
|
|
40
|
+
/^export\s+(?:type|interface)\s+/gm,
|
|
41
|
+
/^export\s+\{\s*type\s+/gm,
|
|
42
|
+
/^import\s+type\s+/gm,
|
|
43
|
+
/^declare\s+/gm,
|
|
44
|
+
/^type\s+\w+\s*=/gm,
|
|
45
|
+
/^interface\s+\w+/gm,
|
|
46
|
+
];
|
|
47
|
+
export const DECLARATION_FILE_PATTERNS = [
|
|
48
|
+
/\.d\.ts$/gi,
|
|
49
|
+
/declare\s+module\s+['"`]/gi,
|
|
50
|
+
/declare\s+namespace\s+/gi,
|
|
51
|
+
/declare\s+global\s+\{/gi,
|
|
52
|
+
/declare\s+const\s+/gi,
|
|
53
|
+
/declare\s+function\s+/gi,
|
|
54
|
+
/declare\s+class\s+/gi,
|
|
55
|
+
];
|
|
56
|
+
export const SHARED_TYPES_PATTERNS = [
|
|
57
|
+
/from\s+['"`][@./]*shared\/types['"`]/gi,
|
|
58
|
+
/from\s+['"`][@./]*common\/types['"`]/gi,
|
|
59
|
+
/from\s+['"`]@shared\/types['"`]/gi,
|
|
60
|
+
/from\s+['"`]@common\/types['"`]/gi,
|
|
61
|
+
/from\s+['"`][@./]*lib\/types['"`]/gi,
|
|
62
|
+
];
|
|
63
|
+
export const DOMAIN_TYPES_PATTERNS = [
|
|
64
|
+
/from\s+['"`][@./]*domain\/\w+\/types['"`]/gi,
|
|
65
|
+
/from\s+['"`][@./]*features\/\w+\/types['"`]/gi,
|
|
66
|
+
/from\s+['"`][@./]*modules\/\w+\/types['"`]/gi,
|
|
67
|
+
/from\s+['"`][@./]*entities\/\w+['"`]/gi,
|
|
68
|
+
];
|
|
69
|
+
export const SCATTERED_TYPES_PATTERNS = [
|
|
70
|
+
/type\s+\w+\s*=.*(?:Request|Response|Props|State|Config)/gi,
|
|
71
|
+
/interface\s+\w+(?:Request|Response|Props|State|Config)/gi,
|
|
72
|
+
];
|
|
73
|
+
// ============================================================================
|
|
74
|
+
// Analysis Functions
|
|
75
|
+
// ============================================================================
|
|
76
|
+
export function shouldExcludeFile(filePath) {
|
|
77
|
+
const excludePatterns = [
|
|
78
|
+
/\.test\.[jt]sx?$/,
|
|
79
|
+
/\.spec\.[jt]sx?$/,
|
|
80
|
+
/__tests__\//,
|
|
81
|
+
/node_modules\//,
|
|
82
|
+
/\.min\.[jt]s$/,
|
|
83
|
+
];
|
|
84
|
+
return excludePatterns.some((p) => p.test(filePath));
|
|
85
|
+
}
|
|
86
|
+
export function isTypeFile(filePath) {
|
|
87
|
+
return /\.d\.ts$|\/types\/|\.types\.[jt]sx?$|\/types\.[jt]sx?$/.test(filePath);
|
|
88
|
+
}
|
|
89
|
+
export function detectCentralizedTypes(content, filePath) {
|
|
90
|
+
const results = [];
|
|
91
|
+
const lines = content.split('\n');
|
|
92
|
+
for (let i = 0; i < lines.length; i++) {
|
|
93
|
+
const line = lines[i];
|
|
94
|
+
for (const pattern of CENTRALIZED_TYPES_PATTERNS) {
|
|
95
|
+
const regex = new RegExp(pattern.source, pattern.flags);
|
|
96
|
+
let match;
|
|
97
|
+
while ((match = regex.exec(line)) !== null) {
|
|
98
|
+
const dirMatch = match[0].match(/['"`]([^'"`]+)['"`]/);
|
|
99
|
+
results.push({
|
|
100
|
+
type: 'centralized-types',
|
|
101
|
+
file: filePath,
|
|
102
|
+
line: i + 1,
|
|
103
|
+
column: match.index + 1,
|
|
104
|
+
matchedText: match[0],
|
|
105
|
+
directory: dirMatch ? dirMatch[1] : undefined,
|
|
106
|
+
context: line.trim(),
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return results;
|
|
112
|
+
}
|
|
113
|
+
export function detectCoLocatedTypes(content, filePath) {
|
|
114
|
+
const results = [];
|
|
115
|
+
const lines = content.split('\n');
|
|
116
|
+
for (let i = 0; i < lines.length; i++) {
|
|
117
|
+
const line = lines[i];
|
|
118
|
+
for (const pattern of CO_LOCATED_TYPES_PATTERNS) {
|
|
119
|
+
const regex = new RegExp(pattern.source, pattern.flags);
|
|
120
|
+
let match;
|
|
121
|
+
while ((match = regex.exec(line)) !== null) {
|
|
122
|
+
results.push({
|
|
123
|
+
type: 'co-located-types',
|
|
124
|
+
file: filePath,
|
|
125
|
+
line: i + 1,
|
|
126
|
+
column: match.index + 1,
|
|
127
|
+
matchedText: match[0],
|
|
128
|
+
context: line.trim(),
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return results;
|
|
134
|
+
}
|
|
135
|
+
export function detectBarrelExports(content, filePath) {
|
|
136
|
+
const results = [];
|
|
137
|
+
const lines = content.split('\n');
|
|
138
|
+
for (let i = 0; i < lines.length; i++) {
|
|
139
|
+
const line = lines[i];
|
|
140
|
+
for (const pattern of BARREL_EXPORT_PATTERNS) {
|
|
141
|
+
const regex = new RegExp(pattern.source, pattern.flags);
|
|
142
|
+
let match;
|
|
143
|
+
while ((match = regex.exec(line)) !== null) {
|
|
144
|
+
results.push({
|
|
145
|
+
type: 'barrel-export',
|
|
146
|
+
file: filePath,
|
|
147
|
+
line: i + 1,
|
|
148
|
+
column: match.index + 1,
|
|
149
|
+
matchedText: match[0],
|
|
150
|
+
context: line.trim(),
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return results;
|
|
156
|
+
}
|
|
157
|
+
export function detectTypeOnlyModule(content, filePath) {
|
|
158
|
+
const results = [];
|
|
159
|
+
// Check if file is primarily type definitions
|
|
160
|
+
let typeExports = 0;
|
|
161
|
+
let valueExports = 0;
|
|
162
|
+
const lines = content.split('\n');
|
|
163
|
+
for (const line of lines) {
|
|
164
|
+
if (/^export\s+(?:type|interface)\s+/.test(line))
|
|
165
|
+
typeExports++;
|
|
166
|
+
if (/^export\s+(?:const|let|var|function|class)\s+/.test(line))
|
|
167
|
+
valueExports++;
|
|
168
|
+
}
|
|
169
|
+
if (typeExports > 0 && typeExports > valueExports * 2) {
|
|
170
|
+
results.push({
|
|
171
|
+
type: 'type-only-module',
|
|
172
|
+
file: filePath,
|
|
173
|
+
line: 1,
|
|
174
|
+
column: 1,
|
|
175
|
+
matchedText: 'type-only module',
|
|
176
|
+
context: `${typeExports} type exports, ${valueExports} value exports`,
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
return results;
|
|
180
|
+
}
|
|
181
|
+
export function detectDeclarationFile(content, filePath) {
|
|
182
|
+
const results = [];
|
|
183
|
+
if (/\.d\.ts$/.test(filePath)) {
|
|
184
|
+
results.push({
|
|
185
|
+
type: 'declaration-file',
|
|
186
|
+
file: filePath,
|
|
187
|
+
line: 1,
|
|
188
|
+
column: 1,
|
|
189
|
+
matchedText: filePath,
|
|
190
|
+
context: 'TypeScript declaration file',
|
|
191
|
+
});
|
|
192
|
+
return results;
|
|
193
|
+
}
|
|
194
|
+
const lines = content.split('\n');
|
|
195
|
+
for (let i = 0; i < lines.length; i++) {
|
|
196
|
+
const line = lines[i];
|
|
197
|
+
for (const pattern of DECLARATION_FILE_PATTERNS) {
|
|
198
|
+
if (pattern.source === '\\.d\\.ts$')
|
|
199
|
+
continue;
|
|
200
|
+
const regex = new RegExp(pattern.source, pattern.flags);
|
|
201
|
+
let match;
|
|
202
|
+
while ((match = regex.exec(line)) !== null) {
|
|
203
|
+
results.push({
|
|
204
|
+
type: 'declaration-file',
|
|
205
|
+
file: filePath,
|
|
206
|
+
line: i + 1,
|
|
207
|
+
column: match.index + 1,
|
|
208
|
+
matchedText: match[0],
|
|
209
|
+
context: line.trim(),
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
return results;
|
|
215
|
+
}
|
|
216
|
+
export function detectSharedTypes(content, filePath) {
|
|
217
|
+
const results = [];
|
|
218
|
+
const lines = content.split('\n');
|
|
219
|
+
for (let i = 0; i < lines.length; i++) {
|
|
220
|
+
const line = lines[i];
|
|
221
|
+
for (const pattern of SHARED_TYPES_PATTERNS) {
|
|
222
|
+
const regex = new RegExp(pattern.source, pattern.flags);
|
|
223
|
+
let match;
|
|
224
|
+
while ((match = regex.exec(line)) !== null) {
|
|
225
|
+
const dirMatch = match[0].match(/['"`]([^'"`]+)['"`]/);
|
|
226
|
+
results.push({
|
|
227
|
+
type: 'shared-types',
|
|
228
|
+
file: filePath,
|
|
229
|
+
line: i + 1,
|
|
230
|
+
column: match.index + 1,
|
|
231
|
+
matchedText: match[0],
|
|
232
|
+
directory: dirMatch ? dirMatch[1] : undefined,
|
|
233
|
+
context: line.trim(),
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
return results;
|
|
239
|
+
}
|
|
240
|
+
export function detectDomainTypes(content, filePath) {
|
|
241
|
+
const results = [];
|
|
242
|
+
const lines = content.split('\n');
|
|
243
|
+
for (let i = 0; i < lines.length; i++) {
|
|
244
|
+
const line = lines[i];
|
|
245
|
+
for (const pattern of DOMAIN_TYPES_PATTERNS) {
|
|
246
|
+
const regex = new RegExp(pattern.source, pattern.flags);
|
|
247
|
+
let match;
|
|
248
|
+
while ((match = regex.exec(line)) !== null) {
|
|
249
|
+
const dirMatch = match[0].match(/['"`]([^'"`]+)['"`]/);
|
|
250
|
+
results.push({
|
|
251
|
+
type: 'domain-types',
|
|
252
|
+
file: filePath,
|
|
253
|
+
line: i + 1,
|
|
254
|
+
column: match.index + 1,
|
|
255
|
+
matchedText: match[0],
|
|
256
|
+
directory: dirMatch ? dirMatch[1] : undefined,
|
|
257
|
+
context: line.trim(),
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
return results;
|
|
263
|
+
}
|
|
264
|
+
export function detectScatteredTypesViolations(content, filePath) {
|
|
265
|
+
const results = [];
|
|
266
|
+
// Skip if this is already a types file
|
|
267
|
+
if (isTypeFile(filePath))
|
|
268
|
+
return results;
|
|
269
|
+
// Skip if file has few type definitions
|
|
270
|
+
const typeDefCount = (content.match(/(?:type|interface)\s+\w+/g) || []).length;
|
|
271
|
+
if (typeDefCount < 3)
|
|
272
|
+
return results;
|
|
273
|
+
const lines = content.split('\n');
|
|
274
|
+
for (let i = 0; i < lines.length; i++) {
|
|
275
|
+
const line = lines[i];
|
|
276
|
+
for (const pattern of SCATTERED_TYPES_PATTERNS) {
|
|
277
|
+
const regex = new RegExp(pattern.source, pattern.flags);
|
|
278
|
+
let match;
|
|
279
|
+
while ((match = regex.exec(line)) !== null) {
|
|
280
|
+
results.push({
|
|
281
|
+
type: 'scattered-types',
|
|
282
|
+
file: filePath,
|
|
283
|
+
line: i + 1,
|
|
284
|
+
column: match.index + 1,
|
|
285
|
+
matchedText: match[0],
|
|
286
|
+
issue: 'Type definition in non-type file - consider moving to dedicated types file',
|
|
287
|
+
suggestedFix: 'Move to ./types.ts or ../types/index.ts',
|
|
288
|
+
severity: 'low',
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
return results;
|
|
294
|
+
}
|
|
295
|
+
export function detectInconsistentLocationViolations(content, filePath) {
|
|
296
|
+
const results = [];
|
|
297
|
+
// Check for mixed import patterns
|
|
298
|
+
const hasCentralized = CENTRALIZED_TYPES_PATTERNS.some((p) => new RegExp(p.source, p.flags).test(content));
|
|
299
|
+
const hasCoLocated = CO_LOCATED_TYPES_PATTERNS.some((p) => new RegExp(p.source, p.flags).test(content));
|
|
300
|
+
if (hasCentralized && hasCoLocated) {
|
|
301
|
+
results.push({
|
|
302
|
+
type: 'inconsistent-location',
|
|
303
|
+
file: filePath,
|
|
304
|
+
line: 1,
|
|
305
|
+
column: 1,
|
|
306
|
+
matchedText: 'mixed type imports',
|
|
307
|
+
issue: 'File imports types from both centralized and co-located sources',
|
|
308
|
+
suggestedFix: 'Standardize on one type organization pattern',
|
|
309
|
+
severity: 'low',
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
return results;
|
|
313
|
+
}
|
|
314
|
+
export function analyzeFileLocation(content, filePath) {
|
|
315
|
+
if (shouldExcludeFile(filePath)) {
|
|
316
|
+
return {
|
|
317
|
+
patterns: [],
|
|
318
|
+
violations: [],
|
|
319
|
+
hasCentralizedTypes: false,
|
|
320
|
+
hasCoLocatedTypes: false,
|
|
321
|
+
typeDirectories: [],
|
|
322
|
+
confidence: 1.0,
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
const patterns = [
|
|
326
|
+
...detectCentralizedTypes(content, filePath),
|
|
327
|
+
...detectCoLocatedTypes(content, filePath),
|
|
328
|
+
...detectBarrelExports(content, filePath),
|
|
329
|
+
...detectTypeOnlyModule(content, filePath),
|
|
330
|
+
...detectDeclarationFile(content, filePath),
|
|
331
|
+
...detectSharedTypes(content, filePath),
|
|
332
|
+
...detectDomainTypes(content, filePath),
|
|
333
|
+
];
|
|
334
|
+
const violations = [
|
|
335
|
+
...detectScatteredTypesViolations(content, filePath),
|
|
336
|
+
...detectInconsistentLocationViolations(content, filePath),
|
|
337
|
+
];
|
|
338
|
+
const hasCentralizedTypes = patterns.some((p) => p.type === 'centralized-types' || p.type === 'shared-types');
|
|
339
|
+
const hasCoLocatedTypes = patterns.some((p) => p.type === 'co-located-types');
|
|
340
|
+
const typeDirectories = [
|
|
341
|
+
...new Set(patterns.filter((p) => p.directory).map((p) => p.directory)),
|
|
342
|
+
];
|
|
343
|
+
let confidence = 0.7;
|
|
344
|
+
if (hasCentralizedTypes || hasCoLocatedTypes)
|
|
345
|
+
confidence += 0.15;
|
|
346
|
+
if (patterns.some((p) => p.type === 'barrel-export'))
|
|
347
|
+
confidence += 0.1;
|
|
348
|
+
if (violations.length === 0)
|
|
349
|
+
confidence += 0.05;
|
|
350
|
+
confidence = Math.min(confidence, 0.95);
|
|
351
|
+
return {
|
|
352
|
+
patterns,
|
|
353
|
+
violations,
|
|
354
|
+
hasCentralizedTypes,
|
|
355
|
+
hasCoLocatedTypes,
|
|
356
|
+
typeDirectories,
|
|
357
|
+
confidence,
|
|
358
|
+
};
|
|
359
|
+
}
|
|
360
|
+
// ============================================================================
|
|
361
|
+
// Detector Class
|
|
362
|
+
// ============================================================================
|
|
363
|
+
export class FileLocationDetector extends RegexDetector {
|
|
364
|
+
id = 'types/file-location';
|
|
365
|
+
name = 'File Location Detector';
|
|
366
|
+
description = 'Detects type file organization patterns and identifies scattered types';
|
|
367
|
+
category = 'types';
|
|
368
|
+
subcategory = 'file-location';
|
|
369
|
+
supportedLanguages = ['typescript'];
|
|
370
|
+
async detect(context) {
|
|
371
|
+
if (!this.supportsLanguage(context.language)) {
|
|
372
|
+
return this.createEmptyResult();
|
|
373
|
+
}
|
|
374
|
+
const analysis = analyzeFileLocation(context.content, context.file);
|
|
375
|
+
if (analysis.patterns.length === 0 && analysis.violations.length === 0) {
|
|
376
|
+
return this.createEmptyResult();
|
|
377
|
+
}
|
|
378
|
+
return this.createResult([], [], analysis.confidence, {
|
|
379
|
+
custom: {
|
|
380
|
+
patterns: analysis.patterns,
|
|
381
|
+
violations: analysis.violations,
|
|
382
|
+
hasCentralizedTypes: analysis.hasCentralizedTypes,
|
|
383
|
+
hasCoLocatedTypes: analysis.hasCoLocatedTypes,
|
|
384
|
+
typeDirectories: analysis.typeDirectories,
|
|
385
|
+
},
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
generateQuickFix(_violation) {
|
|
389
|
+
return null;
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
export function createFileLocationDetector() {
|
|
393
|
+
return new FileLocationDetector();
|
|
394
|
+
}
|
|
395
|
+
//# sourceMappingURL=file-location.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-location.js","sourceRoot":"","sources":["../../src/types/file-location.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAoD1D,+EAA+E;AAC/E,YAAY;AACZ,+EAA+E;AAE/E,MAAM,CAAC,MAAM,0BAA0B,GAA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gBAAgB,CAAC,UAAqB;QACpC,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAED,MAAM,UAAU,0BAA0B;IACxC,OAAO,IAAI,oBAAoB,EAAE,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic Patterns Detector - Generic type pattern detection
|
|
3
|
+
*
|
|
4
|
+
* Detects generic type patterns including:
|
|
5
|
+
* - Generic function declarations
|
|
6
|
+
* - Generic class declarations
|
|
7
|
+
* - Generic interface declarations
|
|
8
|
+
* - Constrained generics (extends)
|
|
9
|
+
* - Default generic parameters
|
|
10
|
+
* - Multiple type parameters
|
|
11
|
+
* - Generic type inference
|
|
12
|
+
* - Higher-kinded types patterns
|
|
13
|
+
*
|
|
14
|
+
* @requirements 18.4 - Generic type patterns
|
|
15
|
+
*/
|
|
16
|
+
import type { Violation, QuickFix, PatternCategory, Language } from 'driftdetect-core';
|
|
17
|
+
import { RegexDetector } from '../base/regex-detector.js';
|
|
18
|
+
import type { DetectionContext, DetectionResult } from '../base/base-detector.js';
|
|
19
|
+
export type GenericPatternType = 'generic-function' | 'generic-arrow-function' | 'generic-class' | 'generic-interface' | 'generic-type-alias' | 'constrained-generic' | 'default-generic' | 'multiple-type-params' | 'generic-method' | 'generic-constructor' | 'infer-keyword' | 'keyof-constraint' | 'mapped-generic' | 'conditional-generic';
|
|
20
|
+
export type GenericViolationType = 'unused-generic' | 'overly-complex-generic' | 'missing-constraint' | 'redundant-constraint' | 'unclear-generic-name' | 'too-many-type-params';
|
|
21
|
+
export interface GenericPatternInfo {
|
|
22
|
+
type: GenericPatternType;
|
|
23
|
+
file: string;
|
|
24
|
+
line: number;
|
|
25
|
+
column: number;
|
|
26
|
+
matchedText: string;
|
|
27
|
+
name?: string | undefined;
|
|
28
|
+
typeParams?: string[] | undefined;
|
|
29
|
+
constraints?: string[] | undefined;
|
|
30
|
+
context?: string | undefined;
|
|
31
|
+
}
|
|
32
|
+
export interface GenericViolationInfo {
|
|
33
|
+
type: GenericViolationType;
|
|
34
|
+
file: string;
|
|
35
|
+
line: number;
|
|
36
|
+
column: number;
|
|
37
|
+
matchedText: string;
|
|
38
|
+
issue: string;
|
|
39
|
+
suggestedFix?: string | undefined;
|
|
40
|
+
severity: 'high' | 'medium' | 'low';
|
|
41
|
+
}
|
|
42
|
+
export interface GenericPatternsAnalysis {
|
|
43
|
+
patterns: GenericPatternInfo[];
|
|
44
|
+
violations: GenericViolationInfo[];
|
|
45
|
+
genericFunctionCount: number;
|
|
46
|
+
genericClassCount: number;
|
|
47
|
+
genericInterfaceCount: number;
|
|
48
|
+
usesConstraints: boolean;
|
|
49
|
+
usesDefaults: boolean;
|
|
50
|
+
confidence: number;
|
|
51
|
+
}
|
|
52
|
+
export declare const GENERIC_FUNCTION_PATTERNS: readonly [RegExp, RegExp, RegExp, RegExp];
|
|
53
|
+
export declare const GENERIC_ARROW_FUNCTION_PATTERNS: readonly [RegExp, RegExp, RegExp];
|
|
54
|
+
export declare const GENERIC_CLASS_PATTERNS: readonly [RegExp, RegExp, RegExp, RegExp];
|
|
55
|
+
export declare const GENERIC_INTERFACE_PATTERNS: readonly [RegExp, RegExp];
|
|
56
|
+
export declare const GENERIC_TYPE_ALIAS_PATTERNS: readonly [RegExp, RegExp];
|
|
57
|
+
export declare const CONSTRAINED_GENERIC_PATTERNS: readonly [RegExp, RegExp, RegExp, RegExp, RegExp];
|
|
58
|
+
export declare const DEFAULT_GENERIC_PATTERNS: readonly [RegExp, RegExp, RegExp];
|
|
59
|
+
export declare const MULTIPLE_TYPE_PARAMS_PATTERNS: readonly [RegExp, RegExp];
|
|
60
|
+
export declare const GENERIC_METHOD_PATTERNS: readonly [RegExp, RegExp];
|
|
61
|
+
export declare const INFER_KEYWORD_PATTERNS: readonly [RegExp, RegExp];
|
|
62
|
+
export declare const KEYOF_CONSTRAINT_PATTERNS: readonly [RegExp, RegExp];
|
|
63
|
+
export declare const MAPPED_GENERIC_PATTERNS: readonly [RegExp, RegExp, RegExp, RegExp];
|
|
64
|
+
export declare const CONDITIONAL_GENERIC_PATTERNS: readonly [RegExp, RegExp];
|
|
65
|
+
export declare const UNUSED_GENERIC_PATTERNS: readonly [RegExp];
|
|
66
|
+
export declare const OVERLY_COMPLEX_GENERIC_PATTERNS: readonly [RegExp, RegExp];
|
|
67
|
+
export declare const UNCLEAR_GENERIC_NAME_PATTERNS: readonly [RegExp, RegExp];
|
|
68
|
+
export declare function shouldExcludeFile(filePath: string): boolean;
|
|
69
|
+
export declare function detectGenericFunctions(content: string, filePath: string): GenericPatternInfo[];
|
|
70
|
+
export declare function detectGenericArrowFunctions(content: string, filePath: string): GenericPatternInfo[];
|
|
71
|
+
export declare function detectGenericClasses(content: string, filePath: string): GenericPatternInfo[];
|
|
72
|
+
export declare function detectGenericInterfaces(content: string, filePath: string): GenericPatternInfo[];
|
|
73
|
+
export declare function detectGenericTypeAliases(content: string, filePath: string): GenericPatternInfo[];
|
|
74
|
+
export declare function detectConstrainedGenerics(content: string, filePath: string): GenericPatternInfo[];
|
|
75
|
+
export declare function detectDefaultGenerics(content: string, filePath: string): GenericPatternInfo[];
|
|
76
|
+
export declare function detectMultipleTypeParams(content: string, filePath: string): GenericPatternInfo[];
|
|
77
|
+
export declare function detectGenericMethods(content: string, filePath: string): GenericPatternInfo[];
|
|
78
|
+
export declare function detectInferKeyword(content: string, filePath: string): GenericPatternInfo[];
|
|
79
|
+
export declare function detectKeyofConstraint(content: string, filePath: string): GenericPatternInfo[];
|
|
80
|
+
export declare function detectMappedGenerics(content: string, filePath: string): GenericPatternInfo[];
|
|
81
|
+
export declare function detectConditionalGenerics(content: string, filePath: string): GenericPatternInfo[];
|
|
82
|
+
export declare function detectOverlyComplexGenerics(content: string, filePath: string): GenericViolationInfo[];
|
|
83
|
+
export declare function detectUnclearGenericNames(content: string, filePath: string): GenericViolationInfo[];
|
|
84
|
+
export declare function detectTooManyTypeParams(content: string, filePath: string): GenericViolationInfo[];
|
|
85
|
+
export declare function analyzeGenericPatterns(content: string, filePath: string): GenericPatternsAnalysis;
|
|
86
|
+
export declare class GenericPatternsDetector extends RegexDetector {
|
|
87
|
+
readonly id = "types/generic-patterns";
|
|
88
|
+
readonly name = "Generic Patterns Detector";
|
|
89
|
+
readonly description = "Detects generic type patterns including constraints, defaults, and advanced patterns";
|
|
90
|
+
readonly category: PatternCategory;
|
|
91
|
+
readonly subcategory = "generic-patterns";
|
|
92
|
+
readonly supportedLanguages: Language[];
|
|
93
|
+
detect(context: DetectionContext): Promise<DetectionResult>;
|
|
94
|
+
generateQuickFix(_violation: Violation): QuickFix | null;
|
|
95
|
+
}
|
|
96
|
+
export declare function createGenericPatternsDetector(): GenericPatternsDetector;
|
|
97
|
+
//# sourceMappingURL=generic-patterns.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generic-patterns.d.ts","sourceRoot":"","sources":["../../src/types/generic-patterns.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;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;AAMlF,MAAM,MAAM,kBAAkB,GAC1B,kBAAkB,GAClB,wBAAwB,GACxB,eAAe,GACf,mBAAmB,GACnB,oBAAoB,GACpB,qBAAqB,GACrB,iBAAiB,GACjB,sBAAsB,GACtB,gBAAgB,GAChB,qBAAqB,GACrB,eAAe,GACf,kBAAkB,GAClB,gBAAgB,GAChB,qBAAqB,CAAC;AAE1B,MAAM,MAAM,oBAAoB,GAC5B,gBAAgB,GAChB,wBAAwB,GACxB,oBAAoB,GACpB,sBAAsB,GACtB,sBAAsB,GACtB,sBAAsB,CAAC;AAE3B,MAAM,WAAW,kBAAkB;IACjC,IAAI,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