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,731 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structural Detector - File/directory structure detection base class
|
|
3
|
+
*
|
|
4
|
+
* Provides path pattern matching helpers and utilities for structural pattern detection.
|
|
5
|
+
* Extends BaseDetector with specialized methods for analyzing file and directory structures.
|
|
6
|
+
*
|
|
7
|
+
* @requirements 6.4 - THE Detector_System SHALL support detection methods: ast, regex, semantic, structural, and custom
|
|
8
|
+
*/
|
|
9
|
+
import { BaseDetector } from './base-detector.js';
|
|
10
|
+
// ============================================================================
|
|
11
|
+
// Structural Detector Abstract Class
|
|
12
|
+
// ============================================================================
|
|
13
|
+
/**
|
|
14
|
+
* Abstract base class for structural detectors
|
|
15
|
+
*
|
|
16
|
+
* Provides path pattern matching helpers and utilities for detection
|
|
17
|
+
* that operates on file and directory structures.
|
|
18
|
+
*
|
|
19
|
+
* @requirements 6.4 - THE Detector_System SHALL support detection methods: structural
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```typescript
|
|
23
|
+
* class FileNamingDetector extends StructuralDetector {
|
|
24
|
+
* readonly id = 'structural/file-naming';
|
|
25
|
+
* readonly category = 'structural';
|
|
26
|
+
* readonly subcategory = 'naming-conventions';
|
|
27
|
+
* readonly name = 'File Naming Detector';
|
|
28
|
+
* readonly description = 'Detects file naming patterns';
|
|
29
|
+
* readonly supportedLanguages = ['typescript', 'javascript'];
|
|
30
|
+
*
|
|
31
|
+
* async detect(context: DetectionContext): Promise<DetectionResult> {
|
|
32
|
+
* const fileName = this.getFileName(context.file);
|
|
33
|
+
* const convention = this.matchNamingConvention(fileName, 'PascalCase');
|
|
34
|
+
* // Analyze file naming patterns...
|
|
35
|
+
* }
|
|
36
|
+
*
|
|
37
|
+
* generateQuickFix(violation: Violation): QuickFix | null {
|
|
38
|
+
* return null;
|
|
39
|
+
* }
|
|
40
|
+
* }
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export class StructuralDetector extends BaseDetector {
|
|
44
|
+
/**
|
|
45
|
+
* Detection method is always 'structural' for structural detectors
|
|
46
|
+
*
|
|
47
|
+
* @requirements 6.4 - Detector declares detection method as 'structural'
|
|
48
|
+
*/
|
|
49
|
+
detectionMethod = 'structural';
|
|
50
|
+
// ============================================================================
|
|
51
|
+
// Path Pattern Matching Methods
|
|
52
|
+
// ============================================================================
|
|
53
|
+
/**
|
|
54
|
+
* Match a file path against a glob pattern
|
|
55
|
+
*
|
|
56
|
+
* Supports common glob patterns:
|
|
57
|
+
* - `*` matches any characters except path separators
|
|
58
|
+
* - `**` matches any characters including path separators
|
|
59
|
+
* - `?` matches a single character
|
|
60
|
+
* - `[abc]` matches any character in the brackets
|
|
61
|
+
* - `[!abc]` matches any character not in the brackets
|
|
62
|
+
* - `{a,b,c}` matches any of the alternatives
|
|
63
|
+
*
|
|
64
|
+
* @param path - The file path to match
|
|
65
|
+
* @param pattern - The glob pattern to match against
|
|
66
|
+
* @param options - Optional matching options
|
|
67
|
+
* @returns PathMatchResult with match status and captures
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```typescript
|
|
71
|
+
* const result = this.matchPath('src/components/Button.tsx', 'src/components/*.tsx');
|
|
72
|
+
* // result.matches === true
|
|
73
|
+
*
|
|
74
|
+
* const result2 = this.matchPath('src/utils/helpers.ts', '**\/*.test.ts');
|
|
75
|
+
* // result2.matches === false
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
matchPath(path, pattern, options = {}) {
|
|
79
|
+
const normalizedPath = this.normalizePath(path);
|
|
80
|
+
const normalizedPattern = this.normalizePath(pattern);
|
|
81
|
+
const regex = this.globToRegex(normalizedPattern, options);
|
|
82
|
+
const match = normalizedPath.match(regex);
|
|
83
|
+
if (!match) {
|
|
84
|
+
return { matches: false, captures: {} };
|
|
85
|
+
}
|
|
86
|
+
const captures = {};
|
|
87
|
+
if (match.groups) {
|
|
88
|
+
Object.assign(captures, match.groups);
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
matches: true,
|
|
92
|
+
captures,
|
|
93
|
+
matchedPortion: match[0],
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Match a file name against a pattern
|
|
98
|
+
*
|
|
99
|
+
* Matches only the file name portion (not the directory path).
|
|
100
|
+
*
|
|
101
|
+
* @param fileName - The file name to match (with or without extension)
|
|
102
|
+
* @param pattern - The pattern to match against (glob or regex string)
|
|
103
|
+
* @param options - Optional matching options
|
|
104
|
+
* @returns PathMatchResult with match status
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```typescript
|
|
108
|
+
* const result = this.matchFileName('Button.tsx', '*.tsx');
|
|
109
|
+
* // result.matches === true
|
|
110
|
+
*
|
|
111
|
+
* const result2 = this.matchFileName('useAuth.ts', 'use*.ts');
|
|
112
|
+
* // result2.matches === true
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
matchFileName(fileName, pattern, options = {}) {
|
|
116
|
+
// Extract just the file name if a full path was provided
|
|
117
|
+
const name = this.getFileName(fileName) + this.getFileExtension(fileName);
|
|
118
|
+
const regex = this.globToRegex(pattern, { ...options, isFileName: true });
|
|
119
|
+
const match = name.match(regex);
|
|
120
|
+
if (!match) {
|
|
121
|
+
return { matches: false, captures: {} };
|
|
122
|
+
}
|
|
123
|
+
const captures = {};
|
|
124
|
+
if (match.groups) {
|
|
125
|
+
Object.assign(captures, match.groups);
|
|
126
|
+
}
|
|
127
|
+
return {
|
|
128
|
+
matches: true,
|
|
129
|
+
captures,
|
|
130
|
+
matchedPortion: match[0],
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
// ============================================================================
|
|
134
|
+
// Path Component Extraction Methods
|
|
135
|
+
// ============================================================================
|
|
136
|
+
/**
|
|
137
|
+
* Get the file extension from a path
|
|
138
|
+
*
|
|
139
|
+
* Returns the extension including the leading dot.
|
|
140
|
+
* For files with multiple extensions (e.g., .test.ts), returns only the last extension.
|
|
141
|
+
*
|
|
142
|
+
* @param path - The file path
|
|
143
|
+
* @returns The file extension (e.g., '.ts', '.tsx') or empty string if none
|
|
144
|
+
*
|
|
145
|
+
* @example
|
|
146
|
+
* ```typescript
|
|
147
|
+
* this.getFileExtension('src/Button.tsx'); // '.tsx'
|
|
148
|
+
* this.getFileExtension('README'); // ''
|
|
149
|
+
* this.getFileExtension('file.test.ts'); // '.ts'
|
|
150
|
+
* ```
|
|
151
|
+
*/
|
|
152
|
+
getFileExtension(path) {
|
|
153
|
+
const normalizedPath = this.normalizePath(path);
|
|
154
|
+
const fileName = normalizedPath.split('/').pop() || '';
|
|
155
|
+
const lastDotIndex = fileName.lastIndexOf('.');
|
|
156
|
+
if (lastDotIndex === -1 || lastDotIndex === 0) {
|
|
157
|
+
return '';
|
|
158
|
+
}
|
|
159
|
+
return fileName.slice(lastDotIndex);
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Get the file name without extension from a path
|
|
163
|
+
*
|
|
164
|
+
* @param path - The file path
|
|
165
|
+
* @returns The file name without extension
|
|
166
|
+
*
|
|
167
|
+
* @example
|
|
168
|
+
* ```typescript
|
|
169
|
+
* this.getFileName('src/components/Button.tsx'); // 'Button'
|
|
170
|
+
* this.getFileName('README.md'); // 'README'
|
|
171
|
+
* this.getFileName('file.test.ts'); // 'file.test'
|
|
172
|
+
* ```
|
|
173
|
+
*/
|
|
174
|
+
getFileName(path) {
|
|
175
|
+
const normalizedPath = this.normalizePath(path);
|
|
176
|
+
const fileName = normalizedPath.split('/').pop() || '';
|
|
177
|
+
const lastDotIndex = fileName.lastIndexOf('.');
|
|
178
|
+
if (lastDotIndex === -1 || lastDotIndex === 0) {
|
|
179
|
+
return fileName;
|
|
180
|
+
}
|
|
181
|
+
return fileName.slice(0, lastDotIndex);
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Get the directory path from a file path
|
|
185
|
+
*
|
|
186
|
+
* Returns the path without the file name.
|
|
187
|
+
*
|
|
188
|
+
* @param path - The file path
|
|
189
|
+
* @returns The directory path (empty string if file is in root)
|
|
190
|
+
*
|
|
191
|
+
* @example
|
|
192
|
+
* ```typescript
|
|
193
|
+
* this.getDirectoryPath('src/components/Button.tsx'); // 'src/components'
|
|
194
|
+
* this.getDirectoryPath('index.ts'); // ''
|
|
195
|
+
* this.getDirectoryPath('src/utils/'); // 'src/utils'
|
|
196
|
+
* ```
|
|
197
|
+
*/
|
|
198
|
+
getDirectoryPath(path) {
|
|
199
|
+
const normalizedPath = this.normalizePath(path);
|
|
200
|
+
const lastSlashIndex = normalizedPath.lastIndexOf('/');
|
|
201
|
+
if (lastSlashIndex === -1) {
|
|
202
|
+
return '';
|
|
203
|
+
}
|
|
204
|
+
return normalizedPath.slice(0, lastSlashIndex);
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Get detailed information about a file path
|
|
208
|
+
*
|
|
209
|
+
* @param path - The file path to analyze
|
|
210
|
+
* @returns PathInfo object with all path components
|
|
211
|
+
*
|
|
212
|
+
* @example
|
|
213
|
+
* ```typescript
|
|
214
|
+
* const info = this.getPathInfo('src/components/Button.tsx');
|
|
215
|
+
* // info.directory === 'src/components'
|
|
216
|
+
* // info.fileName === 'Button.tsx'
|
|
217
|
+
* // info.baseName === 'Button'
|
|
218
|
+
* // info.extension === '.tsx'
|
|
219
|
+
* // info.segments === ['src', 'components', 'Button.tsx']
|
|
220
|
+
* // info.depth === 2
|
|
221
|
+
* ```
|
|
222
|
+
*/
|
|
223
|
+
getPathInfo(path) {
|
|
224
|
+
const normalizedPath = this.normalizePath(path);
|
|
225
|
+
const segments = normalizedPath.split('/').filter((s) => s.length > 0);
|
|
226
|
+
const fileName = segments[segments.length - 1] || '';
|
|
227
|
+
const extension = this.getFileExtension(normalizedPath);
|
|
228
|
+
const baseName = this.getFileName(normalizedPath);
|
|
229
|
+
const directory = this.getDirectoryPath(normalizedPath);
|
|
230
|
+
return {
|
|
231
|
+
fullPath: normalizedPath,
|
|
232
|
+
directory,
|
|
233
|
+
fileName,
|
|
234
|
+
baseName,
|
|
235
|
+
extension,
|
|
236
|
+
segments,
|
|
237
|
+
depth: segments.length - 1, // Depth is number of directories
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
// ============================================================================
|
|
241
|
+
// Directory Relationship Methods
|
|
242
|
+
// ============================================================================
|
|
243
|
+
/**
|
|
244
|
+
* Check if a file is in a specific directory (or its subdirectories)
|
|
245
|
+
*
|
|
246
|
+
* @param path - The file path to check
|
|
247
|
+
* @param directory - The directory to check against
|
|
248
|
+
* @param recursive - Whether to check subdirectories (default: true)
|
|
249
|
+
* @returns true if the file is in the directory
|
|
250
|
+
*
|
|
251
|
+
* @example
|
|
252
|
+
* ```typescript
|
|
253
|
+
* this.isInDirectory('src/components/Button.tsx', 'src/components'); // true
|
|
254
|
+
* this.isInDirectory('src/components/ui/Button.tsx', 'src/components'); // true (recursive)
|
|
255
|
+
* this.isInDirectory('src/components/ui/Button.tsx', 'src/components', false); // false
|
|
256
|
+
* this.isInDirectory('src/utils/helpers.ts', 'src/components'); // false
|
|
257
|
+
* ```
|
|
258
|
+
*/
|
|
259
|
+
isInDirectory(path, directory, recursive = true) {
|
|
260
|
+
const normalizedPath = this.normalizePath(path);
|
|
261
|
+
const normalizedDir = this.normalizePath(directory).replace(/\/$/, '');
|
|
262
|
+
const pathDir = this.getDirectoryPath(normalizedPath);
|
|
263
|
+
if (recursive) {
|
|
264
|
+
return pathDir === normalizedDir || pathDir.startsWith(normalizedDir + '/');
|
|
265
|
+
}
|
|
266
|
+
return pathDir === normalizedDir;
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Get the relative path from a base path
|
|
270
|
+
*
|
|
271
|
+
* @param path - The full file path
|
|
272
|
+
* @param basePath - The base path to make relative to
|
|
273
|
+
* @returns The relative path, or the original path if not under basePath
|
|
274
|
+
*
|
|
275
|
+
* @example
|
|
276
|
+
* ```typescript
|
|
277
|
+
* this.getRelativePath('src/components/Button.tsx', 'src'); // 'components/Button.tsx'
|
|
278
|
+
* this.getRelativePath('src/components/Button.tsx', 'src/components'); // 'Button.tsx'
|
|
279
|
+
* this.getRelativePath('other/file.ts', 'src'); // 'other/file.ts' (not under base)
|
|
280
|
+
* ```
|
|
281
|
+
*/
|
|
282
|
+
getRelativePath(path, basePath) {
|
|
283
|
+
const normalizedPath = this.normalizePath(path);
|
|
284
|
+
const normalizedBase = this.normalizePath(basePath).replace(/\/$/, '');
|
|
285
|
+
if (!normalizedPath.startsWith(normalizedBase + '/')) {
|
|
286
|
+
return normalizedPath;
|
|
287
|
+
}
|
|
288
|
+
return normalizedPath.slice(normalizedBase.length + 1);
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Get the common base path of multiple paths
|
|
292
|
+
*
|
|
293
|
+
* @param paths - Array of file paths
|
|
294
|
+
* @returns The common base path, or empty string if none
|
|
295
|
+
*
|
|
296
|
+
* @example
|
|
297
|
+
* ```typescript
|
|
298
|
+
* this.getCommonBasePath(['src/a/file.ts', 'src/b/file.ts']); // 'src'
|
|
299
|
+
* this.getCommonBasePath(['src/components/Button.tsx', 'src/components/Input.tsx']); // 'src/components'
|
|
300
|
+
* this.getCommonBasePath(['a/file.ts', 'b/file.ts']); // ''
|
|
301
|
+
* ```
|
|
302
|
+
*/
|
|
303
|
+
getCommonBasePath(paths) {
|
|
304
|
+
if (paths.length === 0) {
|
|
305
|
+
return '';
|
|
306
|
+
}
|
|
307
|
+
if (paths.length === 1) {
|
|
308
|
+
return this.getDirectoryPath(paths[0]);
|
|
309
|
+
}
|
|
310
|
+
const normalizedPaths = paths.map((p) => this.normalizePath(p));
|
|
311
|
+
const segments = normalizedPaths.map((p) => p.split('/'));
|
|
312
|
+
const minLength = Math.min(...segments.map((s) => s.length));
|
|
313
|
+
const commonSegments = [];
|
|
314
|
+
for (let i = 0; i < minLength - 1; i++) {
|
|
315
|
+
const segment = segments[0][i];
|
|
316
|
+
const allMatch = segments.every((s) => s[i] === segment);
|
|
317
|
+
if (allMatch) {
|
|
318
|
+
commonSegments.push(segment);
|
|
319
|
+
}
|
|
320
|
+
else {
|
|
321
|
+
break;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
return commonSegments.join('/');
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Get sibling files (files in the same directory)
|
|
328
|
+
*
|
|
329
|
+
* @param path - The file path
|
|
330
|
+
* @param allFiles - Array of all file paths in the project
|
|
331
|
+
* @returns Array of sibling file paths (excluding the input file)
|
|
332
|
+
*
|
|
333
|
+
* @example
|
|
334
|
+
* ```typescript
|
|
335
|
+
* const siblings = this.getSiblingFiles('src/Button.tsx', projectFiles);
|
|
336
|
+
* // Returns other files in 'src/' directory
|
|
337
|
+
* ```
|
|
338
|
+
*/
|
|
339
|
+
getSiblingFiles(path, allFiles) {
|
|
340
|
+
const directory = this.getDirectoryPath(path);
|
|
341
|
+
const normalizedPath = this.normalizePath(path);
|
|
342
|
+
return allFiles.filter((file) => {
|
|
343
|
+
const normalizedFile = this.normalizePath(file);
|
|
344
|
+
return (normalizedFile !== normalizedPath &&
|
|
345
|
+
this.getDirectoryPath(normalizedFile) === directory);
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
// ============================================================================
|
|
349
|
+
// Naming Convention Methods
|
|
350
|
+
// ============================================================================
|
|
351
|
+
/**
|
|
352
|
+
* Check if a name matches a specific naming convention
|
|
353
|
+
*
|
|
354
|
+
* @param name - The name to check (file name, identifier, etc.)
|
|
355
|
+
* @param convention - The naming convention to check against
|
|
356
|
+
* @returns NamingConventionResult with match status and suggestions
|
|
357
|
+
*
|
|
358
|
+
* @example
|
|
359
|
+
* ```typescript
|
|
360
|
+
* this.matchNamingConvention('MyComponent', 'PascalCase'); // { matches: true, ... }
|
|
361
|
+
* this.matchNamingConvention('myFunction', 'camelCase'); // { matches: true, ... }
|
|
362
|
+
* this.matchNamingConvention('my-component', 'kebab-case'); // { matches: true, ... }
|
|
363
|
+
* this.matchNamingConvention('my_variable', 'snake_case'); // { matches: true, ... }
|
|
364
|
+
* this.matchNamingConvention('MAX_VALUE', 'SCREAMING_SNAKE_CASE'); // { matches: true, ... }
|
|
365
|
+
* ```
|
|
366
|
+
*/
|
|
367
|
+
matchNamingConvention(name, convention) {
|
|
368
|
+
const detectedConvention = this.detectNamingConvention(name);
|
|
369
|
+
const matches = detectedConvention === convention;
|
|
370
|
+
const result = {
|
|
371
|
+
matches,
|
|
372
|
+
detectedConvention,
|
|
373
|
+
};
|
|
374
|
+
if (!matches) {
|
|
375
|
+
result.suggestedName = this.convertToConvention(name, convention);
|
|
376
|
+
}
|
|
377
|
+
return result;
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* Detect the naming convention of a name
|
|
381
|
+
*
|
|
382
|
+
* @param name - The name to analyze
|
|
383
|
+
* @returns The detected naming convention, or null if unknown
|
|
384
|
+
*
|
|
385
|
+
* @example
|
|
386
|
+
* ```typescript
|
|
387
|
+
* this.detectNamingConvention('MyComponent'); // 'PascalCase'
|
|
388
|
+
* this.detectNamingConvention('myFunction'); // 'camelCase'
|
|
389
|
+
* this.detectNamingConvention('my-component'); // 'kebab-case'
|
|
390
|
+
* this.detectNamingConvention('my_variable'); // 'snake_case'
|
|
391
|
+
* this.detectNamingConvention('MAX_VALUE'); // 'SCREAMING_SNAKE_CASE'
|
|
392
|
+
* this.detectNamingConvention('mycomponent'); // 'flatcase'
|
|
393
|
+
* ```
|
|
394
|
+
*/
|
|
395
|
+
detectNamingConvention(name) {
|
|
396
|
+
if (!name || name.length === 0) {
|
|
397
|
+
return null;
|
|
398
|
+
}
|
|
399
|
+
// Check for SCREAMING_SNAKE_CASE (all uppercase with underscores, must have underscore)
|
|
400
|
+
if (/^[A-Z][A-Z0-9]*(_[A-Z0-9]+)+$/.test(name)) {
|
|
401
|
+
return 'SCREAMING_SNAKE_CASE';
|
|
402
|
+
}
|
|
403
|
+
// Check for kebab-case (lowercase with hyphens, must have hyphen)
|
|
404
|
+
if (/^[a-z][a-z0-9]*(-[a-z0-9]+)+$/.test(name)) {
|
|
405
|
+
return 'kebab-case';
|
|
406
|
+
}
|
|
407
|
+
// Check for snake_case (lowercase with underscores, must have underscore)
|
|
408
|
+
if (/^[a-z][a-z0-9]*(_[a-z0-9]+)+$/.test(name)) {
|
|
409
|
+
return 'snake_case';
|
|
410
|
+
}
|
|
411
|
+
// Check for PascalCase (starts with uppercase, no separators)
|
|
412
|
+
if (/^[A-Z][a-zA-Z0-9]*$/.test(name) && /[a-z]/.test(name)) {
|
|
413
|
+
return 'PascalCase';
|
|
414
|
+
}
|
|
415
|
+
// Check for camelCase (starts with lowercase, has uppercase)
|
|
416
|
+
if (/^[a-z][a-zA-Z0-9]*$/.test(name) && /[A-Z]/.test(name)) {
|
|
417
|
+
return 'camelCase';
|
|
418
|
+
}
|
|
419
|
+
// Check for flatcase (all lowercase, no separators)
|
|
420
|
+
if (/^[a-z][a-z0-9]*$/.test(name)) {
|
|
421
|
+
return 'flatcase';
|
|
422
|
+
}
|
|
423
|
+
return null;
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* Convert a name to a specific naming convention
|
|
427
|
+
*
|
|
428
|
+
* @param name - The name to convert
|
|
429
|
+
* @param convention - The target naming convention
|
|
430
|
+
* @returns The converted name
|
|
431
|
+
*
|
|
432
|
+
* @example
|
|
433
|
+
* ```typescript
|
|
434
|
+
* this.convertToConvention('myComponent', 'PascalCase'); // 'MyComponent'
|
|
435
|
+
* this.convertToConvention('MyComponent', 'camelCase'); // 'myComponent'
|
|
436
|
+
* this.convertToConvention('MyComponent', 'kebab-case'); // 'my-component'
|
|
437
|
+
* this.convertToConvention('myComponent', 'snake_case'); // 'my_component'
|
|
438
|
+
* this.convertToConvention('myComponent', 'SCREAMING_SNAKE_CASE'); // 'MY_COMPONENT'
|
|
439
|
+
* ```
|
|
440
|
+
*/
|
|
441
|
+
convertToConvention(name, convention) {
|
|
442
|
+
// First, split the name into words
|
|
443
|
+
const words = this.splitIntoWords(name);
|
|
444
|
+
if (words.length === 0) {
|
|
445
|
+
return name;
|
|
446
|
+
}
|
|
447
|
+
switch (convention) {
|
|
448
|
+
case 'PascalCase':
|
|
449
|
+
return words.map((w) => this.capitalize(w)).join('');
|
|
450
|
+
case 'camelCase':
|
|
451
|
+
return words
|
|
452
|
+
.map((w, i) => (i === 0 ? w.toLowerCase() : this.capitalize(w)))
|
|
453
|
+
.join('');
|
|
454
|
+
case 'kebab-case':
|
|
455
|
+
return words.map((w) => w.toLowerCase()).join('-');
|
|
456
|
+
case 'snake_case':
|
|
457
|
+
return words.map((w) => w.toLowerCase()).join('_');
|
|
458
|
+
case 'SCREAMING_SNAKE_CASE':
|
|
459
|
+
return words.map((w) => w.toUpperCase()).join('_');
|
|
460
|
+
case 'flatcase':
|
|
461
|
+
return words.map((w) => w.toLowerCase()).join('');
|
|
462
|
+
default:
|
|
463
|
+
return name;
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* Split a name into words based on common conventions
|
|
468
|
+
*
|
|
469
|
+
* @param name - The name to split
|
|
470
|
+
* @returns Array of words
|
|
471
|
+
*/
|
|
472
|
+
splitIntoWords(name) {
|
|
473
|
+
// Handle kebab-case and snake_case
|
|
474
|
+
if (name.includes('-') || name.includes('_')) {
|
|
475
|
+
return name.split(/[-_]+/).filter((w) => w.length > 0);
|
|
476
|
+
}
|
|
477
|
+
// Handle PascalCase and camelCase
|
|
478
|
+
const words = [];
|
|
479
|
+
let currentWord = '';
|
|
480
|
+
for (let i = 0; i < name.length; i++) {
|
|
481
|
+
const char = name[i];
|
|
482
|
+
const isUpperCase = char === char.toUpperCase() && char !== char.toLowerCase();
|
|
483
|
+
if (isUpperCase && currentWord.length > 0) {
|
|
484
|
+
words.push(currentWord);
|
|
485
|
+
currentWord = char;
|
|
486
|
+
}
|
|
487
|
+
else {
|
|
488
|
+
currentWord += char;
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
if (currentWord.length > 0) {
|
|
492
|
+
words.push(currentWord);
|
|
493
|
+
}
|
|
494
|
+
return words;
|
|
495
|
+
}
|
|
496
|
+
/**
|
|
497
|
+
* Capitalize the first letter of a word
|
|
498
|
+
*/
|
|
499
|
+
capitalize(word) {
|
|
500
|
+
if (word.length === 0) {
|
|
501
|
+
return word;
|
|
502
|
+
}
|
|
503
|
+
return word[0].toUpperCase() + word.slice(1).toLowerCase();
|
|
504
|
+
}
|
|
505
|
+
// ============================================================================
|
|
506
|
+
// File Type Detection Methods
|
|
507
|
+
// ============================================================================
|
|
508
|
+
/**
|
|
509
|
+
* Check if a file is a test file based on common patterns
|
|
510
|
+
*
|
|
511
|
+
* @param path - The file path to check
|
|
512
|
+
* @returns true if the file appears to be a test file
|
|
513
|
+
*
|
|
514
|
+
* @example
|
|
515
|
+
* ```typescript
|
|
516
|
+
* this.isTestFile('Button.test.ts'); // true
|
|
517
|
+
* this.isTestFile('Button.spec.tsx'); // true
|
|
518
|
+
* this.isTestFile('__tests__/Button.ts'); // true
|
|
519
|
+
* this.isTestFile('Button.tsx'); // false
|
|
520
|
+
* ```
|
|
521
|
+
*/
|
|
522
|
+
isTestFile(path) {
|
|
523
|
+
const normalizedPath = this.normalizePath(path);
|
|
524
|
+
const fileName = this.getFileName(normalizedPath);
|
|
525
|
+
// Check for test/spec suffix
|
|
526
|
+
if (/\.(test|spec)$/.test(fileName)) {
|
|
527
|
+
return true;
|
|
528
|
+
}
|
|
529
|
+
// Check for __tests__ directory anywhere in path
|
|
530
|
+
if (normalizedPath.includes('__tests__/') || normalizedPath.startsWith('__tests__/')) {
|
|
531
|
+
return true;
|
|
532
|
+
}
|
|
533
|
+
// Check for test/ or tests/ directory at root
|
|
534
|
+
if (/^tests?\//.test(normalizedPath)) {
|
|
535
|
+
return true;
|
|
536
|
+
}
|
|
537
|
+
return false;
|
|
538
|
+
}
|
|
539
|
+
/**
|
|
540
|
+
* Check if a file is a type definition file
|
|
541
|
+
*
|
|
542
|
+
* @param path - The file path to check
|
|
543
|
+
* @returns true if the file is a type definition
|
|
544
|
+
*
|
|
545
|
+
* @example
|
|
546
|
+
* ```typescript
|
|
547
|
+
* this.isTypeDefinitionFile('types.d.ts'); // true
|
|
548
|
+
* this.isTypeDefinitionFile('index.d.ts'); // true
|
|
549
|
+
* this.isTypeDefinitionFile('Button.tsx'); // false
|
|
550
|
+
* ```
|
|
551
|
+
*/
|
|
552
|
+
isTypeDefinitionFile(path) {
|
|
553
|
+
return path.endsWith('.d.ts');
|
|
554
|
+
}
|
|
555
|
+
/**
|
|
556
|
+
* Check if a file is an index/barrel file
|
|
557
|
+
*
|
|
558
|
+
* @param path - The file path to check
|
|
559
|
+
* @returns true if the file is an index file
|
|
560
|
+
*
|
|
561
|
+
* @example
|
|
562
|
+
* ```typescript
|
|
563
|
+
* this.isIndexFile('index.ts'); // true
|
|
564
|
+
* this.isIndexFile('src/index.tsx'); // true
|
|
565
|
+
* this.isIndexFile('Button.tsx'); // false
|
|
566
|
+
* ```
|
|
567
|
+
*/
|
|
568
|
+
isIndexFile(path) {
|
|
569
|
+
const fileName = this.getFileName(path);
|
|
570
|
+
return fileName === 'index';
|
|
571
|
+
}
|
|
572
|
+
/**
|
|
573
|
+
* Check if a file is a configuration file
|
|
574
|
+
*
|
|
575
|
+
* @param path - The file path to check
|
|
576
|
+
* @returns true if the file appears to be a config file
|
|
577
|
+
*
|
|
578
|
+
* @example
|
|
579
|
+
* ```typescript
|
|
580
|
+
* this.isConfigFile('tsconfig.json'); // true
|
|
581
|
+
* this.isConfigFile('.eslintrc.js'); // true
|
|
582
|
+
* this.isConfigFile('vite.config.ts'); // true
|
|
583
|
+
* this.isConfigFile('Button.tsx'); // false
|
|
584
|
+
* ```
|
|
585
|
+
*/
|
|
586
|
+
isConfigFile(path) {
|
|
587
|
+
const fileName = this.getFileName(path) + this.getFileExtension(path);
|
|
588
|
+
// Common config file patterns
|
|
589
|
+
const configPatterns = [
|
|
590
|
+
/^\..*rc(\.js|\.json|\.yaml|\.yml)?$/, // .eslintrc, .prettierrc, etc.
|
|
591
|
+
/^.*\.config\.(js|ts|mjs|cjs|json)$/, // vite.config.ts, etc.
|
|
592
|
+
/^tsconfig.*\.json$/, // tsconfig.json, tsconfig.build.json
|
|
593
|
+
/^package\.json$/,
|
|
594
|
+
/^\.env(\..*)?$/, // .env, .env.local, etc.
|
|
595
|
+
/^jest\.config\.(js|ts|mjs|cjs)$/,
|
|
596
|
+
/^webpack\.config\.(js|ts)$/,
|
|
597
|
+
/^rollup\.config\.(js|ts|mjs)$/,
|
|
598
|
+
/^babel\.config\.(js|json|cjs)$/,
|
|
599
|
+
];
|
|
600
|
+
return configPatterns.some((pattern) => pattern.test(fileName));
|
|
601
|
+
}
|
|
602
|
+
// ============================================================================
|
|
603
|
+
// Location Conversion Helpers
|
|
604
|
+
// ============================================================================
|
|
605
|
+
/**
|
|
606
|
+
* Create a Location object for a file
|
|
607
|
+
*
|
|
608
|
+
* @param file - The file path
|
|
609
|
+
* @param line - Line number (1-indexed, default: 1)
|
|
610
|
+
* @param column - Column number (1-indexed, default: 1)
|
|
611
|
+
* @returns A Location object
|
|
612
|
+
*/
|
|
613
|
+
createFileLocation(file, line = 1, column = 1) {
|
|
614
|
+
return {
|
|
615
|
+
file,
|
|
616
|
+
line,
|
|
617
|
+
column,
|
|
618
|
+
};
|
|
619
|
+
}
|
|
620
|
+
// ============================================================================
|
|
621
|
+
// Private Helper Methods
|
|
622
|
+
// ============================================================================
|
|
623
|
+
/**
|
|
624
|
+
* Normalize a file path to use forward slashes
|
|
625
|
+
*/
|
|
626
|
+
normalizePath(path) {
|
|
627
|
+
return path.replace(/\\/g, '/').replace(/\/+/g, '/');
|
|
628
|
+
}
|
|
629
|
+
/**
|
|
630
|
+
* Convert a glob pattern to a regular expression
|
|
631
|
+
*/
|
|
632
|
+
globToRegex(pattern, options = {}) {
|
|
633
|
+
let regexStr = '';
|
|
634
|
+
let i = 0;
|
|
635
|
+
while (i < pattern.length) {
|
|
636
|
+
const char = pattern[i];
|
|
637
|
+
const nextChar = pattern[i + 1];
|
|
638
|
+
switch (char) {
|
|
639
|
+
case '*':
|
|
640
|
+
if (nextChar === '*') {
|
|
641
|
+
// ** matches anything including path separators
|
|
642
|
+
regexStr += '.*';
|
|
643
|
+
i += 2;
|
|
644
|
+
// Skip following slash if present
|
|
645
|
+
if (pattern[i] === '/') {
|
|
646
|
+
i++;
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
else {
|
|
650
|
+
// * matches anything except path separators
|
|
651
|
+
regexStr += options.isFileName ? '.*' : '[^/]*';
|
|
652
|
+
i++;
|
|
653
|
+
}
|
|
654
|
+
break;
|
|
655
|
+
case '?':
|
|
656
|
+
// ? matches a single character (not path separator)
|
|
657
|
+
regexStr += options.isFileName ? '.' : '[^/]';
|
|
658
|
+
i++;
|
|
659
|
+
break;
|
|
660
|
+
case '[':
|
|
661
|
+
// Character class
|
|
662
|
+
const closeBracket = pattern.indexOf(']', i);
|
|
663
|
+
if (closeBracket === -1) {
|
|
664
|
+
regexStr += '\\[';
|
|
665
|
+
i++;
|
|
666
|
+
}
|
|
667
|
+
else {
|
|
668
|
+
const charClass = pattern.slice(i, closeBracket + 1);
|
|
669
|
+
// Handle negation [!...] -> [^...]
|
|
670
|
+
if (charClass[1] === '!') {
|
|
671
|
+
regexStr += '[^' + charClass.slice(2);
|
|
672
|
+
}
|
|
673
|
+
else {
|
|
674
|
+
regexStr += charClass;
|
|
675
|
+
}
|
|
676
|
+
i = closeBracket + 1;
|
|
677
|
+
}
|
|
678
|
+
break;
|
|
679
|
+
case '{':
|
|
680
|
+
// Alternation {a,b,c}
|
|
681
|
+
const closeBrace = pattern.indexOf('}', i);
|
|
682
|
+
if (closeBrace === -1) {
|
|
683
|
+
regexStr += '\\{';
|
|
684
|
+
i++;
|
|
685
|
+
}
|
|
686
|
+
else {
|
|
687
|
+
const alternatives = pattern.slice(i + 1, closeBrace).split(',');
|
|
688
|
+
regexStr += '(?:' + alternatives.map((a) => this.escapeRegex(a)).join('|') + ')';
|
|
689
|
+
i = closeBrace + 1;
|
|
690
|
+
}
|
|
691
|
+
break;
|
|
692
|
+
case '.':
|
|
693
|
+
case '+':
|
|
694
|
+
case '^':
|
|
695
|
+
case '$':
|
|
696
|
+
case '(':
|
|
697
|
+
case ')':
|
|
698
|
+
case '|':
|
|
699
|
+
case '\\':
|
|
700
|
+
// Escape regex special characters
|
|
701
|
+
regexStr += '\\' + char;
|
|
702
|
+
i++;
|
|
703
|
+
break;
|
|
704
|
+
default:
|
|
705
|
+
regexStr += char;
|
|
706
|
+
i++;
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
const flags = options.caseInsensitive ? 'i' : '';
|
|
710
|
+
return new RegExp('^' + regexStr + '$', flags);
|
|
711
|
+
}
|
|
712
|
+
/**
|
|
713
|
+
* Escape special regex characters in a string
|
|
714
|
+
*/
|
|
715
|
+
escapeRegex(str) {
|
|
716
|
+
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
// ============================================================================
|
|
720
|
+
// Type Guards
|
|
721
|
+
// ============================================================================
|
|
722
|
+
/**
|
|
723
|
+
* Type guard to check if a detector is a structural detector
|
|
724
|
+
*
|
|
725
|
+
* @param detector - The detector to check
|
|
726
|
+
* @returns true if the detector is a StructuralDetector
|
|
727
|
+
*/
|
|
728
|
+
export function isStructuralDetector(detector) {
|
|
729
|
+
return detector.detectionMethod === 'structural';
|
|
730
|
+
}
|
|
731
|
+
//# sourceMappingURL=structural-detector.js.map
|