@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,34 +1,124 @@
|
|
|
1
1
|
import { functions } from '../builders/function-rule-builder.js';
|
|
2
|
+
import { modules } from '../builders/module-rule-builder.js';
|
|
3
|
+
import { resideInFile } from '../predicates/identity.js';
|
|
4
|
+
import { not, or } from '../core/combinators.js';
|
|
5
|
+
import { isDeadSite } from '../core/glob-evaluator.js';
|
|
6
|
+
import { isProjectRelative } from '../core/project-relative.js';
|
|
7
|
+
import { pathUniverse } from '../core/path-universe.js';
|
|
8
|
+
import { collectResult } from '@nielspeter/eess';
|
|
9
|
+
import { UNSUPPRESSABLE } from '@nielspeter/eess/internal';
|
|
2
10
|
import { call } from '../helpers/matchers.js';
|
|
3
11
|
import { functionNoGenericErrors } from '../rules/errors.js';
|
|
4
12
|
import { noStubComments, noEmptyBodies } from '../rules/hygiene.js';
|
|
5
13
|
import { smells } from '../smells/index.js';
|
|
6
|
-
import {
|
|
14
|
+
import { overrideFindings, validateOverrides, declareEmptyIfListed, presetDeclarationSpelling, declaredEmptyFindings, assertEnabled, deliver, } from './shared.js';
|
|
15
|
+
/**
|
|
16
|
+
* The rule-file kinds exempt without the caller naming anything — proposal 009's
|
|
17
|
+
* own list. `*.spec.ts` is here because an earlier draft of plan 0237 dropped it
|
|
18
|
+
* with no reason given, and half the ecosystem names tests that way.
|
|
19
|
+
*/
|
|
20
|
+
const DEFAULT_RULE_FILES = ['**/*.rules.ts', '**/*.test.ts', '**/*.spec.ts'];
|
|
21
|
+
/**
|
|
22
|
+
* Every specifier shape, not only the bare package.
|
|
23
|
+
*
|
|
24
|
+
* Measured with picomatch before this list was written: `@nielspeter/eess` and
|
|
25
|
+
* `@nielspeter/eess-*` alone match NONE of `@nielspeter/eess/internal`,
|
|
26
|
+
* `@nielspeter/eess-ts/presets` or `@nielspeter/eess-md/rules/adr` — and those
|
|
27
|
+
* subpath shapes are what real code imports, this repo's own guardrails script
|
|
28
|
+
* included. An earlier draft shipped the two bare globs.
|
|
29
|
+
*/
|
|
30
|
+
const EESS_PACKAGES = [
|
|
31
|
+
'@nielspeter/eess',
|
|
32
|
+
'@nielspeter/eess/**',
|
|
33
|
+
'@nielspeter/eess-*',
|
|
34
|
+
'@nielspeter/eess-*/**',
|
|
35
|
+
];
|
|
36
|
+
/**
|
|
37
|
+
* The emitters, anchored on the callee.
|
|
38
|
+
*
|
|
39
|
+
* `(^|\.)` so `import * as eess` followed by `eess.finishPreset(...)` is caught
|
|
40
|
+
* — the consuming project that measured the field failure had exactly that
|
|
41
|
+
* escape in its own first version of this rule. A RENAMED import
|
|
42
|
+
* (`finishPreset as done`) escapes this leg and is caught by the import leg, so
|
|
43
|
+
* the two conditions cover each other's blind spot.
|
|
44
|
+
*
|
|
45
|
+
* **The two legs cover each other for a STATIC renamed import, and NOT for a
|
|
46
|
+
* dynamic one.** `import { finishPreset as done }` escapes this regex and is
|
|
47
|
+
* caught by the import leg — asserted, not assumed. But
|
|
48
|
+
* `const { finishPreset: done } = await import('@nielspeter/eess')` escapes
|
|
49
|
+
* BOTH on one line: the import leg because `TYPE_IMPORT_KINDS` sets
|
|
50
|
+
* `dynamic: false` by design, this one because the callee text is `done`. That
|
|
51
|
+
* is [bug 0264](../../../../work/bugs/0264-a-dynamic-import-escapes-the-verdict-rule.md),
|
|
52
|
+
* found by review, pinned by a KNOWN-GAP test, and named here rather than left
|
|
53
|
+
* for the next reader to discover — an unstated ceiling reads as coverage.
|
|
54
|
+
*
|
|
55
|
+
* `dispatchRule` is deliberately absent: it is the sanctioned preset-authoring
|
|
56
|
+
* call. That is not what spares a preset module, though — such a module imports
|
|
57
|
+
* `dispatchRule` at runtime, so the import leg reds it whatever this regex says.
|
|
58
|
+
* A preset module is a verdict file by definition and belongs in `ruleFiles`.
|
|
59
|
+
*
|
|
60
|
+
* `throwIfViolations` stays although plan 0263 Phase 5 removed it from this
|
|
61
|
+
* kernel's public surface, and the reason it stays is the reason it was listed:
|
|
62
|
+
* this preset runs against an ADOPTER's code, not ours. An adopter pinned to an
|
|
63
|
+
* older `@nielspeter/eess` still has the alias and can still call it outside a
|
|
64
|
+
* rule file, which is exactly the misuse this regex exists to catch. Dropping
|
|
65
|
+
* the name the day our own export went would open that gap for every consumer
|
|
66
|
+
* who has not upgraded. A dead name in a regex costs nothing; a missing one
|
|
67
|
+
* costs a silent pass.
|
|
68
|
+
*/
|
|
69
|
+
const EMITTERS = /(^|\.)(finishPreset|reportViolations|throwIfViolations)$/;
|
|
7
70
|
/**
|
|
8
71
|
* Preset targeting the mistakes AI coding agents make most often — inline
|
|
9
72
|
* logic, generic errors, stub comments, empty bodies, copy-paste.
|
|
10
73
|
*
|
|
11
|
-
* Returns
|
|
12
|
-
*
|
|
13
|
-
* format
|
|
14
|
-
* copy-paste
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
* it in the returned/JSON set. Each rule carries agent-facing `because` /
|
|
18
|
-
* `suggestion` / `imperative` metadata so `explain --format agent` and the check
|
|
19
|
-
* JSON give the agent an actionable fix.
|
|
74
|
+
* Returns severity-carrying builders (the returning form, plan 0060), so an
|
|
75
|
+
* agent's rules file does `export default [...agentGuardrails(p, { ... })]` and
|
|
76
|
+
* `eess-ts check --format json` surfaces every violation, including the
|
|
77
|
+
* copy-paste **warn**. Each rule carries agent-facing `because` / `suggestion` /
|
|
78
|
+
* `imperative` metadata so `explain --format agent` and the check JSON give the
|
|
79
|
+
* agent an actionable fix.
|
|
20
80
|
*
|
|
21
81
|
* Uses function-variant rules so standalone functions, arrow functions, and
|
|
22
82
|
* class methods are all covered.
|
|
23
83
|
*/
|
|
84
|
+
// Presets collect object-literal functions unconditionally. `functions()`
|
|
85
|
+
// keeps it opt-in because widening a selector the USER wrote silently changes
|
|
86
|
+
// their rule; a preset's subject set is the preset's own, and this one already
|
|
87
|
+
// promises "standalone functions, arrow functions, and class methods are all
|
|
88
|
+
// covered". A handler map — the shape agents generate most — was none of the
|
|
89
|
+
// three, so `{ POST: () => {} }` slipped every guardrail (bug 0013).
|
|
90
|
+
const COLLECT_ALL = { includeObjectLiteralFunctions: true };
|
|
24
91
|
export function agentGuardrails(p, options) {
|
|
25
|
-
|
|
26
|
-
|
|
92
|
+
// Plan 0100's `attempted`: the ids the caller's OPTIONS ask for, before any
|
|
93
|
+
// override is consulted — every rule this preset can build sits behind an
|
|
94
|
+
// optional flag, so this can legitimately be `[]` (nothing was ever enabled).
|
|
95
|
+
// NOT what override validation uses below — see `knownOverrideIds`'s own doc.
|
|
96
|
+
const attempted = collectRuleIds(options);
|
|
97
|
+
const knownIds = knownOverrideIds(options);
|
|
98
|
+
validateOverrides(options.overrides, knownIds);
|
|
99
|
+
const overrideProblems = overrideFindings(options.overrides, knownIds);
|
|
100
|
+
const builders = [];
|
|
101
|
+
// Recorded HERE, at the one place a rule is actually built — the same argument
|
|
102
|
+
// `collectRule` makes for its `constructed` parameter ("the known-id list
|
|
103
|
+
// cannot answer this"). Deriving it instead from `collectRuleIds()` filtered by
|
|
104
|
+
// severity restates the construction conditionals a second time; the two agree
|
|
105
|
+
// today only because they are kept in step by hand, and the first rule added to
|
|
106
|
+
// one and not the other makes a declaration bind to a rule that was never built.
|
|
107
|
+
const constructed = [];
|
|
27
108
|
const push = (builder, meta, def) => {
|
|
28
|
-
|
|
109
|
+
const sev = lookup(options.overrides, meta.id) ?? def;
|
|
110
|
+
// Plan 0089's carrier, applied here as well as in `collectRule` — this
|
|
111
|
+
// preset builds through its own helper, and a carrier that reached only the
|
|
112
|
+
// shared path would cover the families someone remembered.
|
|
113
|
+
if (sev !== 'off') {
|
|
114
|
+
constructed.push(meta.id);
|
|
115
|
+
builders.push(declareEmptyIfListed(builder
|
|
116
|
+
.rule({ ...meta, declarationSpelling: presetDeclarationSpelling(meta.id) })
|
|
117
|
+
.asSeverity(sev), meta.id, options));
|
|
118
|
+
}
|
|
29
119
|
};
|
|
30
120
|
for (const api of options.noInlineLogic ?? []) {
|
|
31
|
-
push(functions(p).that().resideInFile(options.src).should().notContain(call(api)), {
|
|
121
|
+
push(functions(p, COLLECT_ALL).that().resideInFile(options.src).should().notContain(call(api)), {
|
|
32
122
|
id: `preset/agent/no-inline-logic/${api}`,
|
|
33
123
|
because: `${api} inline in a function is logic that belongs behind a named helper`,
|
|
34
124
|
suggestion: `extract the ${api} call into a named helper function`,
|
|
@@ -36,7 +126,11 @@ export function agentGuardrails(p, options) {
|
|
|
36
126
|
}, 'error');
|
|
37
127
|
}
|
|
38
128
|
if (options.noGenericErrors) {
|
|
39
|
-
push(functions(p
|
|
129
|
+
push(functions(p, COLLECT_ALL)
|
|
130
|
+
.that()
|
|
131
|
+
.resideInFile(options.src)
|
|
132
|
+
.should()
|
|
133
|
+
.satisfy(functionNoGenericErrors()), {
|
|
40
134
|
id: 'preset/agent/no-generic-errors',
|
|
41
135
|
because: 'a generic Error loses the type/context callers need to handle it',
|
|
42
136
|
suggestion: 'throw a domain-specific error (NotFoundError, ValidationError, …)',
|
|
@@ -44,7 +138,7 @@ export function agentGuardrails(p, options) {
|
|
|
44
138
|
}, 'error');
|
|
45
139
|
}
|
|
46
140
|
if (options.noStubs) {
|
|
47
|
-
push(functions(p).that().resideInFile(options.src).should().satisfy(noStubComments()), {
|
|
141
|
+
push(functions(p, COLLECT_ALL).that().resideInFile(options.src).should().satisfy(noStubComments()), {
|
|
48
142
|
id: 'preset/agent/no-stubs',
|
|
49
143
|
because: 'stub comments (TODO/FIXME/"not implemented") ship unfinished work',
|
|
50
144
|
suggestion: 'implement the body or remove the stub before committing',
|
|
@@ -52,7 +146,7 @@ export function agentGuardrails(p, options) {
|
|
|
52
146
|
}, 'error');
|
|
53
147
|
}
|
|
54
148
|
if (options.noEmptyBodies) {
|
|
55
|
-
push(functions(p).that().resideInFile(options.src).should().satisfy(noEmptyBodies()), {
|
|
149
|
+
push(functions(p, COLLECT_ALL).that().resideInFile(options.src).should().satisfy(noEmptyBodies()), {
|
|
56
150
|
id: 'preset/agent/no-empty-bodies',
|
|
57
151
|
because: 'an empty function body is almost always an unfinished stub',
|
|
58
152
|
suggestion: 'implement the body — every function must have at least one statement',
|
|
@@ -67,9 +161,120 @@ export function agentGuardrails(p, options) {
|
|
|
67
161
|
imperative: 'Do NOT duplicate a function body — extract the shared logic',
|
|
68
162
|
}, 'warn');
|
|
69
163
|
}
|
|
70
|
-
|
|
164
|
+
if (options.noVerdictOutsideRules) {
|
|
165
|
+
// The exemption EXTENDS the default; an adopter naming `scripts/**` must not
|
|
166
|
+
// lose `*.rules.ts` by doing so.
|
|
167
|
+
const ruleFiles = [...DEFAULT_RULE_FILES, ...(options.ruleFiles ?? [])];
|
|
168
|
+
push(modules(p)
|
|
169
|
+
.that()
|
|
170
|
+
.resideInFile(options.src)
|
|
171
|
+
.and()
|
|
172
|
+
// `not(or(...))` rather than a `notResideInFile` the builder does not
|
|
173
|
+
// have. Both combinators compose the globs their inputs declare, so the
|
|
174
|
+
// exclusion is a declared site rather than an opaque one — it just is
|
|
175
|
+
// not a site the dead-glob pipeline will ever call a fault, which is
|
|
176
|
+
// what `ruleFilesFindings` below exists for.
|
|
177
|
+
.satisfy(not(or(...ruleFiles.map((glob) => resideInFile(glob)))))
|
|
178
|
+
.should()
|
|
179
|
+
.onlyHaveTypeImportsFrom(...EESS_PACKAGES)
|
|
180
|
+
.andShould()
|
|
181
|
+
.notContain(call(EMITTERS)), {
|
|
182
|
+
id: 'preset/agent/no-verdict-outside-rules',
|
|
183
|
+
because: 'outside a rule file nothing counts what was examined, so a pass there is a claim with ' +
|
|
184
|
+
'no evidence — a loop that skips every item looks identical to one that checked them all',
|
|
185
|
+
// The remedy must NOT lead with "move it into a *.rules.ts file": the
|
|
186
|
+
// same hand-written loop moved there is inside the exemption and green,
|
|
187
|
+
// so an agent following that Fix line would un-detect the problem rather
|
|
188
|
+
// than remediate it (ADR-009 rule 2).
|
|
189
|
+
suggestion: 'express the check as a Condition and reach the verdict through a builder (.check(), or ' +
|
|
190
|
+
'a preset), so the evidence floor sees it; moving the same loop into a *.rules.ts file ' +
|
|
191
|
+
'hides it, it does not fix it. If this module is a gate script that finishes through an ' +
|
|
192
|
+
'emitter, name it in ruleFiles',
|
|
193
|
+
imperative: 'Do NOT import eess as a value (only `import type`), or call ' +
|
|
194
|
+
'finishPreset/reportViolations, outside a rule file, a test, or a file listed in ' +
|
|
195
|
+
'ruleFiles — and inside one, reach the verdict through a builder, never a hand-written ' +
|
|
196
|
+
'loop: a green built by hand certifies nothing',
|
|
197
|
+
}, 'error');
|
|
198
|
+
}
|
|
199
|
+
// Unknown override keys FIRST: they say the configuration is wrong, which
|
|
200
|
+
// the reader needs before any finding produced under it (bug 0038).
|
|
201
|
+
// `constructed` is recorded at the `push` site above, not re-derived here.
|
|
202
|
+
const otherFindings = [
|
|
203
|
+
...overrideProblems,
|
|
204
|
+
...declaredEmptyFindings(options.expectEmpty, constructed),
|
|
205
|
+
...ruleFilesFindings(p, options),
|
|
206
|
+
];
|
|
207
|
+
return deliver([
|
|
208
|
+
...otherFindings,
|
|
209
|
+
// Plan 0100, LAST of the config-findings: only when nothing else above
|
|
210
|
+
// already explains the empty result (an unknown override key, an unbound
|
|
211
|
+
// `expectEmpty`) does "no rule was ever enabled" get to be the diagnosis.
|
|
212
|
+
...assertEnabled(attempted, otherFindings, {
|
|
213
|
+
id: 'preset/agent/constructs-nothing',
|
|
214
|
+
presetName: 'agentGuardrails',
|
|
215
|
+
optionsHint: 'noInlineLogic, noGenericErrors, noStubs, noEmptyBodies, noCopyPaste, noVerdictOutsideRules',
|
|
216
|
+
}),
|
|
217
|
+
...builders,
|
|
218
|
+
], options);
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Widen the typed override map for a lookup by a runtime-built id.
|
|
222
|
+
*
|
|
223
|
+
* `no-inline-logic/${api}` ids are constructed from the caller's own options, so
|
|
224
|
+
* the key here is a `string` and the map is keyed by a literal union. The
|
|
225
|
+
* widening is confined to this one function rather than loosening the option
|
|
226
|
+
* type, which is what makes the typo a compile error for every other key.
|
|
227
|
+
*/
|
|
228
|
+
function lookup(overrides, id) {
|
|
229
|
+
const widened = overrides;
|
|
230
|
+
return widened?.[id];
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* The four ids this preset can construct regardless of whether their flag is
|
|
234
|
+
* currently set — fixed, matching `AgentGuardrailsRuleId`'s own closed union
|
|
235
|
+
* members (everything but the open `no-inline-logic/${string}` arm).
|
|
236
|
+
*/
|
|
237
|
+
const STATIC_RULE_IDS = [
|
|
238
|
+
'preset/agent/no-generic-errors',
|
|
239
|
+
'preset/agent/no-stubs',
|
|
240
|
+
'preset/agent/no-empty-bodies',
|
|
241
|
+
'preset/agent/no-copy-paste',
|
|
242
|
+
'preset/agent/no-verdict-outside-rules',
|
|
243
|
+
];
|
|
244
|
+
/**
|
|
245
|
+
* Rule ids the given options WOULD generate if every flag were on — for
|
|
246
|
+
* override-key validation. Static ids are always known (a key for a rule not
|
|
247
|
+
* yet enabled is still a real rule, not a typo); `no-inline-logic/${api}` ids
|
|
248
|
+
* stay scoped to what `noInlineLogic` actually named, because that arm is open
|
|
249
|
+
* by construction and the only way to catch a typo in it is to compare against
|
|
250
|
+
* what the caller wrote.
|
|
251
|
+
*
|
|
252
|
+
* Deliberately NOT `attempted` below, which is flag-gated. Reusing `attempted`
|
|
253
|
+
* here was the bug plan 0100's review found: `overrides: { 'preset/agent/no-
|
|
254
|
+
* generic-errors': 'off' } }` with `noGenericErrors` unset reported "matches no
|
|
255
|
+
* rule in this preset" with an EMPTY enumeration — a real, correctly-spelled id
|
|
256
|
+
* misdiagnosed as unknown, and `otherFindings.length > 0` from that wrong
|
|
257
|
+
* finding then silently suppressed the correct `constructs-nothing` finding
|
|
258
|
+
* `assertEnabled` would otherwise have reported. `dataLayerIsolation` never had
|
|
259
|
+
* this bug: it already validates against the full static `RULE_IDS`, not its
|
|
260
|
+
* flag-gated `attempted`.
|
|
261
|
+
*/
|
|
262
|
+
function knownOverrideIds(options) {
|
|
263
|
+
const ids = [...STATIC_RULE_IDS];
|
|
264
|
+
for (const api of options.noInlineLogic ?? [])
|
|
265
|
+
ids.push(`preset/agent/no-inline-logic/${api}`);
|
|
266
|
+
return ids;
|
|
71
267
|
}
|
|
72
|
-
/**
|
|
268
|
+
/**
|
|
269
|
+
* Ids plan 0100's `attempted` needs: the ones the caller's OPTIONS actually
|
|
270
|
+
* ask for, flag-gated — `assertEnabled` fires when this is empty. NOT for
|
|
271
|
+
* override validation; see {@link knownOverrideIds}.
|
|
272
|
+
*
|
|
273
|
+
* Kept in step with the five `if (options.x)` blocks in `agentGuardrails`
|
|
274
|
+
* itself BY HAND — same shape of fragility this file already notes for
|
|
275
|
+
* `constructed` (review: nothing enforces the two stay copy-identical as
|
|
276
|
+
* flags are added).
|
|
277
|
+
*/
|
|
73
278
|
function collectRuleIds(options) {
|
|
74
279
|
const ids = [];
|
|
75
280
|
for (const api of options.noInlineLogic ?? [])
|
|
@@ -82,6 +287,90 @@ function collectRuleIds(options) {
|
|
|
82
287
|
ids.push('preset/agent/no-empty-bodies');
|
|
83
288
|
if (options.noCopyPaste)
|
|
84
289
|
ids.push('preset/agent/no-copy-paste');
|
|
290
|
+
if (options.noVerdictOutsideRules)
|
|
291
|
+
ids.push('preset/agent/no-verdict-outside-rules');
|
|
85
292
|
return ids;
|
|
86
293
|
}
|
|
294
|
+
/**
|
|
295
|
+
* A `ruleFiles` entry that matches no file in the project.
|
|
296
|
+
*
|
|
297
|
+
* **Why this is its own check and not the dead-glob pipeline** — plan 0237's
|
|
298
|
+
* build finding. The exclusion is `not(or(...))`, and `isDeadSite` opens with
|
|
299
|
+
* `if ((site.polarity ?? 'positive') === 'negative') return false`, because
|
|
300
|
+
* `not(dead)` over-selects rather than under-selecting. Exclusion sites are
|
|
301
|
+
* never faults either: "a condition glob matching nothing is indistinguishable
|
|
302
|
+
* from an armed tripwire that has not fired". Both decisions are correct and
|
|
303
|
+
* neither is weakened here.
|
|
304
|
+
*
|
|
305
|
+
* So the question is asked differently: `isDeadSite` about each caller-supplied
|
|
306
|
+
* glob **on its own, at positive polarity**. Same computation, same
|
|
307
|
+
* `syntacticFault` anchoring — so this check and `doctor`'s pre-flight cannot
|
|
308
|
+
* disagree about what matches nothing.
|
|
309
|
+
*
|
|
310
|
+
* **Only the caller's entries.** {@link DEFAULT_RULE_FILES} is never reported: a
|
|
311
|
+
* project with no `*.spec.ts` is ordinary, the defaults are not the caller's to
|
|
312
|
+
* fix, and reporting them would red the preset out of the box.
|
|
313
|
+
*
|
|
314
|
+
* The finding is legibility, not a hole, and says so. A dead entry is already
|
|
315
|
+
* fail-CLOSED — an exemption that exempts nothing reds the files it names rather
|
|
316
|
+
* than going quiet. What it prevents is the loop: without it a typo surfaces as
|
|
317
|
+
* "your gate script violates no-verdict-outside-rules", whose remedy says "name
|
|
318
|
+
* it in ruleFiles", which the adopter did — with a typo.
|
|
319
|
+
*/
|
|
320
|
+
function ruleFilesFindings(p, options) {
|
|
321
|
+
if (options.noVerdictOutsideRules !== true)
|
|
322
|
+
return [];
|
|
323
|
+
const declared = options.ruleFiles ?? [];
|
|
324
|
+
if (declared.length === 0)
|
|
325
|
+
return [];
|
|
326
|
+
const universe = pathUniverse(p);
|
|
327
|
+
// Asked at POSITIVE polarity and `position: 'discovery'`, deliberately. In the
|
|
328
|
+
// rule this same glob sits negated inside an exclusion, where `isDeadSite`
|
|
329
|
+
// answers `false` by design (twice over). Here the question is the honest one:
|
|
330
|
+
// "does this glob, by itself, match anything?"
|
|
331
|
+
//
|
|
332
|
+
// **`base` is DERIVED, not hard-coded, and that is the whole correctness of
|
|
333
|
+
// this check.** An architect review measured what a hard-coded
|
|
334
|
+
// `base: 'absolute'` did: `ruleFiles: ['gates/**']` genuinely exempted
|
|
335
|
+
// `gates/check-corpus.ts` — `resideInFile` falls back to matching the path
|
|
336
|
+
// relative to the tsconfig root for an unanchored glob (plan 0067 C) — while
|
|
337
|
+
// this producer reported "matches no file in this project, so it exempts
|
|
338
|
+
// nothing" about the same string. Both in one run. That is two derivations
|
|
339
|
+
// disagreeing about one glob, which is the failure this project spends most
|
|
340
|
+
// of its guards on, and the remedy it printed told the adopter to WIDEN a
|
|
341
|
+
// correctly-scoped exemption to silence a finding that was wrong.
|
|
342
|
+
//
|
|
343
|
+
// So the derivation is `resideInFile`'s own, taken from the same helper:
|
|
344
|
+
// every other site that stamps a `GlobSite` does `relative ? 'normalized' :
|
|
345
|
+
// 'absolute'` (`identity.ts:83`, `:114`, `:157`), and this one now does too.
|
|
346
|
+
const dead = declared.filter((glob) => isDeadSite({
|
|
347
|
+
glob,
|
|
348
|
+
kind: 'file-path',
|
|
349
|
+
base: isProjectRelative(glob) ? 'normalized' : 'absolute',
|
|
350
|
+
position: 'discovery',
|
|
351
|
+
origin: `ruleFiles entry "${glob}"`,
|
|
352
|
+
}, universe));
|
|
353
|
+
if (dead.length === 0)
|
|
354
|
+
return [];
|
|
355
|
+
const violations = dead.map((glob) => ({
|
|
356
|
+
rule: `preset ruleFiles '${glob}'`,
|
|
357
|
+
ruleId: 'preset/agent/rule-files-matches-nothing',
|
|
358
|
+
element: glob,
|
|
359
|
+
file: '',
|
|
360
|
+
line: 0,
|
|
361
|
+
message: `ruleFiles entry '${glob}' matches no file in this project, so it exempts nothing.`,
|
|
362
|
+
because: 'an exemption that exempts nothing is not a weaker exemption, it is a typo — and the rule ' +
|
|
363
|
+
'it was meant to quiet will red the very files the entry names, sending the reader back to ' +
|
|
364
|
+
'a list that already says what they meant',
|
|
365
|
+
suggestion: `Correct the glob or remove it. An unanchored glob like 'scripts/**' is matched ` +
|
|
366
|
+
`against the path relative to your tsconfig root, so it is already correct for a ` +
|
|
367
|
+
`top-level directory; '**/scripts/**' matches one at any depth. Check the spelling ` +
|
|
368
|
+
`and the depth before widening. ` +
|
|
369
|
+
UNSUPPRESSABLE,
|
|
370
|
+
bypassFilters: true,
|
|
371
|
+
}));
|
|
372
|
+
// `examined: 0` and honest: a CONFIGURATION finding, not a rule that examined
|
|
373
|
+
// units. The receipt carries a violation, so ADR-014 §4 passes it through.
|
|
374
|
+
return [{ violations: () => collectResult(violations, { examined: 0 }) }];
|
|
375
|
+
}
|
|
87
376
|
//# sourceMappingURL=agent-guardrails.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-guardrails.js","sourceRoot":"","sources":["../../src/presets/agent-guardrails.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAA;
|
|
1
|
+
{"version":3,"file":"agent-guardrails.js","sourceRoot":"","sources":["../../src/presets/agent-guardrails.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAA;AAEhE,OAAO,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAA;AAE5D,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,wBAAwB,CAAA;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AACtD,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAA;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAEvD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAA;AAC7C,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAA;AAC5D,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnE,OAAO,E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QAClC,MAAM,EAAE,yCAAyC;QACjD,OAAO,EAAE,IAAI;QACb,IAAI,EAAE,EAAE;QACR,IAAI,EAAE,CAAC;QACP,OAAO,EAAE,oBAAoB,IAAI,2DAA2D;QAC5F,OAAO,EACL,2FAA2F;YAC3F,4FAA4F;YAC5F,0CAA0C;QAC5C,UAAU,EACR,iFAAiF;YACjF,kFAAkF;YAClF,oFAAoF;YACpF,iCAAiC;YACjC,cAAc;QAChB,aAAa,EAAE,IAAI;KACpB,CAAC,CAAC,CAAA;IACH,8EAA8E;IAC9E,2EAA2E;IAC3E,OAAO,CAAC,EAAE,UAAU,EAAE,GAAG,EAAE,CAAC,aAAa,CAAC,UAAU,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAA;AAC3E,CAAC"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
import type { CollectResult } from '@nielspeter/eess';
|
|
2
|
+
import type { ImportOptions } from '../core/import-options.js';
|
|
1
3
|
import type { ArchProject } from '../core/project.js';
|
|
2
|
-
import type {
|
|
4
|
+
import type { RuleBuilderLike } from '@nielspeter/eess';
|
|
3
5
|
import type { PresetBaseOptions } from './shared.js';
|
|
4
|
-
|
|
6
|
+
/** This preset's rule ids, derived from `RULE_IDS` so the two cannot drift. */
|
|
7
|
+
type StrictBoundariesRuleId = (typeof RULE_IDS)[number];
|
|
8
|
+
export interface StrictBoundariesOptions extends PresetBaseOptions<StrictBoundariesRuleId> {
|
|
5
9
|
/** Glob pattern for boundary folders (e.g., 'src/features/*') */
|
|
6
10
|
folders: string;
|
|
7
11
|
/** Glob patterns for shared folders accessible by all boundaries */
|
|
@@ -10,10 +14,49 @@ export interface StrictBoundariesOptions extends PresetBaseOptions {
|
|
|
10
14
|
isolateTests?: boolean;
|
|
11
15
|
/** If true, warn on copy-pasted function bodies across boundaries */
|
|
12
16
|
noCopyPaste?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* This project's answer to "is a type-only edge a dependency?", applied to
|
|
19
|
+
* every rule this preset constructs **whose condition takes one** — plan 0089:
|
|
20
|
+
* `no-cycles`, `no-cross-boundary`, `shared-isolation`, `test-isolation`.
|
|
21
|
+
* `no-duplicate-bodies` is excluded because it compares function bodies, not imports.
|
|
22
|
+
*
|
|
23
|
+
* The conditions disagree by default, deliberately: `beFreeOfCycles` ignores
|
|
24
|
+
* type-only imports because it asks whether the module is *evaluated*, and an
|
|
25
|
+
* erased import cannot contribute to an initialization cycle; the layer and
|
|
26
|
+
* boundary conditions count them because they ask whether the code is
|
|
27
|
+
* *coupled*. Holding a builder, that distinction is visible and you choose per
|
|
28
|
+
* condition. Through a preset it is invisible, and this option exists because
|
|
29
|
+
* a preset user could not align them even when their project wanted them
|
|
30
|
+
* aligned.
|
|
31
|
+
*
|
|
32
|
+
* So passing it moves exactly one side, and which side depends on the value:
|
|
33
|
+
* `{ ignoreTypeImports: true }` stops the layer rules counting type coupling
|
|
34
|
+
* (the cycle rule already ignored it); `{ ignoreTypeImports: false }` makes
|
|
35
|
+
* the cycle rule count type edges (the layer rules already did). `docs/presets.md`
|
|
36
|
+
* carries that table.
|
|
37
|
+
*/
|
|
38
|
+
importOptions?: ImportOptions;
|
|
13
39
|
}
|
|
40
|
+
declare const RULE_IDS: readonly ["preset/boundaries/shared-discovery", "preset/boundaries/no-cycles", "preset/boundaries/no-cross-boundary", "preset/boundaries/shared-isolation", "preset/boundaries/test-isolation", "preset/boundaries/no-duplicate-bodies"];
|
|
14
41
|
/**
|
|
15
42
|
* Enforce strict module boundaries: no cycles, no cross-boundary imports,
|
|
16
43
|
* shared isolation, and optional copy-paste detection.
|
|
17
44
|
*/
|
|
18
|
-
|
|
45
|
+
/**
|
|
46
|
+
* `report` names a delivery mode; omitting it returns the un-executed builders.
|
|
47
|
+
*
|
|
48
|
+
* Overloaded so the common call keeps its exact type — a bare union would make
|
|
49
|
+
* every existing `.violations()` call site an error (26 test files, measured).
|
|
50
|
+
*
|
|
51
|
+
* **The reporting overload is declared FIRST, and that ordering is load-bearing.**
|
|
52
|
+
* `Parameters<typeof preset>[1]` resolves to the LAST overload, and several tests
|
|
53
|
+
* type their options helper that way; with the builder overload last, that helper
|
|
54
|
+
* keeps the shape callers actually use. Overload resolution still picks the
|
|
55
|
+
* reporting one for a call that names `report`, because it is the first match.
|
|
56
|
+
*/
|
|
57
|
+
export declare function strictBoundaries(p: ArchProject, options: StrictBoundariesOptions & {
|
|
58
|
+
report: 'builders';
|
|
59
|
+
}): RuleBuilderLike[];
|
|
60
|
+
export declare function strictBoundaries(p: ArchProject, options: StrictBoundariesOptions): CollectResult;
|
|
61
|
+
export {};
|
|
19
62
|
//# sourceMappingURL=boundaries.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boundaries.d.ts","sourceRoot":"","sources":["../../src/presets/boundaries.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"boundaries.d.ts","sourceRoot":"","sources":["../../src/presets/boundaries.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAErD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAE9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AACrD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAIvD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAWpD,+EAA+E;AAC/E,KAAK,sBAAsB,GAAG,CAAC,OAAO,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAA;AAEvD,MAAM,WAAW,uBAAwB,SAAQ,iBAAiB,CAAC,sBAAsB,CAAC;IACxF,iEAAiE;IACjE,OAAO,EAAE,MAAM,CAAA;IACf,oEAAoE;IACpE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAA;IACjB,qEAAqE;IACrE,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,qEAAqE;IACrE,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,aAAa,CAAC,EAAE,aAAa,CAAA;CAC9B;AAED,QAAA,MAAM,QAAQ,0OAOJ,CAAA;AAmFV;;;GAGG;AACH;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAC9B,CAAC,EAAE,WAAW,EACd,OAAO,EAAE,uBAAuB,GAAG;IAAE,MAAM,EAAE,UAAU,CAAA;CAAE,GACxD,eAAe,EAAE,CAAA;AACpB,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,WAAW,EAAE,OAAO,EAAE,uBAAuB,GAAG,aAAa,CAAA"}
|