@nielspeter/eess-ts 0.2.1 → 0.5.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/README.md +61 -35
- package/dist/builders/call-rule-builder.d.ts +66 -26
- package/dist/builders/call-rule-builder.d.ts.map +1 -1
- package/dist/builders/call-rule-builder.js +75 -32
- package/dist/builders/call-rule-builder.js.map +1 -1
- package/dist/builders/class-rule-builder.d.ts +125 -26
- package/dist/builders/class-rule-builder.d.ts.map +1 -1
- package/dist/builders/class-rule-builder.js +141 -55
- package/dist/builders/class-rule-builder.js.map +1 -1
- package/dist/builders/correspondence-builder.d.ts +287 -0
- package/dist/builders/correspondence-builder.d.ts.map +1 -0
- package/dist/builders/correspondence-builder.js +385 -0
- package/dist/builders/correspondence-builder.js.map +1 -0
- package/dist/builders/correspondence-findings.d.ts +104 -0
- package/dist/builders/correspondence-findings.d.ts.map +1 -0
- package/dist/builders/correspondence-findings.js +301 -0
- package/dist/builders/correspondence-findings.js.map +1 -0
- package/dist/builders/cross-layer-builder.d.ts +99 -16
- package/dist/builders/cross-layer-builder.d.ts.map +1 -1
- package/dist/builders/cross-layer-builder.js +182 -35
- package/dist/builders/cross-layer-builder.js.map +1 -1
- package/dist/builders/function-rule-builder.d.ts +144 -25
- package/dist/builders/function-rule-builder.d.ts.map +1 -1
- package/dist/builders/function-rule-builder.js +177 -39
- package/dist/builders/function-rule-builder.js.map +1 -1
- package/dist/builders/jsx-rule-builder.d.ts +70 -14
- package/dist/builders/jsx-rule-builder.d.ts.map +1 -1
- package/dist/builders/jsx-rule-builder.js +73 -14
- package/dist/builders/jsx-rule-builder.js.map +1 -1
- package/dist/builders/module-rule-builder.d.ts +2 -2
- package/dist/builders/module-rule-builder.d.ts.map +1 -1
- package/dist/builders/module-rule-builder.js +16 -19
- package/dist/builders/module-rule-builder.js.map +1 -1
- package/dist/builders/scoped-function-rule-builder.d.ts +11 -0
- package/dist/builders/scoped-function-rule-builder.d.ts.map +1 -1
- package/dist/builders/scoped-function-rule-builder.js +12 -0
- package/dist/builders/scoped-function-rule-builder.js.map +1 -1
- package/dist/builders/slice-discovery-message.d.ts +36 -0
- package/dist/builders/slice-discovery-message.d.ts.map +1 -0
- package/dist/builders/slice-discovery-message.js +181 -0
- package/dist/builders/slice-discovery-message.js.map +1 -0
- package/dist/builders/slice-rule-builder.d.ts +151 -12
- package/dist/builders/slice-rule-builder.d.ts.map +1 -1
- package/dist/builders/slice-rule-builder.js +243 -35
- package/dist/builders/slice-rule-builder.js.map +1 -1
- package/dist/builders/type-rule-builder.d.ts +95 -24
- package/dist/builders/type-rule-builder.d.ts.map +1 -1
- package/dist/builders/type-rule-builder.js +109 -42
- package/dist/builders/type-rule-builder.js.map +1 -1
- package/dist/{helpers → builders}/within.d.ts +2 -2
- package/dist/builders/within.d.ts.map +1 -0
- package/dist/{helpers → builders}/within.js +1 -1
- package/dist/builders/within.js.map +1 -0
- package/dist/cli/commands/baseline.d.ts +8 -3
- package/dist/cli/commands/baseline.d.ts.map +1 -1
- package/dist/cli/commands/baseline.js +111 -7
- package/dist/cli/commands/baseline.js.map +1 -1
- package/dist/cli/commands/check.d.ts +7 -2
- package/dist/cli/commands/check.d.ts.map +1 -1
- package/dist/cli/commands/check.js +385 -47
- package/dist/cli/commands/check.js.map +1 -1
- package/dist/cli/commands/doctor.d.ts +29 -0
- package/dist/cli/commands/doctor.d.ts.map +1 -0
- package/dist/cli/commands/doctor.js +224 -0
- package/dist/cli/commands/doctor.js.map +1 -0
- package/dist/cli/commands/explain.d.ts +2 -1
- package/dist/cli/commands/explain.d.ts.map +1 -1
- package/dist/cli/commands/explain.js +19 -10
- package/dist/cli/commands/explain.js.map +1 -1
- package/dist/cli/commands/init.d.ts +9 -3
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +162 -137
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/import-rule-module.d.ts +29 -0
- package/dist/cli/import-rule-module.d.ts.map +1 -0
- package/dist/cli/import-rule-module.js +47 -0
- package/dist/cli/import-rule-module.js.map +1 -0
- package/dist/cli/index.d.ts +2 -2
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +101 -43
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/load-rules.d.ts +6 -11
- package/dist/cli/load-rules.d.ts.map +1 -1
- package/dist/cli/load-rules.js +25 -32
- package/dist/cli/load-rules.js.map +1 -1
- package/dist/cli/resolve-config.d.ts +0 -8
- package/dist/cli/resolve-config.d.ts.map +1 -1
- package/dist/cli/resolve-config.js +25 -55
- package/dist/cli/resolve-config.js.map +1 -1
- package/dist/cli/rule-file-findings.d.ts +178 -0
- package/dist/cli/rule-file-findings.d.ts.map +1 -0
- package/dist/cli/rule-file-findings.js +351 -0
- package/dist/cli/rule-file-findings.js.map +1 -0
- package/dist/cli/watch.d.ts +17 -34
- package/dist/cli/watch.d.ts.map +1 -1
- package/dist/cli/watch.js +14 -129
- package/dist/cli/watch.js.map +1 -1
- package/dist/conditions/body-analysis-function.d.ts.map +1 -1
- package/dist/conditions/body-analysis-function.js +16 -7
- package/dist/conditions/body-analysis-function.js.map +1 -1
- package/dist/conditions/body-analysis-module.d.ts.map +1 -1
- package/dist/conditions/body-analysis-module.js +14 -9
- package/dist/conditions/body-analysis-module.js.map +1 -1
- package/dist/conditions/body-analysis.d.ts.map +1 -1
- package/dist/conditions/body-analysis.js +16 -7
- package/dist/conditions/body-analysis.js.map +1 -1
- package/dist/conditions/call.d.ts.map +1 -1
- package/dist/conditions/call.js +41 -19
- package/dist/conditions/call.js.map +1 -1
- package/dist/conditions/catch-analysis.d.ts +2 -1
- package/dist/conditions/catch-analysis.d.ts.map +1 -1
- package/dist/conditions/catch-analysis.js.map +1 -1
- package/dist/conditions/cross-layer.d.ts +2 -10
- package/dist/conditions/cross-layer.d.ts.map +1 -1
- package/dist/conditions/cross-layer.js +227 -23
- package/dist/conditions/cross-layer.js.map +1 -1
- package/dist/conditions/dependency.d.ts +35 -6
- package/dist/conditions/dependency.d.ts.map +1 -1
- package/dist/conditions/dependency.js +299 -45
- package/dist/conditions/dependency.js.map +1 -1
- package/dist/conditions/exports.d.ts.map +1 -1
- package/dist/conditions/exports.js +41 -37
- package/dist/conditions/exports.js.map +1 -1
- package/dist/conditions/function.d.ts.map +1 -1
- package/dist/conditions/function.js +19 -5
- package/dist/conditions/function.js.map +1 -1
- package/dist/conditions/helpers.d.ts +2 -1
- package/dist/conditions/helpers.d.ts.map +1 -1
- package/dist/conditions/helpers.js +4 -1
- package/dist/conditions/helpers.js.map +1 -1
- package/dist/conditions/jsx.d.ts.map +1 -1
- package/dist/conditions/jsx.js +7 -2
- package/dist/conditions/jsx.js.map +1 -1
- package/dist/conditions/match-identity.d.ts +43 -0
- package/dist/conditions/match-identity.d.ts.map +1 -0
- package/dist/conditions/match-identity.js +43 -0
- package/dist/conditions/match-identity.js.map +1 -0
- package/dist/conditions/members.d.ts.map +1 -1
- package/dist/conditions/members.js +20 -6
- package/dist/conditions/members.js.map +1 -1
- package/dist/conditions/reverse-dependency.d.ts +18 -5
- package/dist/conditions/reverse-dependency.d.ts.map +1 -1
- package/dist/conditions/reverse-dependency.js +155 -93
- package/dist/conditions/reverse-dependency.js.map +1 -1
- package/dist/conditions/slice.d.ts +86 -2
- package/dist/conditions/slice.d.ts.map +1 -1
- package/dist/conditions/slice.js +234 -53
- package/dist/conditions/slice.js.map +1 -1
- package/dist/conditions/structural.d.ts.map +1 -1
- package/dist/conditions/structural.js +16 -4
- package/dist/conditions/structural.js.map +1 -1
- package/dist/core/check-all.d.ts +19 -0
- package/dist/core/check-all.d.ts.map +1 -0
- package/dist/core/check-all.js +150 -0
- package/dist/core/check-all.js.map +1 -0
- package/dist/core/combinators.d.ts +48 -0
- package/dist/core/combinators.d.ts.map +1 -0
- package/dist/core/combinators.js +49 -0
- package/dist/core/combinators.js.map +1 -0
- package/dist/core/descendant-cache.d.ts +36 -0
- package/dist/core/descendant-cache.d.ts.map +1 -0
- package/dist/core/descendant-cache.js +117 -0
- package/dist/core/descendant-cache.js.map +1 -0
- package/dist/core/diagnose.d.ts +234 -0
- package/dist/core/diagnose.d.ts.map +1 -0
- package/dist/core/diagnose.js +390 -0
- package/dist/core/diagnose.js.map +1 -0
- package/dist/core/disk-set.d.ts +48 -0
- package/dist/core/disk-set.d.ts.map +1 -0
- package/dist/core/disk-set.js +218 -0
- package/dist/core/disk-set.js.map +1 -0
- package/dist/core/element-cache.d.ts +75 -0
- package/dist/core/element-cache.d.ts.map +1 -0
- package/dist/core/element-cache.js +32 -0
- package/dist/core/element-cache.js.map +1 -0
- package/dist/core/empty-project-advice.d.ts +75 -0
- package/dist/core/empty-project-advice.d.ts.map +1 -0
- package/dist/core/empty-project-advice.js +61 -0
- package/dist/core/empty-project-advice.js.map +1 -0
- package/dist/core/exclusion-comments.d.ts +19 -0
- package/dist/core/exclusion-comments.d.ts.map +1 -0
- package/dist/core/exclusion-comments.js +7 -0
- package/dist/core/exclusion-comments.js.map +1 -0
- package/dist/core/execute-rule.d.ts +158 -0
- package/dist/core/execute-rule.d.ts.map +1 -0
- package/dist/core/execute-rule.js +666 -0
- package/dist/core/execute-rule.js.map +1 -0
- package/dist/core/glob-diagnosis.d.ts +78 -0
- package/dist/core/glob-diagnosis.d.ts.map +1 -0
- package/dist/core/glob-diagnosis.js +134 -0
- package/dist/core/glob-diagnosis.js.map +1 -0
- package/dist/core/glob-evaluator.d.ts +48 -0
- package/dist/core/glob-evaluator.d.ts.map +1 -0
- package/dist/core/glob-evaluator.js +89 -0
- package/dist/core/glob-evaluator.js.map +1 -0
- package/dist/core/import-candidates.d.ts +60 -0
- package/dist/core/import-candidates.d.ts.map +1 -0
- package/dist/core/import-candidates.js +93 -0
- package/dist/core/import-candidates.js.map +1 -0
- package/dist/core/import-options.d.ts +55 -2
- package/dist/core/import-options.d.ts.map +1 -1
- package/dist/core/import-options.js +64 -0
- package/dist/core/import-options.js.map +1 -1
- package/dist/core/invalidate-on-modify.d.ts +20 -0
- package/dist/core/invalidate-on-modify.d.ts.map +1 -0
- package/dist/core/invalidate-on-modify.js +26 -0
- package/dist/core/invalidate-on-modify.js.map +1 -0
- package/dist/core/line-index.d.ts +3 -0
- package/dist/core/line-index.d.ts.map +1 -0
- package/dist/core/line-index.js +227 -0
- package/dist/core/line-index.js.map +1 -0
- package/dist/core/metric-violation.d.ts +86 -0
- package/dist/core/metric-violation.d.ts.map +1 -0
- package/dist/core/metric-violation.js +132 -0
- package/dist/core/metric-violation.js.map +1 -0
- package/dist/core/module-edges.d.ts +361 -0
- package/dist/core/module-edges.d.ts.map +1 -0
- package/dist/core/module-edges.js +593 -0
- package/dist/core/module-edges.js.map +1 -0
- package/dist/core/object-literal-functions.d.ts +42 -0
- package/dist/core/object-literal-functions.d.ts.map +1 -0
- package/dist/core/object-literal-functions.js +75 -0
- package/dist/core/object-literal-functions.js.map +1 -0
- package/dist/core/orphan-exclusions.d.ts +44 -0
- package/dist/core/orphan-exclusions.d.ts.map +1 -0
- package/dist/core/orphan-exclusions.js +224 -0
- package/dist/core/orphan-exclusions.js.map +1 -0
- package/dist/core/pair-condition.d.ts +32 -3
- package/dist/core/pair-condition.d.ts.map +1 -1
- package/dist/core/path-universe.d.ts +22 -0
- package/dist/core/path-universe.d.ts.map +1 -0
- package/dist/core/path-universe.js +45 -0
- package/dist/core/path-universe.js.map +1 -0
- package/dist/core/per-root-compiler-options.d.ts +20 -0
- package/dist/core/per-root-compiler-options.d.ts.map +1 -0
- package/dist/core/per-root-compiler-options.js +57 -0
- package/dist/core/per-root-compiler-options.js.map +1 -0
- package/dist/core/project-relative.d.ts +98 -0
- package/dist/core/project-relative.d.ts.map +1 -0
- package/dist/core/project-relative.js +185 -0
- package/dist/core/project-relative.js.map +1 -0
- package/dist/core/project.d.ts +7 -1
- package/dist/core/project.d.ts.map +1 -1
- package/dist/core/project.js +29 -4
- package/dist/core/project.js.map +1 -1
- package/dist/core/rule-builder.d.ts +303 -0
- package/dist/core/rule-builder.d.ts.map +1 -0
- package/dist/core/rule-builder.js +463 -0
- package/dist/core/rule-builder.js.map +1 -0
- package/dist/core/rule-declaration.d.ts +32 -0
- package/dist/core/rule-declaration.d.ts.map +1 -0
- package/dist/core/rule-declaration.js +88 -0
- package/dist/core/rule-declaration.js.map +1 -0
- package/dist/core/terminal-builder.d.ts +629 -0
- package/dist/core/terminal-builder.d.ts.map +1 -0
- package/dist/core/terminal-builder.js +807 -0
- package/dist/core/terminal-builder.js.map +1 -0
- package/dist/core/terminal-execution.d.ts +39 -0
- package/dist/core/terminal-execution.d.ts.map +1 -0
- package/dist/core/terminal-execution.js +103 -0
- package/dist/core/terminal-execution.js.map +1 -0
- package/dist/core/ts-comment-mask.d.ts +2 -0
- package/dist/core/ts-comment-mask.d.ts.map +1 -0
- package/dist/core/ts-comment-mask.js +102 -0
- package/dist/core/ts-comment-mask.js.map +1 -0
- package/dist/core/vacuity-diagnosis.d.ts +103 -0
- package/dist/core/vacuity-diagnosis.d.ts.map +1 -0
- package/dist/core/vacuity-diagnosis.js +415 -0
- package/dist/core/vacuity-diagnosis.js.map +1 -0
- package/dist/core/violation.d.ts +16 -11
- package/dist/core/violation.d.ts.map +1 -1
- package/dist/core/violation.js +33 -13
- package/dist/core/violation.js.map +1 -1
- package/dist/graphql/graphql-rule-builder.d.ts +95 -0
- package/dist/graphql/graphql-rule-builder.d.ts.map +1 -0
- package/dist/graphql/graphql-rule-builder.js +127 -0
- package/dist/graphql/graphql-rule-builder.js.map +1 -0
- package/dist/graphql/index.d.ts +1 -0
- package/dist/graphql/index.d.ts.map +1 -1
- package/dist/graphql/index.js +2 -1
- package/dist/graphql/index.js.map +1 -1
- package/dist/graphql/resolver-rule-builder.d.ts +44 -23
- package/dist/graphql/resolver-rule-builder.d.ts.map +1 -1
- package/dist/graphql/resolver-rule-builder.js +80 -72
- package/dist/graphql/resolver-rule-builder.js.map +1 -1
- package/dist/graphql/schema-loader.d.ts +21 -0
- package/dist/graphql/schema-loader.d.ts.map +1 -1
- package/dist/graphql/schema-loader.js +82 -12
- package/dist/graphql/schema-loader.js.map +1 -1
- package/dist/graphql/schema-predicates.d.ts.map +1 -1
- package/dist/graphql/schema-predicates.js +17 -12
- package/dist/graphql/schema-predicates.js.map +1 -1
- package/dist/graphql/schema-rule-builder.d.ts +15 -24
- package/dist/graphql/schema-rule-builder.d.ts.map +1 -1
- package/dist/graphql/schema-rule-builder.js +39 -77
- package/dist/graphql/schema-rule-builder.js.map +1 -1
- package/dist/helpers/baseline-diagnostics.d.ts +45 -0
- package/dist/helpers/baseline-diagnostics.d.ts.map +1 -0
- package/dist/helpers/baseline-diagnostics.js +168 -0
- package/dist/helpers/baseline-diagnostics.js.map +1 -0
- package/dist/helpers/baseline-generator.d.ts +28 -0
- package/dist/helpers/baseline-generator.d.ts.map +1 -0
- package/dist/helpers/baseline-generator.js +27 -0
- package/dist/helpers/baseline-generator.js.map +1 -0
- package/dist/helpers/baseline.d.ts +336 -0
- package/dist/helpers/baseline.d.ts.map +1 -0
- package/dist/helpers/baseline.js +664 -0
- package/dist/helpers/baseline.js.map +1 -0
- package/dist/helpers/body-traversal.d.ts +27 -2
- package/dist/helpers/body-traversal.d.ts.map +1 -1
- package/dist/helpers/body-traversal.js +135 -16
- package/dist/helpers/body-traversal.js.map +1 -1
- package/dist/helpers/callback-extractor.d.ts.map +1 -1
- package/dist/helpers/callback-extractor.js +53 -84
- package/dist/helpers/callback-extractor.js.map +1 -1
- package/dist/helpers/complexity.d.ts +13 -5
- package/dist/helpers/complexity.d.ts.map +1 -1
- package/dist/helpers/complexity.js +15 -6
- package/dist/helpers/complexity.js.map +1 -1
- package/dist/helpers/diff-aware.d.ts +16 -0
- package/dist/helpers/diff-aware.d.ts.map +1 -0
- package/dist/helpers/diff-aware.js +16 -0
- package/dist/helpers/diff-aware.js.map +1 -0
- package/dist/helpers/matchers.d.ts +68 -7
- package/dist/helpers/matchers.d.ts.map +1 -1
- package/dist/helpers/matchers.js +164 -86
- package/dist/helpers/matchers.js.map +1 -1
- package/dist/helpers/slice-graph.d.ts +100 -8
- package/dist/helpers/slice-graph.d.ts.map +1 -1
- package/dist/helpers/slice-graph.js +126 -34
- package/dist/helpers/slice-graph.js.map +1 -1
- package/dist/helpers/tarjan.d.ts +0 -14
- package/dist/helpers/tarjan.d.ts.map +1 -1
- package/dist/helpers/tarjan.js +29 -16
- package/dist/helpers/tarjan.js.map +1 -1
- package/dist/index.d.ts +55 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +67 -15
- package/dist/index.js.map +1 -1
- package/dist/models/arch-call.d.ts +3 -2
- package/dist/models/arch-call.d.ts.map +1 -1
- package/dist/models/arch-call.js.map +1 -1
- package/dist/models/arch-function.d.ts +54 -8
- package/dist/models/arch-function.d.ts.map +1 -1
- package/dist/models/arch-function.js +145 -8
- package/dist/models/arch-function.js.map +1 -1
- package/dist/models/arch-jsx-element.d.ts.map +1 -1
- package/dist/models/arch-jsx-element.js +18 -19
- package/dist/models/arch-jsx-element.js.map +1 -1
- package/dist/models/slice.d.ts +33 -9
- package/dist/models/slice.d.ts.map +1 -1
- package/dist/models/slice.js +129 -19
- package/dist/models/slice.js.map +1 -1
- package/dist/predicates/call.d.ts.map +1 -1
- package/dist/predicates/call.js +5 -0
- package/dist/predicates/call.js.map +1 -1
- package/dist/predicates/identity.d.ts +21 -0
- package/dist/predicates/identity.d.ts.map +1 -1
- package/dist/predicates/identity.js +75 -3
- package/dist/predicates/identity.js.map +1 -1
- package/dist/predicates/index.d.ts +1 -1
- package/dist/predicates/index.d.ts.map +1 -1
- package/dist/predicates/index.js +1 -1
- package/dist/predicates/index.js.map +1 -1
- package/dist/predicates/jsx.d.ts.map +1 -1
- package/dist/predicates/jsx.js +2 -1
- package/dist/predicates/jsx.js.map +1 -1
- package/dist/predicates/metrics.d.ts +4 -2
- package/dist/predicates/metrics.d.ts.map +1 -1
- package/dist/predicates/metrics.js +4 -2
- package/dist/predicates/metrics.js.map +1 -1
- package/dist/predicates/module.d.ts +4 -12
- package/dist/predicates/module.d.ts.map +1 -1
- package/dist/predicates/module.js +57 -37
- package/dist/predicates/module.js.map +1 -1
- package/dist/presets/agent-guardrails.d.ts +49 -16
- package/dist/presets/agent-guardrails.d.ts.map +1 -1
- package/dist/presets/agent-guardrails.js +308 -19
- package/dist/presets/agent-guardrails.js.map +1 -1
- package/dist/presets/boundaries.d.ts +46 -3
- package/dist/presets/boundaries.d.ts.map +1 -1
- package/dist/presets/boundaries.js +132 -23
- package/dist/presets/boundaries.js.map +1 -1
- package/dist/presets/data-layer.d.ts +23 -3
- package/dist/presets/data-layer.d.ts.map +1 -1
- package/dist/presets/data-layer.js +58 -16
- package/dist/presets/data-layer.js.map +1 -1
- package/dist/presets/index.d.ts +10 -5
- package/dist/presets/index.d.ts.map +1 -1
- package/dist/presets/index.js +19 -3
- package/dist/presets/index.js.map +1 -1
- package/dist/presets/layered.d.ts +47 -3
- package/dist/presets/layered.d.ts.map +1 -1
- package/dist/presets/layered.js +66 -29
- package/dist/presets/layered.js.map +1 -1
- package/dist/presets/recommended.d.ts +81 -10
- package/dist/presets/recommended.d.ts.map +1 -1
- package/dist/presets/recommended.js +25 -23
- package/dist/presets/recommended.js.map +1 -1
- package/dist/presets/shared.d.ts +267 -2
- package/dist/presets/shared.d.ts.map +1 -1
- package/dist/presets/shared.js +367 -4
- package/dist/presets/shared.js.map +1 -1
- package/dist/rules/code-quality.d.ts.map +1 -1
- package/dist/rules/code-quality.js +15 -6
- package/dist/rules/code-quality.js.map +1 -1
- package/dist/rules/hygiene.d.ts +1 -1
- package/dist/rules/hygiene.js +1 -1
- package/dist/rules/metrics-function.d.ts +2 -1
- package/dist/rules/metrics-function.d.ts.map +1 -1
- package/dist/rules/metrics-function.js +63 -39
- package/dist/rules/metrics-function.js.map +1 -1
- package/dist/rules/metrics.d.ts +2 -1
- package/dist/rules/metrics.d.ts.map +1 -1
- package/dist/rules/metrics.js +80 -47
- package/dist/rules/metrics.js.map +1 -1
- package/dist/smells/clusters.d.ts +78 -0
- package/dist/smells/clusters.d.ts.map +1 -0
- package/dist/smells/clusters.js +124 -0
- package/dist/smells/clusters.js.map +1 -0
- package/dist/smells/duplicate-bodies.d.ts +92 -5
- package/dist/smells/duplicate-bodies.d.ts.map +1 -1
- package/dist/smells/duplicate-bodies.js +203 -73
- package/dist/smells/duplicate-bodies.js.map +1 -1
- package/dist/smells/duplicate-report.d.ts +90 -0
- package/dist/smells/duplicate-report.d.ts.map +1 -0
- package/dist/smells/duplicate-report.js +344 -0
- package/dist/smells/duplicate-report.js.map +1 -0
- package/dist/smells/fingerprint.d.ts +20 -1
- package/dist/smells/fingerprint.d.ts.map +1 -1
- package/dist/smells/fingerprint.js +27 -3
- package/dist/smells/fingerprint.js.map +1 -1
- package/dist/smells/inconsistent-siblings.d.ts +128 -7
- package/dist/smells/inconsistent-siblings.d.ts.map +1 -1
- package/dist/smells/inconsistent-siblings.js +288 -86
- package/dist/smells/inconsistent-siblings.js.map +1 -1
- package/dist/smells/sibling-files.d.ts +47 -0
- package/dist/smells/sibling-files.d.ts.map +1 -0
- package/dist/smells/sibling-files.js +104 -0
- package/dist/smells/sibling-files.js.map +1 -0
- package/dist/smells/similar-pairs.d.ts +28 -0
- package/dist/smells/similar-pairs.d.ts.map +1 -0
- package/dist/smells/similar-pairs.js +134 -0
- package/dist/smells/similar-pairs.js.map +1 -0
- package/dist/smells/smell-builder.d.ts +57 -12
- package/dist/smells/smell-builder.d.ts.map +1 -1
- package/dist/smells/smell-builder.js +112 -14
- package/dist/smells/smell-builder.js.map +1 -1
- package/dist/smells/variation.d.ts +47 -0
- package/dist/smells/variation.d.ts.map +1 -0
- package/dist/smells/variation.js +90 -0
- package/dist/smells/variation.js.map +1 -0
- package/dist/tsconfig/index.d.ts +19 -0
- package/dist/tsconfig/index.d.ts.map +1 -0
- package/dist/tsconfig/index.js +20 -0
- package/dist/tsconfig/index.js.map +1 -0
- package/dist/tsconfig/tsconfig-builder.d.ts +42 -9
- package/dist/tsconfig/tsconfig-builder.d.ts.map +1 -1
- package/dist/tsconfig/tsconfig-builder.js +65 -16
- package/dist/tsconfig/tsconfig-builder.js.map +1 -1
- package/package.json +4 -2
- package/dist/core/module-dependencies.d.ts +0 -28
- package/dist/core/module-dependencies.d.ts.map +0 -1
- package/dist/core/module-dependencies.js +0 -35
- package/dist/core/module-dependencies.js.map +0 -1
- package/dist/helpers/within.d.ts.map +0 -1
- package/dist/helpers/within.js.map +0 -1
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import picomatch from 'picomatch';
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
2
|
+
import { Node } from 'ts-morph';
|
|
3
|
+
import { moduleEdges } from '../core/module-edges.js';
|
|
4
|
+
import { recordEdgeCoverage } from '@nielspeter/eess/internal';
|
|
5
|
+
import { globAnyOf } from '@nielspeter/eess';
|
|
6
|
+
import { relativeToRoot } from '../core/project-relative.js';
|
|
4
7
|
const graphCache = new WeakMap();
|
|
5
8
|
/**
|
|
6
9
|
* Build or retrieve the reverse import graph for a project.
|
|
@@ -11,93 +14,26 @@ const graphCache = new WeakMap();
|
|
|
11
14
|
* when resetProjectCache() creates new ArchProject instances (WeakMap GC).
|
|
12
15
|
*/
|
|
13
16
|
/**
|
|
14
|
-
* Add an edge to the reverse import graph: targetPath is
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
+
* Add an edge to the reverse import graph: `targetPath` is referenced by `sf`.
|
|
18
|
+
*
|
|
19
|
+
* **Always deduplicated, on `(importer, target)`.** It used to take a flag, and
|
|
20
|
+
* static imports passed `false`: one target, one importer, two static imports
|
|
21
|
+
* produced **two byte-identical violations at the same `file:line`** — measured —
|
|
22
|
+
* and therefore two identical baseline hashes for one fact. The flag existed
|
|
23
|
+
* because re-exports were indexed in a second pass that could re-add the same
|
|
24
|
+
* pair; now that every kind comes from one `edgesOf` pass, one file referencing
|
|
25
|
+
* one target N ways is one reverse edge.
|
|
17
26
|
*/
|
|
18
|
-
function addToGraph(graph, targetPath, sf
|
|
27
|
+
function addToGraph(graph, targetPath, sf) {
|
|
19
28
|
const existing = graph.get(targetPath);
|
|
20
29
|
if (existing) {
|
|
21
|
-
if (!
|
|
30
|
+
if (!existing.includes(sf))
|
|
22
31
|
existing.push(sf);
|
|
23
|
-
}
|
|
24
32
|
}
|
|
25
33
|
else {
|
|
26
34
|
graph.set(targetPath, [sf]);
|
|
27
35
|
}
|
|
28
36
|
}
|
|
29
|
-
/**
|
|
30
|
-
* Resolve a dynamic import specifier to a project source file.
|
|
31
|
-
*
|
|
32
|
-
* Handles relative specifiers with ESM extension mappings (.js→.ts, .jsx→.tsx,
|
|
33
|
-
* .mjs→.mts) and directory index imports. Non-relative specifiers (bare packages)
|
|
34
|
-
* are skipped — they resolve to node_modules, which are outside the project.
|
|
35
|
-
*/
|
|
36
|
-
function resolveDynamicImport(fromFile, specifier) {
|
|
37
|
-
if (!specifier.startsWith('.'))
|
|
38
|
-
return undefined;
|
|
39
|
-
const dirPath = fromFile.getDirectory().getPath();
|
|
40
|
-
const project = fromFile.getProject();
|
|
41
|
-
// Try the specifier as-is, with ESM extension mappings, and as a directory index
|
|
42
|
-
const candidates = [
|
|
43
|
-
specifier,
|
|
44
|
-
specifier.replace(/\.js$/, '.ts'),
|
|
45
|
-
specifier.replace(/\.jsx$/, '.tsx'),
|
|
46
|
-
specifier.replace(/\.mjs$/, '.mts'),
|
|
47
|
-
specifier + '.ts',
|
|
48
|
-
specifier + '.tsx',
|
|
49
|
-
specifier + '/index.ts',
|
|
50
|
-
specifier + '/index.tsx',
|
|
51
|
-
];
|
|
52
|
-
for (const candidate of candidates) {
|
|
53
|
-
const absolutePath = nodePath.resolve(dirPath, candidate);
|
|
54
|
-
const resolved = project.getSourceFile(absolutePath);
|
|
55
|
-
if (resolved)
|
|
56
|
-
return resolved;
|
|
57
|
-
}
|
|
58
|
-
return undefined;
|
|
59
|
-
}
|
|
60
|
-
/** Index static import declarations from a source file into the reverse graph. */
|
|
61
|
-
function indexStaticImports(graph, sf) {
|
|
62
|
-
for (const decl of sf.getImportDeclarations()) {
|
|
63
|
-
const resolved = decl.getModuleSpecifierSourceFile();
|
|
64
|
-
if (!resolved)
|
|
65
|
-
continue;
|
|
66
|
-
addToGraph(graph, resolved.getFilePath(), sf, false);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
/** Index re-export declarations from a source file into the reverse graph. */
|
|
70
|
-
function indexReExports(graph, sf) {
|
|
71
|
-
for (const decl of sf.getExportDeclarations()) {
|
|
72
|
-
const resolved = decl.getModuleSpecifierSourceFile();
|
|
73
|
-
if (!resolved)
|
|
74
|
-
continue;
|
|
75
|
-
addToGraph(graph, resolved.getFilePath(), sf, true);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
/** Index dynamic import() expressions from a source file into the reverse graph. */
|
|
79
|
-
function indexDynamicImports(graph, sf) {
|
|
80
|
-
for (const callExpr of sf.getDescendantsOfKind(SyntaxKind.CallExpression)) {
|
|
81
|
-
if (callExpr.getExpression().getKind() !== SyntaxKind.ImportKeyword)
|
|
82
|
-
continue;
|
|
83
|
-
const args = callExpr.getArguments();
|
|
84
|
-
if (args.length === 0)
|
|
85
|
-
continue;
|
|
86
|
-
const arg = args[0];
|
|
87
|
-
if (!arg)
|
|
88
|
-
continue;
|
|
89
|
-
let specifier;
|
|
90
|
-
if (Node.isStringLiteral(arg) || Node.isNoSubstitutionTemplateLiteral(arg)) {
|
|
91
|
-
specifier = arg.getLiteralValue();
|
|
92
|
-
}
|
|
93
|
-
if (specifier === undefined)
|
|
94
|
-
continue;
|
|
95
|
-
const resolved = resolveDynamicImport(sf, specifier);
|
|
96
|
-
if (resolved) {
|
|
97
|
-
addToGraph(graph, resolved.getFilePath(), sf, true);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
37
|
function getReverseImportGraph(sourceFiles) {
|
|
102
38
|
if (sourceFiles.length === 0)
|
|
103
39
|
return new Map();
|
|
@@ -109,10 +45,32 @@ function getReverseImportGraph(sourceFiles) {
|
|
|
109
45
|
if (cached)
|
|
110
46
|
return cached;
|
|
111
47
|
const graph = new Map();
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
48
|
+
// **Every kind counts here, `require` and `type-expression` included** — the
|
|
49
|
+
// opposite of the forward conditions, and deliberately so. The two directions
|
|
50
|
+
// ask different questions:
|
|
51
|
+
//
|
|
52
|
+
// | direction | question | a `require` edge means |
|
|
53
|
+
// | --------- | ------------------------------------------ | ------------------------------- |
|
|
54
|
+
// | forward | does this file depend on something banned? | a finding with no usable remedy |
|
|
55
|
+
// | reverse | is anything referencing this file? | **yes** — it is not dead |
|
|
56
|
+
//
|
|
57
|
+
// Excluding `require` here would report a module that CJS code requires as an
|
|
58
|
+
// orphan, and excluding `type-expression` would report one that only a type
|
|
59
|
+
// position references — both false positives, and deleting either module breaks
|
|
60
|
+
// the build. The forward exclusion avoids an unactionable finding; the same
|
|
61
|
+
// exclusion here would manufacture a wrong one.
|
|
62
|
+
//
|
|
63
|
+
// The one caller that genuinely has a file SET, so it is the one that uses the
|
|
64
|
+
// bulk entry point. `moduleEdges` was previously called by nothing in `src/` —
|
|
65
|
+
// every site used the per-file `edgesOf`, including this loop — which made its
|
|
66
|
+
// "one crossing rather than N" docstring a claim about code that did not exist.
|
|
67
|
+
const byFile = moduleEdges(sourceFiles);
|
|
68
|
+
for (const importer of sourceFiles) {
|
|
69
|
+
for (const edge of byFile.get(importer.getFilePath()) ?? []) {
|
|
70
|
+
if (edge.resolvedPath === undefined)
|
|
71
|
+
continue;
|
|
72
|
+
addToGraph(graph, edge.resolvedPath, importer);
|
|
73
|
+
}
|
|
116
74
|
}
|
|
117
75
|
graphCache.set(project, graph);
|
|
118
76
|
return graph;
|
|
@@ -127,13 +85,27 @@ function getReverseImportGraph(sourceFiles) {
|
|
|
127
85
|
* Modules with zero importers pass vacuously. Chain `.andShould().beImported()`
|
|
128
86
|
* if you also want to catch orphaned files.
|
|
129
87
|
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
88
|
+
* **Every kind of reference counts here**: `import`, `export … from`, `import()`,
|
|
89
|
+
* `type X = import('…').Y`, and **`require()`** — both `require('s')` in a `.js`
|
|
90
|
+
* file and `import x = require('s')`. Only a computed specifier
|
|
91
|
+
* (`import('./' + name)`) is invisible, because there is no specifier to
|
|
92
|
+
* resolve, along with a `declare module './rel.js'` augmentation.
|
|
93
|
+
*
|
|
94
|
+
* That is wider than the *forward* dependency conditions, which exclude
|
|
95
|
+
* `require` — deliberately, and see `indexEdges` for why the same exclusion
|
|
96
|
+
* would be wrong here.
|
|
132
97
|
*/
|
|
133
98
|
export function onlyBeImportedVia(...globs) {
|
|
134
99
|
const matchers = globs.map((g) => picomatch(g));
|
|
135
100
|
const quotedGlobs = globs.map((g) => `"${g}"`).join(', ');
|
|
136
101
|
return {
|
|
102
|
+
// `file-path`, NOT `import-target` — and this is the row to get right. The glob
|
|
103
|
+
// names the FILES ALLOWED TO IMPORT the subject, matched against an importer's own
|
|
104
|
+
// path, so unlike the four dependency conditions it is a genuine path glob with
|
|
105
|
+
// real path-universe views. Declaring it as `import-target` would hand a checkable
|
|
106
|
+
// glob to machinery that has no views for that kind, which fails silently in the
|
|
107
|
+
// direction that looks fine (plan 0073).
|
|
108
|
+
globs: globAnyOf(globs, 'file-path'),
|
|
137
109
|
description: `only be imported via ${quotedGlobs}`,
|
|
138
110
|
evaluate(elements, context) {
|
|
139
111
|
// Build graph from ALL project files, not just the filtered elements
|
|
@@ -141,22 +113,61 @@ export function onlyBeImportedVia(...globs) {
|
|
|
141
113
|
const allFiles = first ? first.getProject().getSourceFiles() : [];
|
|
142
114
|
const graph = getReverseImportGraph(allFiles);
|
|
143
115
|
const violations = [];
|
|
116
|
+
// Bug 0015: the mirror case — a module with no importers passes however
|
|
117
|
+
// broken the allowlist. This condition already documented the behaviour
|
|
118
|
+
// ("Modules with zero importers pass vacuously") without treating it as a
|
|
119
|
+
// gap; the tally is what turns that note into something a reader sees.
|
|
120
|
+
let tested = 0;
|
|
144
121
|
for (const sf of elements) {
|
|
145
122
|
const importers = graph.get(sf.getFilePath()) ?? [];
|
|
146
123
|
for (const importer of importers) {
|
|
124
|
+
tested++;
|
|
147
125
|
const importerPath = importer.getFilePath();
|
|
148
|
-
|
|
126
|
+
// Also the importer's path named from the project root — bug 0036.
|
|
127
|
+
// This glob is matched against an ABSOLUTE path, so a
|
|
128
|
+
// project-relative one could never match and every importer was
|
|
129
|
+
// reported: measured, `onlyBeImportedVia('src/**')` produced 5
|
|
130
|
+
// violations where `'**/src/**'` produced none. A false red, the same
|
|
131
|
+
// shape as bug 0037 one layer over.
|
|
132
|
+
const fromRoot = relativeToRoot(importer, importerPath);
|
|
133
|
+
const matched = matchers.some((m) => m(importerPath)) ||
|
|
134
|
+
(fromRoot !== undefined && matchers.some((m) => m(fromRoot)));
|
|
135
|
+
if (!matched) {
|
|
149
136
|
violations.push({
|
|
150
137
|
rule: context.rule,
|
|
151
138
|
element: sf.getBaseName(),
|
|
152
139
|
file: sf.getFilePath(),
|
|
153
140
|
line: 1,
|
|
154
|
-
|
|
141
|
+
// The importer by PATH, not by basename — and the message is the only place it
|
|
142
|
+
// can appear, because `element`, `file` and `line` all describe the TARGET.
|
|
143
|
+
//
|
|
144
|
+
// Two importers sharing a filename produced findings that were byte-identical on
|
|
145
|
+
// screen: same element, same file, same line, same message. Measured, and worse
|
|
146
|
+
// in the two surfaces that matter most — `check --format json` emitted two
|
|
147
|
+
// identical objects, and `format-github` emitted two identical `::error` lines,
|
|
148
|
+
// which GitHub renders as ONE annotation, so in a PR's Files view the second
|
|
149
|
+
// finding did not exist at all.
|
|
150
|
+
//
|
|
151
|
+
// That was survivable while the two shared a baseline entry and only one was
|
|
152
|
+
// ever reported. Once `disambiguateIdentities` gives them separate entries the
|
|
153
|
+
// hidden sibling surfaces — and an adopter is handed a red identical to one they
|
|
154
|
+
// already accepted, pointing at the victim rather than the offender, with no way
|
|
155
|
+
// to tell which importer is new. The release that makes a finding visible owns
|
|
156
|
+
// making it readable.
|
|
157
|
+
//
|
|
158
|
+
// `element` is deliberately left as the basename: `.excluding()` matches on
|
|
159
|
+
// `element`/`file`/`message`, so promoting it to a path would silently break
|
|
160
|
+
// every `.excluding('index.ts')` in the wild. Changing the MESSAGE breaks an
|
|
161
|
+
// exact-string message exclusion, which surfaces as an unused-pattern warning
|
|
162
|
+
// rather than failing open — the acceptable direction, and stated in the
|
|
163
|
+
// upgrading row.
|
|
164
|
+
message: `${sf.getBaseName()} is imported by ${fromRoot ?? importerPath} which does not match [${globs.join(', ')}]`,
|
|
155
165
|
because: context.because,
|
|
156
166
|
});
|
|
157
167
|
}
|
|
158
168
|
}
|
|
159
169
|
}
|
|
170
|
+
recordEdgeCoverage(context.rule, elements.length, tested);
|
|
160
171
|
return violations;
|
|
161
172
|
},
|
|
162
173
|
};
|
|
@@ -167,9 +178,15 @@ export function onlyBeImportedVia(...globs) {
|
|
|
167
178
|
* Detects dead/orphaned modules that nobody references.
|
|
168
179
|
* Use `.excluding('index.ts', 'main.ts')` to skip entry points.
|
|
169
180
|
*
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
*
|
|
181
|
+
* **A module referenced by any kind of edge is not dead**, including
|
|
182
|
+
* `export … from`, `import()`, a type-only reference, and `require()` in either
|
|
183
|
+
* spelling. Since v0.28.0 that means **fewer** false orphans than before — if
|
|
184
|
+
* you carry `.excluding()` entries for modules only reachable via `require()` or
|
|
185
|
+
* a re-export, they are no longer needed.
|
|
186
|
+
*
|
|
187
|
+
* Two shapes are still invisible and will be falsely reported: a computed
|
|
188
|
+
* specifier (`import('./' + name)`), and a module referenced only from a
|
|
189
|
+
* `declare module './rel.js'` augmentation.
|
|
173
190
|
*/
|
|
174
191
|
export function beImported() {
|
|
175
192
|
return {
|
|
@@ -208,6 +225,51 @@ export function beImported() {
|
|
|
208
225
|
* **Note:** Default exports are excluded from this check. Use `beImported()` for
|
|
209
226
|
* file-level dead code detection. Only named exports are analyzed.
|
|
210
227
|
*/
|
|
228
|
+
/**
|
|
229
|
+
* The line a finding about export `name` of `sf` is anchored at — bug 0265.
|
|
230
|
+
*
|
|
231
|
+
* `getExportedDeclarations()` follows a re-export to the DECLARING node in the
|
|
232
|
+
* other file, so that node's line is a line of the other file. A finding whose
|
|
233
|
+
* `file` is the barrel must carry a line of the barrel: the `export { name }
|
|
234
|
+
* from` specifier, the `export * as name from` statement, or the `export *`
|
|
235
|
+
* statement that forwards it. An own declaration keeps its own line. Measured
|
|
236
|
+
* before this existed: a one-line barrel reported its re-export at line 5,
|
|
237
|
+
* where the code frame pointed at nothing and an `// eess-exclude` on the
|
|
238
|
+
* barrel's real line did not apply (the 0242 shape, fail-closed).
|
|
239
|
+
*/
|
|
240
|
+
function exportSiteLine(sf, name, declaration) {
|
|
241
|
+
if (Node.isNode(declaration) && declaration.getSourceFile() === sf) {
|
|
242
|
+
return declaration.getStartLineNumber();
|
|
243
|
+
}
|
|
244
|
+
let star;
|
|
245
|
+
for (const exportDecl of sf.getExportDeclarations()) {
|
|
246
|
+
const specifier = exportDecl
|
|
247
|
+
.getNamedExports()
|
|
248
|
+
.find((s) => (s.getAliasNode()?.getText() ?? s.getName()) === name);
|
|
249
|
+
if (specifier !== undefined)
|
|
250
|
+
return specifier.getStartLineNumber();
|
|
251
|
+
// `getNamespaceExport()`, NOT `isNamespaceExport()`. The latter is
|
|
252
|
+
// `!hasNamedExports()`, so it is TRUE for a bare `export * from 's'` — and
|
|
253
|
+
// the first cut of this function tested it, took the namespace branch for
|
|
254
|
+
// the star form, matched no name, and fell through to the declaring file's
|
|
255
|
+
// line. Measured on the isolated star fixture: line 5 under a two-line
|
|
256
|
+
// barrel, which is the exact defect this function exists to remove.
|
|
257
|
+
const namespaceExport = exportDecl.getNamespaceExport();
|
|
258
|
+
if (namespaceExport !== undefined) {
|
|
259
|
+
if (namespaceExport.getName() === name)
|
|
260
|
+
return exportDecl.getStartLineNumber();
|
|
261
|
+
}
|
|
262
|
+
else if (exportDecl.getNamedExports().length === 0 &&
|
|
263
|
+
exportDecl.getModuleSpecifier() !== undefined) {
|
|
264
|
+
// `export * from 's'` forwards every name of the target, so it is the site
|
|
265
|
+
// for any name no specifier above claimed. First one wins, in source order.
|
|
266
|
+
star ??= exportDecl.getStartLineNumber();
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
if (star !== undefined)
|
|
270
|
+
return star;
|
|
271
|
+
return Node.isNode(declaration) ? declaration.getStartLineNumber() : 1;
|
|
272
|
+
}
|
|
211
273
|
/**
|
|
212
274
|
* Scan a single source file for unused named exports, returning violations.
|
|
213
275
|
*/
|
|
@@ -217,11 +279,11 @@ function findUnusedExportsInFile(sf, context) {
|
|
|
217
279
|
for (const [name, declarations] of exportMap) {
|
|
218
280
|
if (name === 'default')
|
|
219
281
|
continue;
|
|
220
|
-
const firstDecl = declarations
|
|
282
|
+
const [firstDecl] = declarations;
|
|
221
283
|
if (firstDecl === undefined)
|
|
222
284
|
continue;
|
|
223
285
|
if (!hasExternalReference(firstDecl, sf)) {
|
|
224
|
-
const line =
|
|
286
|
+
const line = exportSiteLine(sf, name, firstDecl);
|
|
225
287
|
violations.push({
|
|
226
288
|
rule: context.rule,
|
|
227
289
|
element: sf.getBaseName(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reverse-dependency.js","sourceRoot":"","sources":["../../src/conditions/reverse-dependency.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,WAAW,CAAA;AACjC,OAAO,
|
|
1
|
+
{"version":3,"file":"reverse-dependency.js","sourceRoot":"","sources":["../../src/conditions/reverse-dependency.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,WAAW,CAAA;AACjC,OAAO,EAA4D,IAAI,EAAE,MAAM,UAAU,CAAA;AAGzF,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAC9D,OAAO,EAAE,SAAS,EAA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,EAAE,OAAO,CAAC,OAAO;aACzB,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;IAED,OAAO,UAAU,CAAA;AACnB,CAAC;AAED,MAAM,UAAU,mBAAmB;IACjC,OAAO;QACL,WAAW,EAAE,wBAAwB;QACrC,QAAQ,CAAC,QAAsB,EAAE,OAAyB;YACxD,MAAM,UAAU,GAAoB,EAAE,CAAA;YACtC,KAAK,MAAM,EAAE,IAAI,QAAQ,EAAE,CAAC;gBAC1B,UAAU,CAAC,IAAI,CAAC,GAAG,uBAAuB,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC,CAAA;YAC1D,CAAC;YACD,OAAO,UAAU,CAAA;QACnB,CAAC;KACF,CAAA;AACH,CAAC;AAED;;;;;;GAMG;AACH,SAAS,oBAAoB,CAAC,WAAiB,EAAE,UAAsB;IACrE,MAAM,QAAQ,GAAG,UAAU,CAAC,WAAW,EAAE,CAAA;IACzC,MAAM,eAAe,GAAG,UAAU,CAAC,UAAU,EAAE,CAAC,kBAAkB,EAAE,CAAA;IAEpE,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,eAAe,CAAC,qBAAqB,CAAC,WAAW,CAAC,CAAA;QAC/D,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;YACvB,IAAI,GAAG,CAAC,aAAa,EAAE,CAAC,WAAW,EAAE,KAAK,QAAQ,EAAE,CAAC;gBACnD,OAAO,IAAI,CAAA,CAAC,gBAAgB;YAC9B,CAAC;QACH,CAAC;IACH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,KAAK,GAAG,CAAA,CAAC,oDAAoD;QAC7D,2EAA2E;QAC3E,iDAAiD;QACjD,OAAO,IAAI,CAAA;IACb,CAAC;IAED,OAAO,KAAK,CAAA;AACd,CAAC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { Condition } from '@nielspeter/eess';
|
|
2
2
|
import type { Slice } from '../models/slice.js';
|
|
3
|
+
import type { ImportOptions } from '../core/import-options.js';
|
|
3
4
|
/**
|
|
4
5
|
* Assert that no circular dependencies exist between slices.
|
|
5
6
|
*
|
|
6
|
-
* Builds a directed dependency graph from
|
|
7
|
+
* Builds a directed dependency graph from imports and re-exports,
|
|
7
8
|
* then runs Tarjan's SCC algorithm to detect cycles.
|
|
8
9
|
* Each cycle produces a violation listing the cycle path.
|
|
9
10
|
*
|
|
@@ -13,10 +14,82 @@ import type { Slice } from '../models/slice.js';
|
|
|
13
14
|
* .should().beFreeOfCycles()
|
|
14
15
|
* .check()
|
|
15
16
|
*/
|
|
16
|
-
|
|
17
|
+
/**
|
|
18
|
+
* `canonicalizeCycle` lived here, and sorting replaced it — bug 0056.
|
|
19
|
+
*
|
|
20
|
+
* It rotated an SCC to start at its lexicographically smallest member, for a real reason:
|
|
21
|
+
* Tarjan emits membership in traversal order, traversal follows the file walk, and the same
|
|
22
|
+
* cycle therefore had two identities on two machines. That is the concern
|
|
23
|
+
* [ts-archunit bug 0010](https://github.com/nielspeter/ts-archunit/blob/main/bugs/fixed/0010-violation-identity-embeds-absolute-paths.md) introduced
|
|
24
|
+
* the `identity` field for — the original docstring cited it here, a little loosely, since
|
|
25
|
+
* 0010 itself is about absolute paths rather than about cycles.
|
|
26
|
+
*
|
|
27
|
+
* Rotation was necessary and **not sufficient**, and the reason is in its own docstring's
|
|
28
|
+
* final claim — *"Direction is NOT normalized, because `a -> b -> c -> a` and
|
|
29
|
+
* `a -> c -> b -> a` traverse different edges and are genuinely different cycles"*. That
|
|
30
|
+
* premise requires the array to be an edge-ordered PATH. It is not, for any component of
|
|
31
|
+
* three or more: measured, a real ring `a→b→c→d→a` came out as `a -> d -> c -> b -> a`,
|
|
32
|
+
* every arrow reversed. So the preserved "direction" was information about the traversal,
|
|
33
|
+
* not about the graph — and reordering two imports moved the element from `[a, c, b]` to
|
|
34
|
+
* `[a, b, c]`, reddening CI on a cosmetic edit.
|
|
35
|
+
*
|
|
36
|
+
* Sorting subsumes rotation for a set and adds the missing half. If a future change
|
|
37
|
+
* recovers a REAL path (bug 0055's fuller fix), direction becomes genuine information
|
|
38
|
+
* again — and then the right shape is a sorted member set for the identity with the path
|
|
39
|
+
* carried in the message, not a return to rotation.
|
|
40
|
+
*
|
|
41
|
+
* **`identity`/`element` moved off the member set entirely — plan 0104.** One violation
|
|
42
|
+
* per SCC (keyed by the sorted member set above) let `.excluding()` waive a whole tangled
|
|
43
|
+
* component with one pattern, so a brand-new edge between two already-waived members was
|
|
44
|
+
* silently absorbed — a second, doubly fail-open bug in the same family. Each internal
|
|
45
|
+
* edge of the component now gets its own violation, `identity`, and `element`
|
|
46
|
+
* (`cycle-edge::${from}->${to}`, `${from} -> ${to}`) — every such edge provably lies on
|
|
47
|
+
* some cycle, because the component's own connectivity supplies a return path. The sorted
|
|
48
|
+
* `members` set computed above still exists and is still load-bearing: it now serves the
|
|
49
|
+
* MESSAGE's "part of a cycle with: ..." context only, not identity or element.
|
|
50
|
+
*/
|
|
51
|
+
/**
|
|
52
|
+
* Every slice must be free of dependency cycles.
|
|
53
|
+
*
|
|
54
|
+
* **The graph counts eager static dependencies: `import` declarations AND
|
|
55
|
+
* re-exports.** Since v0.48.0 `export { x } from './b.js'` and `export * from
|
|
56
|
+
* './b.js'` are edges — they emit an import of the module, so it is evaluated — which
|
|
57
|
+
* means a **barrel cycle** (`a → barrel → a`) is detected. It was not before v0.48.0,
|
|
58
|
+
* and that was the commonest cycle shape there is.
|
|
59
|
+
*
|
|
60
|
+
* Not counted, each for a reason: **dynamic `import()`** (lazy, so it cannot deadlock
|
|
61
|
+
* initialization, and it is usually the deliberate *fix* for a cycle), **`require()`**
|
|
62
|
+
* (CJS; this is an ESM-only package), and **type positions** like
|
|
63
|
+
* `type X = import('./b.js').Y` (erased).
|
|
64
|
+
*
|
|
65
|
+
* Type-only imports and re-exports are dropped by default — see `ignoreTypeImports`
|
|
66
|
+
* below, and note the default differs from `notDependOn`/`respectLayerOrder` on
|
|
67
|
+
* purpose: a cycle asks whether the module is *evaluated*, those ask whether the code
|
|
68
|
+
* is *coupled*.
|
|
69
|
+
*
|
|
70
|
+
* **This docstring said the opposite until v0.49.1.** It described the re-export
|
|
71
|
+
* blindness as permanent, and it argued for its own importance on the ground that "this
|
|
72
|
+
* docstring is read when the rule fails, and a changelog is read once" — then v0.48.0
|
|
73
|
+
* updated the changelog and left this text standing, along with the same claim in two
|
|
74
|
+
* shipped preset `because` strings that are **printed inside every finding**. Found by
|
|
75
|
+
* review, not by the suite; nothing pins prose against behaviour.
|
|
76
|
+
*/
|
|
77
|
+
export declare function beFreeOfCycles(options?: ImportOptions): Condition<Slice>;
|
|
17
78
|
/**
|
|
18
79
|
* Assert that slices respect a layered dependency order.
|
|
19
80
|
*
|
|
81
|
+
* **Which edges count:** every kind `notImportFrom()` and `onlyImportFrom()` count — plain
|
|
82
|
+
* imports, re-exports, `import('…')` and `type X = import('…').Y` — because this is a
|
|
83
|
+
* **coupling** question and a lazy import of a forbidden slice is still a forbidden
|
|
84
|
+
* dependency. `require()` is not counted (ESM-only package, ADR-004). Contrast
|
|
85
|
+
* `beFreeOfCycles`, which counts only the eager kinds because a cycle is a deadlock in
|
|
86
|
+
* initialization order.
|
|
87
|
+
*
|
|
88
|
+
* Stated here rather than only in `docs/slices.md` because this docstring is what an IDE
|
|
89
|
+
* and an agent read. The same omission stood from v0.48.0 to v0.49.1 and nothing pinned
|
|
90
|
+
* prose against behaviour then either
|
|
91
|
+
* ([ts-archunit bug 0059](https://github.com/nielspeter/ts-archunit/blob/main/bugs/fixed/0059-slice-conditions-and-module-conditions-disagree-about-a-dependency.md)).
|
|
92
|
+
*
|
|
20
93
|
* Given layers ['presentation', 'application', 'persistence', 'domain'],
|
|
21
94
|
* layer N may depend on layers N+1, N+2, ... but NOT on layers N-1, N-2, ...
|
|
22
95
|
* That is, dependencies must flow downward (toward higher indices) only.
|
|
@@ -31,10 +104,20 @@ export declare function beFreeOfCycles(): Condition<Slice>;
|
|
|
31
104
|
* .should().respectLayerOrder('presentation', 'application', 'persistence', 'domain')
|
|
32
105
|
* .check()
|
|
33
106
|
*/
|
|
107
|
+
export declare function respectLayerOrder(layers: string[], options: ImportOptions): Condition<Slice>;
|
|
34
108
|
export declare function respectLayerOrder(...layers: string[]): Condition<Slice>;
|
|
35
109
|
/**
|
|
36
110
|
* Assert that no slice depends on any of the listed slices.
|
|
37
111
|
*
|
|
112
|
+
* **Which edges count:** every kind `notImportFrom()` and `onlyImportFrom()` count — plain
|
|
113
|
+
* imports, re-exports, `import('…')` and `type X = import('…').Y` — because this is a
|
|
114
|
+
* **coupling** question: a lazy import of a forbidden slice is still a forbidden dependency.
|
|
115
|
+
* `require()` is not counted (ESM-only, ADR-004). Contrast `beFreeOfCycles`, which counts
|
|
116
|
+
* only the eager kinds because a cycle is a deadlock in initialization order. Dynamic and
|
|
117
|
+
* type-expression edges were invisible here until
|
|
118
|
+
* [ts-archunit bug 0059](https://github.com/nielspeter/ts-archunit/blob/main/bugs/fixed/0059-slice-conditions-and-module-conditions-disagree-about-a-dependency.md);
|
|
119
|
+
* this note exists because that docstring said nothing either way.
|
|
120
|
+
*
|
|
38
121
|
* Use for explicit isolation rules, e.g., "no slice may depend on legacy".
|
|
39
122
|
*
|
|
40
123
|
* @param forbiddenSlices - Names of slices that must not be depended upon
|
|
@@ -45,5 +128,6 @@ export declare function respectLayerOrder(...layers: string[]): Condition<Slice>
|
|
|
45
128
|
* .should().notDependOn('legacy', 'deprecated')
|
|
46
129
|
* .check()
|
|
47
130
|
*/
|
|
131
|
+
export declare function notDependOn(forbiddenSlices: string[], options: ImportOptions): Condition<Slice>;
|
|
48
132
|
export declare function notDependOn(...forbiddenSlices: string[]): Condition<Slice>;
|
|
49
133
|
//# sourceMappingURL=slice.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slice.d.ts","sourceRoot":"","sources":["../../src/conditions/slice.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAoB,MAAM,kBAAkB,CAAA;AAEnE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"slice.d.ts","sourceRoot":"","sources":["../../src/conditions/slice.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAoB,MAAM,kBAAkB,CAAA;AAEnE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAC/C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAQ9D;;;;;;;;;;;;GAYG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,cAAc,CAAC,OAAO,CAAC,EAAE,aAAa,GAAG,SAAS,CAAC,KAAK,CAAC,CAwIxE;AAoDD;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,aAAa,GAAG,SAAS,CAAC,KAAK,CAAC,CAAA;AAC7F,wBAAgB,iBAAiB,CAAC,GAAG,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC,KAAK,CAAC,CAAA;AAmDxE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,WAAW,CAAC,eAAe,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,aAAa,GAAG,SAAS,CAAC,KAAK,CAAC,CAAA;AAChG,wBAAgB,WAAW,CAAC,GAAG,eAAe,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC,KAAK,CAAC,CAAA"}
|