@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
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type { Condition, Predicate, RuleDescription } from '@nielspeter/eess';
|
|
2
|
+
import type { CollectResult } from '../core/terminal-builder.js';
|
|
3
|
+
import { TerminalBuilder } from '../core/terminal-builder.js';
|
|
4
|
+
/**
|
|
5
|
+
* What `SchemaRuleBuilder` and `ResolverRuleBuilder` both are.
|
|
6
|
+
*
|
|
7
|
+
* The two were one class written twice: identical `_predicates`/`_conditions`
|
|
8
|
+
* fields, identical `that`/`and`/`should`/`andShould`, `copy`,
|
|
9
|
+
* `assertsSomething`, `describeRule`, `selected`, `examinedUnits` and
|
|
10
|
+
* `collectViolations` — `no-copy-paste` reported the last pair as literally the
|
|
11
|
+
* same text. Extracting the shared body into a free function only shortened the
|
|
12
|
+
* copy; the honest reading of the finding is that the class is the duplicate.
|
|
13
|
+
*
|
|
14
|
+
* Neither extends `RuleBuilder`, because a GraphQL element is not a ts-morph
|
|
15
|
+
* node and the predicate/condition surfaces are the schema's own. What they do
|
|
16
|
+
* share is every piece of the ADR-010 evidence path, which is precisely where
|
|
17
|
+
* two copies have already cost this repo something: they once derived their
|
|
18
|
+
* `examined` count separately and disagreed, so a chain whose `.that()`
|
|
19
|
+
* selected nothing reported 14 units examined, handed its conditions 0, and
|
|
20
|
+
* passed green with `diagnose()` silent (plan 0096). One class is what makes
|
|
21
|
+
* "the preview derives from the same computation the gate uses" structural.
|
|
22
|
+
*
|
|
23
|
+
* Subclasses supply the four things that genuinely differ: where elements come
|
|
24
|
+
* from, the noun this family counts, the subject its description opens with,
|
|
25
|
+
* and the conditions its assertion-less remedy should name.
|
|
26
|
+
*/
|
|
27
|
+
export declare abstract class GraphqlRuleBuilder<T> extends TerminalBuilder {
|
|
28
|
+
protected _predicates: Predicate<T>[];
|
|
29
|
+
protected _conditions: Condition<T>[];
|
|
30
|
+
/**
|
|
31
|
+
* Per-instance rather than per-module, which is what a generic class allows:
|
|
32
|
+
* a single module-level `selectionMemo<T>()` cannot be typed for two element
|
|
33
|
+
* types. Keying is still by builder identity, and `copy()` hands the clone
|
|
34
|
+
* the same map, so the caching behaviour is the one the two modules had.
|
|
35
|
+
*/
|
|
36
|
+
private readonly selectionOf;
|
|
37
|
+
/** Every candidate, before any predicate runs. */
|
|
38
|
+
protected abstract getElements(): T[];
|
|
39
|
+
/** The conditions this builder's assertion-less remedy should name, e.g. `'haveFields(...)'`. */
|
|
40
|
+
protected abstract conditionExamples(): string;
|
|
41
|
+
/** The noun the rule description opens with — `schema that …`, `resolvers that …`. */
|
|
42
|
+
protected abstract descriptionSubject(): string;
|
|
43
|
+
/** Begin the predicate phase. Purely a readability marker. */
|
|
44
|
+
that(): this;
|
|
45
|
+
/** Add another predicate (AND). */
|
|
46
|
+
and(): this;
|
|
47
|
+
/** Begin the condition phase. */
|
|
48
|
+
should(): this;
|
|
49
|
+
/** Add another condition (AND). */
|
|
50
|
+
andShould(): this;
|
|
51
|
+
/**
|
|
52
|
+
* An independent copy, carrying both lists.
|
|
53
|
+
*
|
|
54
|
+
* These builders do not extend `RuleBuilder`, so they do not inherit that
|
|
55
|
+
* class's override — and neither `that()` nor `should()` forked here at all,
|
|
56
|
+
* which made the bug 0016 leak worse on this hierarchy than on the main one:
|
|
57
|
+
* a held `schema()` selection accumulated every predicate and condition of
|
|
58
|
+
* every rule derived from it. `docs/graphql.md` teaches exactly that shape.
|
|
59
|
+
*/
|
|
60
|
+
protected copy(): this;
|
|
61
|
+
/**
|
|
62
|
+
* Whether this rule states an assertion at all — the assertion gate's question.
|
|
63
|
+
*
|
|
64
|
+
* True once a condition has been added.
|
|
65
|
+
*
|
|
66
|
+
* Overrides the `TerminalBuilder` default (`true`), whose JSDoc carries the
|
|
67
|
+
* contract and the reason this is public rather than protected.
|
|
68
|
+
*/
|
|
69
|
+
assertsSomething(): boolean;
|
|
70
|
+
/**
|
|
71
|
+
* The remedy for this builder's assertion-less state, as one string.
|
|
72
|
+
*
|
|
73
|
+
* One channel, so `diagnose()`'s advice and the finding's own message cannot
|
|
74
|
+
* disagree. Overrides `TerminalBuilder`'s generic text with wording specific to
|
|
75
|
+
* what this builder is missing.
|
|
76
|
+
*/
|
|
77
|
+
assertionAdvice(): string;
|
|
78
|
+
/** Named by id or description, not 'unnamed' (plan 0070 §4). */
|
|
79
|
+
describeRule(): RuleDescription;
|
|
80
|
+
/**
|
|
81
|
+
* The set the conditions receive — plan 0096, and the ONE method every reader
|
|
82
|
+
* calls: `collectViolations()`, `examinedUnits()` and `diagnose()`'s preview
|
|
83
|
+
* all come through here, so none of them can answer "what did this rule look
|
|
84
|
+
* at" differently from the others.
|
|
85
|
+
*/
|
|
86
|
+
protected selected(): T[];
|
|
87
|
+
/**
|
|
88
|
+
* How many units this rule actually examined — ADR-010's evidence that a pass
|
|
89
|
+
* was constructed rather than defaulted. The selection, not what precedes it.
|
|
90
|
+
*/
|
|
91
|
+
examinedUnits(): number;
|
|
92
|
+
protected collectViolations(): CollectResult;
|
|
93
|
+
protected buildRuleDescription(): string;
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=graphql-rule-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphql-rule-builder.d.ts","sourceRoot":"","sources":["../../src/graphql/graphql-rule-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAQ7E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAE7D;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,8BAAsB,kBAAkB,CAAC,CAAC,CAAE,SAAQ,eAAe;IACjE,SAAS,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,CAAK;IAC1C,SAAS,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC,CAAC,EAAE,CAAK;IAE1C;;;;;OAKG;IACH,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAqB;IAEjD,kDAAkD;IAClD,SAAS,CAAC,QAAQ,CAAC,WAAW,IAAI,CAAC,EAAE;IAErC,iGAAiG;IACjG,SAAS,CAAC,QAAQ,CAAC,iBAAiB,IAAI,MAAM;IAE9C,sFAAsF;IACtF,SAAS,CAAC,QAAQ,CAAC,kBAAkB,IAAI,MAAM;IAI/C,8DAA8D;IAC9D,IAAI,IAAI,IAAI;IAIZ,mCAAmC;IACnC,GAAG,IAAI,IAAI;IAIX,iCAAiC;IACjC,MAAM,IAAI,IAAI;IAId,mCAAmC;IACnC,SAAS,IAAI,IAAI;IAMjB;;;;;;;;OAQG;cACgB,IAAI,IAAI,IAAI;IAO/B;;;;;;;OAOG;IACM,gBAAgB,IAAI,OAAO;IAIpC;;;;;;OAMG;IACM,eAAe,IAAI,MAAM;IAOlC,gEAAgE;IACvD,YAAY,IAAI,eAAe;IAOxC;;;;;OAKG;IACH,SAAS,CAAC,QAAQ,IAAI,CAAC,EAAE;IAIzB;;;OAGG;IACH,aAAa,IAAI,MAAM;IAIvB,SAAS,CAAC,iBAAiB,IAAI,aAAa;IAc5C,SAAS,CAAC,oBAAoB,IAAI,MAAM;CAGzC"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { conditionContextFrom, evaluateConditions, matchingElements, ruleDescriptionOf, selectionMemo, } from '@nielspeter/eess/internal';
|
|
2
|
+
import { TerminalBuilder } from '../core/terminal-builder.js';
|
|
3
|
+
/**
|
|
4
|
+
* What `SchemaRuleBuilder` and `ResolverRuleBuilder` both are.
|
|
5
|
+
*
|
|
6
|
+
* The two were one class written twice: identical `_predicates`/`_conditions`
|
|
7
|
+
* fields, identical `that`/`and`/`should`/`andShould`, `copy`,
|
|
8
|
+
* `assertsSomething`, `describeRule`, `selected`, `examinedUnits` and
|
|
9
|
+
* `collectViolations` — `no-copy-paste` reported the last pair as literally the
|
|
10
|
+
* same text. Extracting the shared body into a free function only shortened the
|
|
11
|
+
* copy; the honest reading of the finding is that the class is the duplicate.
|
|
12
|
+
*
|
|
13
|
+
* Neither extends `RuleBuilder`, because a GraphQL element is not a ts-morph
|
|
14
|
+
* node and the predicate/condition surfaces are the schema's own. What they do
|
|
15
|
+
* share is every piece of the ADR-010 evidence path, which is precisely where
|
|
16
|
+
* two copies have already cost this repo something: they once derived their
|
|
17
|
+
* `examined` count separately and disagreed, so a chain whose `.that()`
|
|
18
|
+
* selected nothing reported 14 units examined, handed its conditions 0, and
|
|
19
|
+
* passed green with `diagnose()` silent (plan 0096). One class is what makes
|
|
20
|
+
* "the preview derives from the same computation the gate uses" structural.
|
|
21
|
+
*
|
|
22
|
+
* Subclasses supply the four things that genuinely differ: where elements come
|
|
23
|
+
* from, the noun this family counts, the subject its description opens with,
|
|
24
|
+
* and the conditions its assertion-less remedy should name.
|
|
25
|
+
*/
|
|
26
|
+
export class GraphqlRuleBuilder extends TerminalBuilder {
|
|
27
|
+
_predicates = [];
|
|
28
|
+
_conditions = [];
|
|
29
|
+
/**
|
|
30
|
+
* Per-instance rather than per-module, which is what a generic class allows:
|
|
31
|
+
* a single module-level `selectionMemo<T>()` cannot be typed for two element
|
|
32
|
+
* types. Keying is still by builder identity, and `copy()` hands the clone
|
|
33
|
+
* the same map, so the caching behaviour is the one the two modules had.
|
|
34
|
+
*/
|
|
35
|
+
selectionOf = selectionMemo();
|
|
36
|
+
// --- Chain methods (readability markers; the phase is implicit) ---
|
|
37
|
+
/** Begin the predicate phase. Purely a readability marker. */
|
|
38
|
+
that() {
|
|
39
|
+
return this;
|
|
40
|
+
}
|
|
41
|
+
/** Add another predicate (AND). */
|
|
42
|
+
and() {
|
|
43
|
+
return this;
|
|
44
|
+
}
|
|
45
|
+
/** Begin the condition phase. */
|
|
46
|
+
should() {
|
|
47
|
+
return this;
|
|
48
|
+
}
|
|
49
|
+
/** Add another condition (AND). */
|
|
50
|
+
andShould() {
|
|
51
|
+
return this;
|
|
52
|
+
}
|
|
53
|
+
// --- Evaluation ---
|
|
54
|
+
/**
|
|
55
|
+
* An independent copy, carrying both lists.
|
|
56
|
+
*
|
|
57
|
+
* These builders do not extend `RuleBuilder`, so they do not inherit that
|
|
58
|
+
* class's override — and neither `that()` nor `should()` forked here at all,
|
|
59
|
+
* which made the bug 0016 leak worse on this hierarchy than on the main one:
|
|
60
|
+
* a held `schema()` selection accumulated every predicate and condition of
|
|
61
|
+
* every rule derived from it. `docs/graphql.md` teaches exactly that shape.
|
|
62
|
+
*/
|
|
63
|
+
copy() {
|
|
64
|
+
const clone = super.copy();
|
|
65
|
+
clone._predicates = [...this._predicates];
|
|
66
|
+
clone._conditions = [...this._conditions];
|
|
67
|
+
return clone;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Whether this rule states an assertion at all — the assertion gate's question.
|
|
71
|
+
*
|
|
72
|
+
* True once a condition has been added.
|
|
73
|
+
*
|
|
74
|
+
* Overrides the `TerminalBuilder` default (`true`), whose JSDoc carries the
|
|
75
|
+
* contract and the reason this is public rather than protected.
|
|
76
|
+
*/
|
|
77
|
+
assertsSomething() {
|
|
78
|
+
return this._conditions.length > 0;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* The remedy for this builder's assertion-less state, as one string.
|
|
82
|
+
*
|
|
83
|
+
* One channel, so `diagnose()`'s advice and the finding's own message cannot
|
|
84
|
+
* disagree. Overrides `TerminalBuilder`'s generic text with wording specific to
|
|
85
|
+
* what this builder is missing.
|
|
86
|
+
*/
|
|
87
|
+
assertionAdvice() {
|
|
88
|
+
return ('this rule has no condition, so it asserts nothing and can never fail. Add a ' +
|
|
89
|
+
`condition after .should(), e.g. ${this.conditionExamples()}.`);
|
|
90
|
+
}
|
|
91
|
+
/** Named by id or description, not 'unnamed' (plan 0070 §4). */
|
|
92
|
+
describeRule() {
|
|
93
|
+
return {
|
|
94
|
+
...super.describeRule(),
|
|
95
|
+
rule: this._metadata?.id ?? this.buildRuleDescription(),
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* The set the conditions receive — plan 0096, and the ONE method every reader
|
|
100
|
+
* calls: `collectViolations()`, `examinedUnits()` and `diagnose()`'s preview
|
|
101
|
+
* all come through here, so none of them can answer "what did this rule look
|
|
102
|
+
* at" differently from the others.
|
|
103
|
+
*/
|
|
104
|
+
selected() {
|
|
105
|
+
return this.selectionOf(this, () => matchingElements(this.getElements(), this._predicates));
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* How many units this rule actually examined — ADR-010's evidence that a pass
|
|
109
|
+
* was constructed rather than defaulted. The selection, not what precedes it.
|
|
110
|
+
*/
|
|
111
|
+
examinedUnits() {
|
|
112
|
+
return this.selected().length;
|
|
113
|
+
}
|
|
114
|
+
collectViolations() {
|
|
115
|
+
// The kernel's. The zero-evidence early exit and the `examined` count travel
|
|
116
|
+
// with it, so they cannot be derived apart.
|
|
117
|
+
return evaluateConditions(this.selected(), this._conditions, conditionContextFrom({
|
|
118
|
+
metadata: this._metadata,
|
|
119
|
+
reason: this._reason,
|
|
120
|
+
rule: this.buildRuleDescription(),
|
|
121
|
+
}));
|
|
122
|
+
}
|
|
123
|
+
buildRuleDescription() {
|
|
124
|
+
return ruleDescriptionOf(this._predicates, this._conditions, this.descriptionSubject());
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=graphql-rule-builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphql-rule-builder.js","sourceRoot":"","sources":["../../src/graphql/graphql-rule-builder.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C,SAAS,EAAE,EAAE,IAAI,IAAI,CAAC,oBAAoB,EAAE;SACxD,CAAA;IACH,CAAC;IAED;;;;;OAKG;IACO,QAAQ;QAChB,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC,CAAA;IAC7F,CAAC;IAED;;;OAGG;IACH,aAAa;QACX,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC,MAAM,CAAA;IAC/B,CAAC;IAES,iBAAiB;QACzB,6EAA6E;QAC7E,4CAA4C;QAC5C,OAAO,kBAAkB,CACvB,IAAI,CAAC,QAAQ,EAAE,EACf,IAAI,CAAC,WAAW,EAChB,oBAAoB,CAAC;YACnB,QAAQ,EAAE,IAAI,CAAC,SAAS;YACxB,MAAM,EAAE,IAAI,CAAC,OAAO;YACpB,IAAI,EAAE,IAAI,CAAC,oBAAoB,EAAE;SAClC,CAAC,CACH,CAAA;IACH,CAAC;IAES,oBAAoB;QAC5B,OAAO,iBAAiB,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,kBAAkB,EAAE,CAAC,CAAA;IACzF,CAAC;CACF"}
|
package/dist/graphql/index.d.ts
CHANGED
|
@@ -65,6 +65,7 @@ export declare function schemaFromSDL(sdl: string, sourcePath?: string): SchemaR
|
|
|
65
65
|
* ```
|
|
66
66
|
*/
|
|
67
67
|
export declare function resolvers(p: ArchProject, glob: string): ResolverRuleBuilder;
|
|
68
|
+
export { GraphqlRuleBuilder } from './graphql-rule-builder.js';
|
|
68
69
|
export { SchemaRuleBuilder } from './schema-rule-builder.js';
|
|
69
70
|
export { ResolverRuleBuilder } from './resolver-rule-builder.js';
|
|
70
71
|
export { resolveFieldReturning } from './resolver-rule-builder.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src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HANGED
|
@@ -77,9 +77,10 @@ export function resolvers(p, glob) {
|
|
|
77
77
|
const filePath = sf.getFilePath();
|
|
78
78
|
return picomatchFilter(filePath, glob, extractRootDir(p.tsConfigPath));
|
|
79
79
|
});
|
|
80
|
-
return new ResolverRuleBuilder(sourceFiles);
|
|
80
|
+
return new ResolverRuleBuilder(sourceFiles, glob, p);
|
|
81
81
|
}
|
|
82
82
|
// --- Re-exports ---
|
|
83
|
+
export { GraphqlRuleBuilder } from './graphql-rule-builder.js';
|
|
83
84
|
export { SchemaRuleBuilder } from './schema-rule-builder.js';
|
|
84
85
|
export { ResolverRuleBuilder } from './resolver-rule-builder.js';
|
|
85
86
|
export { resolveFieldReturning } from './resolver-rule-builder.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/graphql/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAA;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAA;AAEhE,uBAAuB;AAEvB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,MAAM,CAAC,aAAmC,EAAE,IAAY;IACtE,MAAM,OAAO,GACX,OAAO,aAAa,KAAK,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,cAAc,CAAC,aAAa,CAAC,YAAY,CAAC,CAAA;IAChG,MAAM,MAAM,GAAG,kBAAkB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;IAChD,OAAO,IAAI,iBAAiB,CAAC,MAAM,CAAC,CAAA;AACtC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,GAAW,EAAE,UAAmB;IAC5D,MAAM,MAAM,GAAG,iBAAiB,CAAC,GAAG,EAAE,UAAU,CA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AM,YAAY,GAAG,IAAI,GAAG,EAA6B,CAAA;AAEzD,SAAS,eAAe,CAAC,QAAgB,EAAE,IAAY,EAAE,OAAe;IACtE,MAAM,YAAY,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAA;IACrD,IAAI,OAAO,GAAG,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;IACpC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,GAAG,SAAS,CAAC,IAAI,CAAC,CAAA;QACzB,YAAY,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAA;IACjC,CAAC;IACD,OAAO,OAAO,CAAC,YAAY,CAAC,CAAA;AAC9B,CAAC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { SourceFile } from 'ts-morph';
|
|
2
|
-
import type { ArchViolation } from '../core/violation.js';
|
|
3
2
|
import type { Predicate } from '@nielspeter/eess';
|
|
4
|
-
import {
|
|
3
|
+
import type { ArchProject } from '../core/project.js';
|
|
4
|
+
import type { GlobNode } from '@nielspeter/eess';
|
|
5
5
|
import type { ExpressionMatcher } from '../helpers/matchers.js';
|
|
6
6
|
import type { ArchFunction } from '../models/arch-function.js';
|
|
7
|
+
import { GraphqlRuleBuilder } from './graphql-rule-builder.js';
|
|
7
8
|
/**
|
|
8
9
|
* Predicate: filter to resolver functions for fields returning types matching the pattern.
|
|
9
10
|
*
|
|
@@ -31,31 +32,42 @@ export declare function resolveFieldReturning(pattern: RegExp | string): Predica
|
|
|
31
32
|
* .check()
|
|
32
33
|
* ```
|
|
33
34
|
*/
|
|
34
|
-
export declare class ResolverRuleBuilder extends
|
|
35
|
+
export declare class ResolverRuleBuilder extends GraphqlRuleBuilder<ArchFunction> {
|
|
35
36
|
private readonly sourceFiles;
|
|
36
|
-
private readonly
|
|
37
|
-
private readonly
|
|
38
|
-
constructor(sourceFiles: SourceFile[]);
|
|
37
|
+
private readonly glob?;
|
|
38
|
+
private readonly project?;
|
|
39
39
|
/**
|
|
40
|
-
*
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
*
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
*
|
|
40
|
+
* @param sourceFiles - The resolver files, already filtered by `resolvers()`.
|
|
41
|
+
* @param glob - The glob they were filtered by, for diagnostics only.
|
|
42
|
+
*
|
|
43
|
+
* `glob` is **optional** because this class is re-exported from the public
|
|
44
|
+
* `./graphql` subpath, so its constructor is public API and a required
|
|
45
|
+
* second parameter would break anyone constructing it directly — which
|
|
46
|
+
* would make R2a a breaking release, and R2a is the one people install in
|
|
47
|
+
* order to measure before R3. `resolvers()` always passes it.
|
|
48
|
+
*
|
|
49
|
+
* Threading it at all is the point: `resolvers()` filters eagerly and hands
|
|
50
|
+
* this builder only the surviving files, so without the glob string no
|
|
51
|
+
* `globs()` could ever report `resolvers(p, 'src/reslvers/**')` — the rule
|
|
52
|
+
* would silently examine zero resolvers and pass.
|
|
49
53
|
*/
|
|
50
|
-
|
|
54
|
+
constructor(sourceFiles: SourceFile[], glob?: string | undefined, project?: ArchProject | undefined);
|
|
55
|
+
/** The project this rule was built against. See `RuleBuilder.getProject`. */
|
|
56
|
+
getProject(): ArchProject | undefined;
|
|
51
57
|
/**
|
|
52
|
-
*
|
|
58
|
+
* The discovery glob, if `resolvers()` supplied it.
|
|
59
|
+
*
|
|
60
|
+
* `tsconfig-relative` is load-bearing, not cosmetic: it is what exempts this
|
|
61
|
+
* glob from the anchor check, because `resolvers(p, 'src/resolvers/**')` — the
|
|
62
|
+
* spelling in this class's own example — is correct as written. Declared
|
|
63
|
+
* `'absolute'` it would be reported unanchored, telling the author to break a
|
|
64
|
+
* working rule.
|
|
53
65
|
*/
|
|
54
|
-
|
|
66
|
+
globs(): readonly GlobNode[];
|
|
55
67
|
/**
|
|
56
|
-
*
|
|
68
|
+
* Filter to resolver functions for fields returning types matching the pattern.
|
|
57
69
|
*/
|
|
58
|
-
|
|
70
|
+
resolveFieldReturning(pattern: RegExp | string): this;
|
|
59
71
|
/**
|
|
60
72
|
* Assert that the resolver body contains at least one match.
|
|
61
73
|
*/
|
|
@@ -68,8 +80,17 @@ export declare class ResolverRuleBuilder extends TerminalBuilder {
|
|
|
68
80
|
* Assert: must NOT contain 'bad' AND must contain 'good'.
|
|
69
81
|
*/
|
|
70
82
|
useInsteadOf(bad: ExpressionMatcher, good: ExpressionMatcher): this;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
83
|
+
/**
|
|
84
|
+
* This family counts resolvers — the resolver functions it selected.
|
|
85
|
+
*
|
|
86
|
+
* Plan 0099: `CollectResult.examined` is unit-typed per family (ADR-009 part
|
|
87
|
+
* 1), and the zero-examined message prints the noun. Inheriting the base
|
|
88
|
+
* `'subjects'` is a category error in a sentence whose whole job is naming what
|
|
89
|
+
* was and was not looked at.
|
|
90
|
+
*/
|
|
91
|
+
protected examinedUnitNoun(): string;
|
|
92
|
+
protected descriptionSubject(): string;
|
|
93
|
+
protected conditionExamples(): string;
|
|
94
|
+
protected getElements(): ArchFunction[];
|
|
74
95
|
}
|
|
75
96
|
//# sourceMappingURL=resolver-rule-builder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolver-rule-builder.d.ts","sourceRoot":"","sources":["../../src/graphql/resolver-rule-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAC1C,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"resolver-rule-builder.d.ts","sourceRoot":"","sources":["../../src/graphql/resolver-rule-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAC1C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,KAAK,EAAE,QAAQ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|
|
|
1
|
-
import {
|
|
1
|
+
import { stampGlobs } from '@nielspeter/eess/internal';
|
|
2
|
+
import { globAnyOf } from '@nielspeter/eess';
|
|
2
3
|
import { collectFunctions } from '../models/arch-function.js';
|
|
3
4
|
import { functionContain, functionNotContain, functionUseInsteadOf, } from '../conditions/body-analysis-function.js';
|
|
5
|
+
import { GraphqlRuleBuilder } from './graphql-rule-builder.js';
|
|
4
6
|
/**
|
|
5
7
|
* Predicate: filter to resolver functions for fields returning types matching the pattern.
|
|
6
8
|
*
|
|
@@ -40,107 +42,113 @@ export function resolveFieldReturning(pattern) {
|
|
|
40
42
|
* .check()
|
|
41
43
|
* ```
|
|
42
44
|
*/
|
|
43
|
-
export class ResolverRuleBuilder extends
|
|
45
|
+
export class ResolverRuleBuilder extends GraphqlRuleBuilder {
|
|
44
46
|
sourceFiles;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
constructor(sourceFiles) {
|
|
48
|
-
super();
|
|
49
|
-
this.sourceFiles = sourceFiles;
|
|
50
|
-
}
|
|
51
|
-
// --- Predicate methods ---
|
|
52
|
-
/**
|
|
53
|
-
* Filter to resolver functions for fields returning types matching the pattern.
|
|
54
|
-
*/
|
|
55
|
-
resolveFieldReturning(pattern) {
|
|
56
|
-
this._predicates.push(resolveFieldReturning(pattern));
|
|
57
|
-
return this;
|
|
58
|
-
}
|
|
59
|
-
// --- Chain methods ---
|
|
47
|
+
glob;
|
|
48
|
+
project;
|
|
60
49
|
/**
|
|
61
|
-
*
|
|
50
|
+
* @param sourceFiles - The resolver files, already filtered by `resolvers()`.
|
|
51
|
+
* @param glob - The glob they were filtered by, for diagnostics only.
|
|
52
|
+
*
|
|
53
|
+
* `glob` is **optional** because this class is re-exported from the public
|
|
54
|
+
* `./graphql` subpath, so its constructor is public API and a required
|
|
55
|
+
* second parameter would break anyone constructing it directly — which
|
|
56
|
+
* would make R2a a breaking release, and R2a is the one people install in
|
|
57
|
+
* order to measure before R3. `resolvers()` always passes it.
|
|
58
|
+
*
|
|
59
|
+
* Threading it at all is the point: `resolvers()` filters eagerly and hands
|
|
60
|
+
* this builder only the surviving files, so without the glob string no
|
|
61
|
+
* `globs()` could ever report `resolvers(p, 'src/reslvers/**')` — the rule
|
|
62
|
+
* would silently examine zero resolvers and pass.
|
|
62
63
|
*/
|
|
63
|
-
|
|
64
|
-
|
|
64
|
+
constructor(sourceFiles, glob, project) {
|
|
65
|
+
super();
|
|
66
|
+
this.sourceFiles = sourceFiles;
|
|
67
|
+
this.glob = glob;
|
|
68
|
+
this.project = project;
|
|
65
69
|
}
|
|
66
|
-
/**
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
and() {
|
|
70
|
-
return this;
|
|
70
|
+
/** The project this rule was built against. See `RuleBuilder.getProject`. */
|
|
71
|
+
getProject() {
|
|
72
|
+
return this.project;
|
|
71
73
|
}
|
|
72
74
|
/**
|
|
73
|
-
*
|
|
75
|
+
* The discovery glob, if `resolvers()` supplied it.
|
|
76
|
+
*
|
|
77
|
+
* `tsconfig-relative` is load-bearing, not cosmetic: it is what exempts this
|
|
78
|
+
* glob from the anchor check, because `resolvers(p, 'src/resolvers/**')` — the
|
|
79
|
+
* spelling in this class's own example — is correct as written. Declared
|
|
80
|
+
* `'absolute'` it would be reported unanchored, telling the author to break a
|
|
81
|
+
* working rule.
|
|
74
82
|
*/
|
|
75
|
-
|
|
76
|
-
|
|
83
|
+
globs() {
|
|
84
|
+
if (this.glob === undefined)
|
|
85
|
+
return [];
|
|
86
|
+
return [
|
|
87
|
+
stampGlobs(globAnyOf([this.glob], 'file-path', 'tsconfig-relative'), 'discovery', (g) => `resolvers(p, "${g.glob}")`),
|
|
88
|
+
];
|
|
77
89
|
}
|
|
90
|
+
// --- Predicate methods ---
|
|
78
91
|
/**
|
|
79
|
-
*
|
|
92
|
+
* Filter to resolver functions for fields returning types matching the pattern.
|
|
80
93
|
*/
|
|
81
|
-
|
|
82
|
-
|
|
94
|
+
resolveFieldReturning(pattern) {
|
|
95
|
+
const next = this.copy();
|
|
96
|
+
next._predicates.push(resolveFieldReturning(pattern));
|
|
97
|
+
return next;
|
|
83
98
|
}
|
|
84
99
|
// --- Condition methods (reuse body analysis) ---
|
|
85
100
|
/**
|
|
86
101
|
* Assert that the resolver body contains at least one match.
|
|
87
102
|
*/
|
|
88
103
|
contain(matcher) {
|
|
89
|
-
this.
|
|
90
|
-
|
|
104
|
+
const next = this.copy();
|
|
105
|
+
next._conditions.push(functionContain(matcher));
|
|
106
|
+
return next;
|
|
91
107
|
}
|
|
92
108
|
/**
|
|
93
109
|
* Assert that the resolver body does NOT contain any match.
|
|
94
110
|
*/
|
|
95
111
|
notContain(matcher) {
|
|
96
|
-
this.
|
|
97
|
-
|
|
112
|
+
const next = this.copy();
|
|
113
|
+
next._conditions.push(functionNotContain(matcher));
|
|
114
|
+
return next;
|
|
98
115
|
}
|
|
99
116
|
/**
|
|
100
117
|
* Assert: must NOT contain 'bad' AND must contain 'good'.
|
|
101
118
|
*/
|
|
102
119
|
useInsteadOf(bad, good) {
|
|
103
|
-
this.
|
|
104
|
-
|
|
120
|
+
const next = this.copy();
|
|
121
|
+
next._conditions.push(functionUseInsteadOf(bad, good));
|
|
122
|
+
return next;
|
|
105
123
|
}
|
|
106
124
|
// --- Evaluation ---
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
return [];
|
|
118
|
-
}
|
|
119
|
-
const context = {
|
|
120
|
-
rule: this.buildRuleDescription(),
|
|
121
|
-
because: this._reason,
|
|
122
|
-
ruleId: this._metadata?.id,
|
|
123
|
-
suggestion: this._metadata?.suggestion,
|
|
124
|
-
docs: this._metadata?.docs,
|
|
125
|
-
};
|
|
126
|
-
const violations = [];
|
|
127
|
-
for (const condition of this._conditions) {
|
|
128
|
-
violations.push(...condition.evaluate(filtered, context));
|
|
129
|
-
}
|
|
130
|
-
return violations;
|
|
125
|
+
/**
|
|
126
|
+
* This family counts resolvers — the resolver functions it selected.
|
|
127
|
+
*
|
|
128
|
+
* Plan 0099: `CollectResult.examined` is unit-typed per family (ADR-009 part
|
|
129
|
+
* 1), and the zero-examined message prints the noun. Inheriting the base
|
|
130
|
+
* `'subjects'` is a category error in a sentence whose whole job is naming what
|
|
131
|
+
* was and was not looked at.
|
|
132
|
+
*/
|
|
133
|
+
examinedUnitNoun() {
|
|
134
|
+
return 'resolvers';
|
|
131
135
|
}
|
|
132
|
-
|
|
133
|
-
return
|
|
136
|
+
descriptionSubject() {
|
|
137
|
+
return 'resolvers';
|
|
138
|
+
}
|
|
139
|
+
conditionExamples() {
|
|
140
|
+
return 'contain(...), notContain(...) or useInsteadOf(...)';
|
|
134
141
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
142
|
+
getElements() {
|
|
143
|
+
// Object-literal collection is opt-in for `functions()`, where turning it on
|
|
144
|
+
// by default would flood every rule with inline callbacks. Here it is the
|
|
145
|
+
// opposite: a GraphQL resolver map IS an object literal
|
|
146
|
+
// (`{ Query: { assetCollection: async () => {} } }`), so without this the
|
|
147
|
+
// builder named `resolvers()` selects the helper functions that happen to
|
|
148
|
+
// sit beside the resolvers and none of the resolvers themselves — measured
|
|
149
|
+
// on a real schema as 60 subjects, 0 of them resolvers. Every rule written
|
|
150
|
+
// against it then passes on the wrong subjects (ADR-008).
|
|
151
|
+
return this.sourceFiles.flatMap((sf) => collectFunctions(sf, { includeObjectLiteralFunctions: true }));
|
|
144
152
|
}
|
|
145
153
|
}
|
|
146
154
|
//# sourceMappingURL=resolver-rule-builder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolver-rule-builder.js","sourceRoot":"","sources":["../../src/graphql/resolver-rule-builder.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,
|
|
1
|
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b,CAAC;IAED,qBAAqB;IAErB;;;;;;;OAOG;IACgB,gBAAgB;QACjC,OAAO,WAAW,CAAA;IACpB,CAAC;IAEkB,kBAAkB;QACnC,OAAO,WAAW,CAAA;IACpB,CAAC;IAEkB,iBAAiB;QAClC,OAAO,oDAAoD,CAAA;IAC7D,CAAC;IAEkB,WAAW;QAC5B,6EAA6E;QAC7E,0EAA0E;QAC1E,wDAAwD;QACxD,0EAA0E;QAC1E,0EAA0E;QAC1E,2EAA2E;QAC3E,2EAA2E;QAC3E,0DAA0D;QAC1D,OAAO,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CACrC,gBAAgB,CAAC,EAAE,EAAE,EAAE,6BAA6B,EAAE,IAAI,EAAE,CAAC,CAC9D,CAAA;IACH,CAAC;CACF"}
|
|
@@ -50,6 +50,12 @@ export interface GraphQLArgumentLike {
|
|
|
50
50
|
export interface GraphQLTypeLike {
|
|
51
51
|
readonly toString: () => string;
|
|
52
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* GraphQL package interface — the subset of functions we use.
|
|
55
|
+
*/
|
|
56
|
+
interface GraphQLPackage {
|
|
57
|
+
buildSchema: (sdl: string) => GraphQLSchemaLike;
|
|
58
|
+
}
|
|
53
59
|
/**
|
|
54
60
|
* Load and parse .graphql files matching a glob pattern relative to a root directory.
|
|
55
61
|
*
|
|
@@ -72,4 +78,19 @@ export declare function loadSchemaFromSDL(sdl: string, sourcePath?: string): Loa
|
|
|
72
78
|
* Used by the runtime guard in the barrel export.
|
|
73
79
|
*/
|
|
74
80
|
export declare function isGraphQLAvailable(): boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Replace how `graphql` is loaded. **Tests only** —
|
|
83
|
+
* [ts-archunit bug 0080](https://github.com/nielspeter/ts-archunit/blob/main/bugs/fixed/0080-a-node-module-mock-does-not-isolate-under-full-suite-concurrency.md):
|
|
84
|
+
* `vi.doMock('node:module', ...)` intercepts a Node builtin, which is not
|
|
85
|
+
* reliably isolated per-file under Vitest's worker-reuse defaults and failed
|
|
86
|
+
* intermittently under full-suite load. This seam replaces only this
|
|
87
|
+
* module's own loading step — nothing shared with any other file to race on.
|
|
88
|
+
*/
|
|
89
|
+
export declare function setGraphQLLoaderForTests(loader: () => GraphQLPackage): void;
|
|
90
|
+
/**
|
|
91
|
+
* Restore the real loader and clear the cached package. **Tests only** — see
|
|
92
|
+
* {@link setGraphQLLoaderForTests}.
|
|
93
|
+
*/
|
|
94
|
+
export declare function resetGraphQLLoaderForTests(): void;
|
|
95
|
+
export {};
|
|
75
96
|
//# sourceMappingURL=schema-loader.d.ts.map
|