@nielspeter/eess-ts 0.2.0 → 0.4.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 +87 -34
- 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 +73 -31
- 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 +134 -30
- 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 +393 -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 +181 -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 +173 -26
- 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 +12 -3
- 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 +242 -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 +105 -29
- 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 +3 -2
- package/dist/cli/commands/baseline.d.ts.map +1 -1
- package/dist/cli/commands/baseline.js +68 -6
- 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 +241 -45
- 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 +60 -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 +98 -33
- 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 +21 -29
- package/dist/cli/load-rules.js.map +1 -1
- package/dist/cli/resolve-config.d.ts.map +1 -1
- package/dist/cli/resolve-config.js +24 -14
- 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 +293 -0
- package/dist/cli/rule-file-findings.js.map +1 -0
- package/dist/cli/watch.d.ts +20 -7
- package/dist/cli/watch.d.ts.map +1 -1
- package/dist/cli/watch.js +39 -14
- 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 +38 -17
- 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 +10 -0
- 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 +17 -4
- 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 +109 -92
- 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 +96 -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 +56 -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 +119 -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 +382 -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 +54 -0
- package/dist/core/exclusion-comments.d.ts.map +1 -0
- package/dist/core/exclusion-comments.js +310 -0
- package/dist/core/exclusion-comments.js.map +1 -0
- package/dist/core/execute-rule.d.ts +150 -0
- package/dist/core/execute-rule.d.ts.map +1 -0
- package/dist/core/execute-rule.js +580 -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/line-index.d.ts +3 -0
- package/dist/core/line-index.d.ts.map +1 -0
- package/dist/core/line-index.js +229 -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 +592 -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 +214 -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 +54 -0
- package/dist/core/path-universe.d.ts.map +1 -0
- package/dist/core/path-universe.js +65 -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 +24 -0
- package/dist/core/project.js.map +1 -1
- package/dist/core/rule-builder.d.ts +282 -0
- package/dist/core/rule-builder.d.ts.map +1 -0
- package/dist/core/rule-builder.js +445 -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 +126 -0
- package/dist/core/rule-declaration.js.map +1 -0
- package/dist/core/terminal-builder.d.ts +625 -0
- package/dist/core/terminal-builder.d.ts.map +1 -0
- package/dist/core/terminal-builder.js +787 -0
- package/dist/core/terminal-builder.js.map +1 -0
- package/dist/core/terminal-execution.d.ts +23 -0
- package/dist/core/terminal-execution.d.ts.map +1 -0
- package/dist/core/terminal-execution.js +71 -0
- package/dist/core/terminal-execution.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/index.js +1 -1
- package/dist/graphql/index.js.map +1 -1
- package/dist/graphql/resolver-rule-builder.d.ts +98 -23
- package/dist/graphql/resolver-rule-builder.d.ts.map +1 -1
- package/dist/graphql/resolver-rule-builder.js +151 -21
- 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 +81 -12
- package/dist/graphql/schema-loader.js.map +1 -1
- package/dist/graphql/schema-rule-builder.d.ts +57 -20
- package/dist/graphql/schema-rule-builder.d.ts.map +1 -1
- package/dist/graphql/schema-rule-builder.js +101 -25
- 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 +19 -0
- package/dist/helpers/baseline-generator.d.ts.map +1 -0
- package/dist/helpers/baseline-generator.js +18 -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 +122 -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 +48 -47
- 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 +44 -0
- package/dist/helpers/diff-aware.d.ts.map +1 -0
- package/dist/helpers/diff-aware.js +84 -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 +114 -20
- 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 +56 -17
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +57 -13
- 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 +28 -6
- package/dist/models/arch-function.d.ts.map +1 -1
- package/dist/models/arch-function.js +106 -3
- package/dist/models/arch-function.js.map +1 -1
- package/dist/models/arch-jsx-element.js +2 -2
- 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/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 +22 -15
- package/dist/presets/agent-guardrails.d.ts.map +1 -1
- package/dist/presets/agent-guardrails.js +124 -19
- package/dist/presets/agent-guardrails.js.map +1 -1
- package/dist/presets/boundaries.d.ts +45 -2
- 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 +22 -2
- 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 +7 -5
- package/dist/presets/index.d.ts.map +1 -1
- package/dist/presets/index.js +9 -3
- package/dist/presets/index.js.map +1 -1
- package/dist/presets/layered.d.ts +46 -2
- 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 +80 -9
- 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 +270 -2
- package/dist/presets/shared.d.ts.map +1 -1
- package/dist/presets/shared.js +338 -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 +33 -6
- 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 +39 -9
- package/dist/rules/metrics.js.map +1 -1
- package/dist/smells/duplicate-bodies.d.ts +58 -5
- package/dist/smells/duplicate-bodies.d.ts.map +1 -1
- package/dist/smells/duplicate-bodies.js +137 -56
- package/dist/smells/duplicate-bodies.js.map +1 -1
- package/dist/smells/fingerprint.d.ts +8 -1
- package/dist/smells/fingerprint.d.ts.map +1 -1
- package/dist/smells/fingerprint.js +21 -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 +27 -0
- package/dist/smells/similar-pairs.d.ts.map +1 -0
- package/dist/smells/similar-pairs.js +52 -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 +111 -14
- package/dist/smells/smell-builder.js.map +1 -1
- 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 +64 -16
- package/dist/tsconfig/tsconfig-builder.js.map +1 -1
- package/package.json +3 -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
package/dist/presets/shared.d.ts
CHANGED
|
@@ -1,3 +1,271 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import type { ArchViolation, ReportMode, OutputFormat } from '@nielspeter/eess';
|
|
2
|
+
/**
|
|
3
|
+
* What a preset can be asked to do with its rules.
|
|
4
|
+
*
|
|
5
|
+
* Deliberately a DIALECT type rather than a widening of the kernel's
|
|
6
|
+
* `ReportMode`: `'builders'` is not a reporting mode at all — it suppresses the
|
|
7
|
+
* run — and the kernel's `finishPreset` must never receive it. Keeping it here
|
|
8
|
+
* means the kernel's three emission modes stay exactly three.
|
|
9
|
+
*/
|
|
10
|
+
export type PresetDelivery = ReportMode | 'builders';
|
|
11
|
+
import type { Predicate } from '@nielspeter/eess';
|
|
12
|
+
import type { Located } from '../predicates/identity.js';
|
|
13
|
+
import type { RuleMetadata } from '@nielspeter/eess';
|
|
14
|
+
import type { RuleBuilderLike } from '@nielspeter/eess';
|
|
15
|
+
export type RuleSeverity = 'error' | 'warn' | 'off';
|
|
16
|
+
/**
|
|
17
|
+
* A builder a preset can configure and hand back: `.rule()` / `.asSeverity()`
|
|
18
|
+
* chain (return `this`), `.violations()` runs it. Satisfied by both the
|
|
19
|
+
* `RuleBuilder` and `TerminalBuilder` hierarchies.
|
|
20
|
+
*/
|
|
21
|
+
interface PresetRule {
|
|
22
|
+
rule(m: RuleMetadata): this;
|
|
23
|
+
asSeverity(level: 'error' | 'warn'): this;
|
|
24
|
+
/** Plan 0089's carrier — hoisted to `TerminalBuilder` by plan 0097, so every preset rule has it. */
|
|
25
|
+
expectEmpty(): this;
|
|
26
|
+
violations(): ArchViolation[];
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Resolve a preset rule's effective severity and return it as a configured,
|
|
30
|
+
* UN-executed builder for the caller to spread into a rule array. `'off'` →
|
|
31
|
+
* empty array (spread-friendly). The returning-form replacement for the old
|
|
32
|
+
* self-executing `dispatchRule`.
|
|
33
|
+
*
|
|
34
|
+
* Takes the rule's full metadata, not just its id. It used to take an id and
|
|
35
|
+
* attach `{ id }` alone, which meant every rule in `strictBoundaries`,
|
|
36
|
+
* `layeredArchitecture` and `dataLayerIsolation` — 37 of them in
|
|
37
|
+
* `strictBoundaries` alone — failed with no `because` and no `suggestion`.
|
|
38
|
+
* ADR-009 rule 2 requires every failure to carry its sanctioned fix, and a
|
|
39
|
+
* preset is the one place a user cannot supply it themselves: they did not
|
|
40
|
+
* write the rule.
|
|
41
|
+
*/
|
|
42
|
+
export declare function collectRule(builder: PresetRule, meta: RuleMetadata & {
|
|
43
|
+
id: string;
|
|
44
|
+
}, defaultSeverity: RuleSeverity, config: PresetBaseOptions | undefined, constructed?: string[]): RuleBuilderLike[];
|
|
45
|
+
/**
|
|
46
|
+
* Apply plan 0089's declaration carrier to one constructed rule.
|
|
47
|
+
*
|
|
48
|
+
* Exported because the presets build rules three different ways — through
|
|
49
|
+
* `collectRule`, through a local `push` helper, and through an inline loop — and
|
|
50
|
+
* a carrier that reached only one of them would be the shape ADR-009's Context
|
|
51
|
+
* table is about: a mechanism that covers the families someone remembered.
|
|
52
|
+
*/
|
|
53
|
+
export declare function declareEmptyIfListed<T extends PresetRule>(builder: T, id: string, config: PresetBaseOptions | undefined): T;
|
|
54
|
+
/**
|
|
55
|
+
* The spelling a PRESET user must type to declare this rule empty — plan 0099.
|
|
56
|
+
*
|
|
57
|
+
* This is the single site that knows both facts the remedy needs: the rule's id,
|
|
58
|
+
* and that the caller is a preset which accepts `expectEmpty`. Core knows only
|
|
59
|
+
* the id, and used to guess from its `preset/` prefix — a naming convention, not
|
|
60
|
+
* a capability, and false for a hand-written rule or a third-party preset that
|
|
61
|
+
* never accepted the option.
|
|
62
|
+
*
|
|
63
|
+
* Applied to every preset rule, not only declared ones: the advice is printed on
|
|
64
|
+
* a rule that examined nothing, which is exactly the rule that has NOT been
|
|
65
|
+
* declared yet.
|
|
66
|
+
*/
|
|
67
|
+
export declare function presetDeclarationSpelling(id: string): string;
|
|
68
|
+
/**
|
|
69
|
+
* Guard a preset's *discovery* step (ADR-008 / plan 0067): if a glob discovered
|
|
70
|
+
* no subjects, return a failing rule carrying a config-level meta-finding rather
|
|
71
|
+
* than silently generating no rules — the false green a boundaries/layers preset
|
|
72
|
+
* must never produce. The finding bypasses diff/baseline so it survives the
|
|
73
|
+
* standard CI mode.
|
|
74
|
+
*/
|
|
75
|
+
export declare function assertDiscovered(discovered: readonly unknown[], finding: {
|
|
76
|
+
id: string;
|
|
77
|
+
glob: string;
|
|
78
|
+
remedy: string;
|
|
79
|
+
}): RuleBuilderLike[];
|
|
80
|
+
/**
|
|
81
|
+
* Options every preset accepts.
|
|
82
|
+
*
|
|
83
|
+
* `TRuleId` is that preset's own rule ids as a literal union, so a misspelled
|
|
84
|
+
* override key is a **compile error** rather than a silent no-op
|
|
85
|
+
* ([bug 0157](../../../../work/bugs/0157-a-typo-in-a-preset-override-key-is-a-silent-false-green.md)).
|
|
86
|
+
* Measured before this: `'…/no-silent-cach': 'error'` left the rule at `warn`
|
|
87
|
+
* and the build green — the escalation the author asked for simply did not
|
|
88
|
+
* happen, and the only trace was a line on stderr.
|
|
89
|
+
*
|
|
90
|
+
* Catching it in the editor is strictly better than catching it at run time:
|
|
91
|
+
* zero CI cycles, and it fires while the author is still looking at the key.
|
|
92
|
+
* The runtime finding exists as well, for the paths a type cannot reach — a
|
|
93
|
+
* JavaScript consumer, a dynamically-built overrides object, a config read from
|
|
94
|
+
* disk.
|
|
95
|
+
*
|
|
96
|
+
* Defaults to `string`, so anything outside this package that extends
|
|
97
|
+
* `PresetBaseOptions` keeps compiling.
|
|
98
|
+
*/
|
|
99
|
+
/**
|
|
100
|
+
* An unknown override key, as a failing configuration finding —
|
|
101
|
+
* [bug 0157](../../../../work/bugs/0157-a-typo-in-a-preset-override-key-is-a-silent-false-green.md).
|
|
102
|
+
*
|
|
103
|
+
* `validateOverrides` writes a line to stderr and returns `void`. That is not a
|
|
104
|
+
* signal: measured, `'…/no-silent-cach': 'error'` left the rule at `warn`, the
|
|
105
|
+
* build passed, and the printed warning never reached the exit code. A rule the
|
|
106
|
+
* author asked to escalate silently did not.
|
|
107
|
+
*
|
|
108
|
+
* ## Why a sibling rather than changing `validateOverrides`
|
|
109
|
+
*
|
|
110
|
+
* That function is re-exported from `src/presets/index.ts` and documented with a
|
|
111
|
+
* `void` signature. Changing it to return rules is a **published API break** for
|
|
112
|
+
* a fault this bug concedes is low-frequency, and the user-visible outcome is
|
|
113
|
+
* identical either way — so it stays as it is and this sits beside it. ADR-008
|
|
114
|
+
* rule 6 says guard the guard, not break the API.
|
|
115
|
+
*
|
|
116
|
+
* `PresetBaseOptions` now types the key as a literal union, so most typos never
|
|
117
|
+
* reach here at all. This covers what a type cannot: JavaScript consumers, a
|
|
118
|
+
* dynamically-built overrides object, and `agent-guardrails`' template-literal
|
|
119
|
+
* ids, where the API segment is open by construction.
|
|
120
|
+
*/
|
|
121
|
+
export declare function overrideFindings(overrides: Partial<Record<string, RuleSeverity>> | undefined, knownIds: readonly string[]): RuleBuilderLike[];
|
|
122
|
+
/**
|
|
123
|
+
* Findings for `expectEmpty` ids that bind to no constructed rule — plan 0089.
|
|
124
|
+
*
|
|
125
|
+
* The sibling of {@link overrideFindings}, and it fails for a sharper reason.
|
|
126
|
+
* An unknown override key leaves a rule at its default: an escalation that did
|
|
127
|
+
* not happen. An unknown `expectEmpty` id turns an **expiring assertion into
|
|
128
|
+
* nothing** — the author declared a state, the declaration bound to no rule, and
|
|
129
|
+
* once plan 0099's floor lands they are told to declare what they already
|
|
130
|
+
* declared, misspelled. That is bug 0017's shape, and ADR-009 rule 1 forbids
|
|
131
|
+
* answering it with a warning nobody reads.
|
|
132
|
+
*
|
|
133
|
+
* The unbound id is reported against the **constructed** set, not the declared
|
|
134
|
+
* one, so a rule switched `'off'` and still named here reports too — which is
|
|
135
|
+
* correct: `'off'` deleted the rule, so the declaration about it is dead.
|
|
136
|
+
*/
|
|
137
|
+
export declare function declaredEmptyFindings(expectEmpty: readonly string[] | undefined, constructedIds: readonly string[]): RuleBuilderLike[];
|
|
138
|
+
/**
|
|
139
|
+
* Guard a preset's *construction* step (plan 0100): every rule this preset can
|
|
140
|
+
* build sits behind its own optional flag, and the required field is only the
|
|
141
|
+
* selector — so satisfying the type completely can still enable nothing.
|
|
142
|
+
* Measured: `agentGuardrails({ src })` and `dataLayerIsolation({ repositories })`
|
|
143
|
+
* both construct zero rules, on every corpus, and report nothing — the loop a
|
|
144
|
+
* user holds runs zero times and every gate is green.
|
|
145
|
+
*
|
|
146
|
+
* `attempted` is the id list the caller's OPTIONS asked for, computed BEFORE
|
|
147
|
+
* `overrides` is consulted — the same distinction plan 0099's floor draws
|
|
148
|
+
* between zero-subjects and declared-empty:
|
|
149
|
+
*
|
|
150
|
+
* - `attempted.length === 0` — no rule was ever enabled. A mistake: fire.
|
|
151
|
+
* - `attempted.length > 0` and nothing was constructed — every enabled rule
|
|
152
|
+
* was explicitly turned off (`overrides: { id: 'off' }`), which
|
|
153
|
+
* {@link UNSUPPRESSABLE}'s own text already treats as a permanent, legitimate
|
|
154
|
+
* decision, not a suppression. Silent.
|
|
155
|
+
*
|
|
156
|
+
* Fires only when `otherFindings` — every other config-finding builder this
|
|
157
|
+
* preset already produced (unknown override keys, unbound `expectEmpty`, a
|
|
158
|
+
* discovery guard) — is also empty, so a preset with a more specific cause
|
|
159
|
+
* reports that cause once, not this one stacked on top of it. Same ordering
|
|
160
|
+
* the zero-examined producer already states: report last, and only when
|
|
161
|
+
* nothing else already explained the emptiness.
|
|
162
|
+
*
|
|
163
|
+
* Returns the same `{ violations }`-only shape as {@link assertDiscovered} and
|
|
164
|
+
* {@link overrideFindings} — sufficient for both real consumers of a preset's
|
|
165
|
+
* `RuleBuilderLike[]` (`checkAll()`, `src/cli/load-rules.ts`), which call only
|
|
166
|
+
* `.violations()` on every array element, never `.check()`/`.warn()` on one
|
|
167
|
+
* item in isolation.
|
|
168
|
+
*/
|
|
169
|
+
export declare function assertEnabled(attempted: readonly string[], otherFindings: readonly RuleBuilderLike[], finding: {
|
|
170
|
+
id: string;
|
|
171
|
+
presetName: string;
|
|
172
|
+
optionsHint: string;
|
|
173
|
+
}): RuleBuilderLike[];
|
|
174
|
+
export interface PresetBaseOptions<TRuleId extends string = string> {
|
|
175
|
+
overrides?: Partial<Record<TRuleId, RuleSeverity>>;
|
|
176
|
+
/**
|
|
177
|
+
* Delivery mode — [ADR-008](../../../../adr/008-caller-owns-reporting.md).
|
|
178
|
+
*
|
|
179
|
+
* How the preset delivers its result. **Omitting it runs the rules and
|
|
180
|
+
* throws** — ADR-008's documented default, and what published `eess-ts` has
|
|
181
|
+
* always done:
|
|
182
|
+
*
|
|
183
|
+
* - omitted / `'throw'` → run, emit once, then throw if anything failed;
|
|
184
|
+
* - `'return'` → run every rule and return the violations, emitting nothing;
|
|
185
|
+
* - `'warn'` → run and emit, without throwing;
|
|
186
|
+
* - `'builders'` → build the rules and run **nothing**, returning them for the
|
|
187
|
+
* caller to run (pair with `checkAll()`).
|
|
188
|
+
*
|
|
189
|
+
* `'builders'` is spelled out on purpose. Plan 0165 Phase 3 restored `report`
|
|
190
|
+
* "additive, by overload" and, as a side effect of the overload order, made
|
|
191
|
+
* the builder form what you got by saying *nothing* — so the documented
|
|
192
|
+
* onboarding path (a bare `layeredArchitecture(p, {…})` inside an `it()`)
|
|
193
|
+
* became a test that passed unconditionally on any codebase. Every other mode
|
|
194
|
+
* had a name; only this one was reachable by omission. Naming it restores the
|
|
195
|
+
* default the ADR states and keeps the capability (PR #72 review).
|
|
196
|
+
*/
|
|
197
|
+
report?: PresetDelivery;
|
|
198
|
+
/** Output format for the emitting modes. Ignored when `report` is omitted. */
|
|
199
|
+
format?: OutputFormat;
|
|
200
|
+
/** Rationale threaded into emitted output. Ignored when `report` is omitted. */
|
|
201
|
+
reason?: string;
|
|
202
|
+
/**
|
|
203
|
+
* Rules of this preset whose empty state is **declared** — plan 0089.
|
|
204
|
+
*
|
|
205
|
+
* A preset user holds no builder, so they cannot reach `.expectEmpty()`. Once
|
|
206
|
+
* plan 0099's floor fails a check that examined nothing, their only other
|
|
207
|
+
* remedy is `overrides: { id: 'off' }` — which is permanent, never expires,
|
|
208
|
+
* and deletes the rule rather than declaring a fact about it. That is
|
|
209
|
+
* [ADR-009](../../../../adr/009-agent-first-failure-surfaces.md) rule 1's
|
|
210
|
+
* trained-suppression dynamic, produced by our own gate; ADR-010 part 3 makes
|
|
211
|
+
* a carrier binding for exactly this reason.
|
|
212
|
+
*
|
|
213
|
+
* Typed on the preset's own id union, like `overrides`, so a rename is a
|
|
214
|
+
* compile error rather than a silent no-op. **An id here that binds to no
|
|
215
|
+
* constructed rule is a failing configuration finding**, never a warning — see
|
|
216
|
+
* {@link declaredEmptyFindings}.
|
|
217
|
+
*
|
|
218
|
+
* ## One id can name several constructed rules
|
|
219
|
+
*
|
|
220
|
+
* `boundaries` and `layered` construct some ids many times — `no-cross-boundary`
|
|
221
|
+
* once per boundary, `restricted-packages` once per package, `test-isolation`
|
|
222
|
+
* once per boundary pair. Declaring such an id applies the assertion to **every**
|
|
223
|
+
* instance, so it holds only while all of them examine nothing, and the day one
|
|
224
|
+
* fills you get a false-declaration finding for that instance. The rule's real
|
|
225
|
+
* violations are still reported alongside it — `RuleBuilder.evaluate` used to
|
|
226
|
+
* discard them, which is how a genuine `imports "lodash"` finding went missing
|
|
227
|
+
* behind a declaration.
|
|
228
|
+
*
|
|
229
|
+
* `readonly` so a caller's `as const` list is accepted.
|
|
230
|
+
*/
|
|
231
|
+
expectEmpty?: readonly TRuleId[];
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Validate override keys against known rule IDs.
|
|
235
|
+
* Warns for unrecognized keys (likely typos).
|
|
236
|
+
*/
|
|
237
|
+
export declare function validateOverrides(overrides: Partial<Record<string, RuleSeverity>> | undefined, knownIds: readonly string[]): void;
|
|
238
|
+
/**
|
|
239
|
+
* Match a user-supplied glob against the file path **or** its parent directory.
|
|
240
|
+
*
|
|
241
|
+
* Preset options name a location — `repositories`, `shared`, a layer glob — and
|
|
242
|
+
* both spellings are natural: `'**\/repositories/**'` and
|
|
243
|
+
* `'**\/repositories/repo.ts'`. `resideInFolder` reads only the parent
|
|
244
|
+
* directory, so a preset that used it directly silently enforced **nothing**
|
|
245
|
+
* for a file glob: measured, `dataLayerIsolation({ repositories:
|
|
246
|
+
* '**\/repositories/bad-repo.ts' })` generated its two rules and reported 0
|
|
247
|
+
* violations on a fixture named `bad-repo` (bug 0018).
|
|
248
|
+
*
|
|
249
|
+
* The fix is to make the natural spelling work rather than to fail on it — the
|
|
250
|
+
* principle bug 0014 settled on, and 0067-C reached independently. `or()` is
|
|
251
|
+
* the right combinator for the glob model too: the declaration is dead only
|
|
252
|
+
* when **both** readings are, which is what `doctor` will report on it.
|
|
253
|
+
*
|
|
254
|
+
* Internal to presets on purpose. A user writing their own rule chooses
|
|
255
|
+
* `resideInFile` or `resideInFolder` knowing which they mean; a preset option
|
|
256
|
+
* has to accept whichever its caller wrote.
|
|
257
|
+
*/
|
|
258
|
+
export declare function atPath<T extends Located>(glob: string, option?: string): Predicate<T>;
|
|
259
|
+
/**
|
|
260
|
+
* A preset's return value, honouring `report` when the caller named one.
|
|
261
|
+
*
|
|
262
|
+
* One definition, called by all five presets — the pre-copy code had this logic
|
|
263
|
+
* inline in each and they had already drifted over what `'print'` did.
|
|
264
|
+
*/
|
|
265
|
+
export declare function deliver(builders: RuleBuilderLike[], options: {
|
|
266
|
+
report?: PresetDelivery;
|
|
267
|
+
format?: OutputFormat;
|
|
268
|
+
reason?: string;
|
|
269
|
+
} | undefined): RuleBuilderLike[] | ArchViolation[];
|
|
270
|
+
export {};
|
|
3
271
|
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/presets/shared.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../src/presets/shared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAE/E;;;;;;;GAOG;AACH,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,UAAU,CAAA;AAIpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAA;AAGxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAGvD,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,MAAM,GAAG,KAAK,CAAA;AAEnD;;;;GAIG;AACH,UAAU,UAAU;IAClB,IAAI,CAAC,CAAC,EAAE,YAAY,GAAG,IAAI,CAAA;IAC3B,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAAA;IACzC,oGAAoG;IACpG,WAAW,IAAI,IAAI,CAAA;IACnB,UAAU,IAAI,aAAa,EAAE,CAAA;CAC9B;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CACzB,OAAO,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|
-
|
|
4
|
-
|
|
1
|
+
import { finishPreset, ArchRuleError } from '@nielspeter/eess';
|
|
2
|
+
import { callerAggregates } from '../core/execute-rule.js';
|
|
3
|
+
import { UNSUPPRESSABLE } from '@nielspeter/eess';
|
|
4
|
+
import { resideInFile, resideInFolder } from '../predicates/identity.js';
|
|
5
|
+
import { or } from '../core/combinators.js';
|
|
6
|
+
import { writeStderr } from '@nielspeter/eess';
|
|
7
|
+
/**
|
|
8
|
+
* Resolve a preset rule's effective severity and return it as a configured,
|
|
9
|
+
* UN-executed builder for the caller to spread into a rule array. `'off'` →
|
|
10
|
+
* empty array (spread-friendly). The returning-form replacement for the old
|
|
11
|
+
* self-executing `dispatchRule`.
|
|
12
|
+
*
|
|
13
|
+
* Takes the rule's full metadata, not just its id. It used to take an id and
|
|
14
|
+
* attach `{ id }` alone, which meant every rule in `strictBoundaries`,
|
|
15
|
+
* `layeredArchitecture` and `dataLayerIsolation` — 37 of them in
|
|
16
|
+
* `strictBoundaries` alone — failed with no `because` and no `suggestion`.
|
|
17
|
+
* ADR-009 rule 2 requires every failure to carry its sanctioned fix, and a
|
|
18
|
+
* preset is the one place a user cannot supply it themselves: they did not
|
|
19
|
+
* write the rule.
|
|
20
|
+
*/
|
|
21
|
+
export function collectRule(builder, meta, defaultSeverity, config, constructed) {
|
|
22
|
+
const effective = config?.overrides?.[meta.id] ?? defaultSeverity;
|
|
23
|
+
if (effective === 'off')
|
|
24
|
+
return [];
|
|
25
|
+
// Record what was actually BUILT. `RuleBuilderLike` exposes no metadata, and
|
|
26
|
+
// the known-id list cannot answer this: these presets construct rules
|
|
27
|
+
// conditionally, so "known" and "constructed" differ by exactly the ids a
|
|
28
|
+
// declaration must not silently bind to.
|
|
29
|
+
constructed?.push(meta.id);
|
|
30
|
+
const stamped = { ...meta, declarationSpelling: presetDeclarationSpelling(meta.id) };
|
|
31
|
+
return [declareEmptyIfListed(builder.rule(stamped).asSeverity(effective), meta.id, config)];
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Apply plan 0089's declaration carrier to one constructed rule.
|
|
35
|
+
*
|
|
36
|
+
* Exported because the presets build rules three different ways — through
|
|
37
|
+
* `collectRule`, through a local `push` helper, and through an inline loop — and
|
|
38
|
+
* a carrier that reached only one of them would be the shape ADR-009's Context
|
|
39
|
+
* table is about: a mechanism that covers the families someone remembered.
|
|
40
|
+
*/
|
|
41
|
+
export function declareEmptyIfListed(builder, id, config) {
|
|
42
|
+
return config?.expectEmpty?.includes(id) === true ? builder.expectEmpty() : builder;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The spelling a PRESET user must type to declare this rule empty — plan 0099.
|
|
46
|
+
*
|
|
47
|
+
* This is the single site that knows both facts the remedy needs: the rule's id,
|
|
48
|
+
* and that the caller is a preset which accepts `expectEmpty`. Core knows only
|
|
49
|
+
* the id, and used to guess from its `preset/` prefix — a naming convention, not
|
|
50
|
+
* a capability, and false for a hand-written rule or a third-party preset that
|
|
51
|
+
* never accepted the option.
|
|
52
|
+
*
|
|
53
|
+
* Applied to every preset rule, not only declared ones: the advice is printed on
|
|
54
|
+
* a rule that examined nothing, which is exactly the rule that has NOT been
|
|
55
|
+
* declared yet.
|
|
56
|
+
*/
|
|
57
|
+
export function presetDeclarationSpelling(id) {
|
|
58
|
+
return `expectEmpty: ['${id}'] in this preset's options`;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Guard a preset's *discovery* step (ADR-008 / plan 0067): if a glob discovered
|
|
62
|
+
* no subjects, return a failing rule carrying a config-level meta-finding rather
|
|
63
|
+
* than silently generating no rules — the false green a boundaries/layers preset
|
|
64
|
+
* must never produce. The finding bypasses diff/baseline so it survives the
|
|
65
|
+
* standard CI mode.
|
|
66
|
+
*/
|
|
67
|
+
export function assertDiscovered(discovered, finding) {
|
|
68
|
+
if (discovered.length > 0)
|
|
69
|
+
return [];
|
|
70
|
+
const violation = {
|
|
71
|
+
rule: finding.id,
|
|
72
|
+
ruleId: finding.id,
|
|
73
|
+
element: finding.id,
|
|
74
|
+
file: '',
|
|
75
|
+
line: 0,
|
|
76
|
+
message: `Discovery matched 0 subjects for glob '${finding.glob}'. ${finding.remedy}`,
|
|
77
|
+
because: 'a preset that discovers nothing generates no rules, so the whole preset silently certifies nothing',
|
|
78
|
+
suggestion: finding.remedy,
|
|
79
|
+
severity: 'error',
|
|
80
|
+
bypassFilters: true,
|
|
81
|
+
};
|
|
82
|
+
return [{ violations: () => [violation] }];
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Options every preset accepts.
|
|
86
|
+
*
|
|
87
|
+
* `TRuleId` is that preset's own rule ids as a literal union, so a misspelled
|
|
88
|
+
* override key is a **compile error** rather than a silent no-op
|
|
89
|
+
* ([bug 0157](../../../../work/bugs/0157-a-typo-in-a-preset-override-key-is-a-silent-false-green.md)).
|
|
90
|
+
* Measured before this: `'…/no-silent-cach': 'error'` left the rule at `warn`
|
|
91
|
+
* and the build green — the escalation the author asked for simply did not
|
|
92
|
+
* happen, and the only trace was a line on stderr.
|
|
93
|
+
*
|
|
94
|
+
* Catching it in the editor is strictly better than catching it at run time:
|
|
95
|
+
* zero CI cycles, and it fires while the author is still looking at the key.
|
|
96
|
+
* The runtime finding exists as well, for the paths a type cannot reach — a
|
|
97
|
+
* JavaScript consumer, a dynamically-built overrides object, a config read from
|
|
98
|
+
* disk.
|
|
99
|
+
*
|
|
100
|
+
* Defaults to `string`, so anything outside this package that extends
|
|
101
|
+
* `PresetBaseOptions` keeps compiling.
|
|
102
|
+
*/
|
|
103
|
+
/**
|
|
104
|
+
* An unknown override key, as a failing configuration finding —
|
|
105
|
+
* [bug 0157](../../../../work/bugs/0157-a-typo-in-a-preset-override-key-is-a-silent-false-green.md).
|
|
106
|
+
*
|
|
107
|
+
* `validateOverrides` writes a line to stderr and returns `void`. That is not a
|
|
108
|
+
* signal: measured, `'…/no-silent-cach': 'error'` left the rule at `warn`, the
|
|
109
|
+
* build passed, and the printed warning never reached the exit code. A rule the
|
|
110
|
+
* author asked to escalate silently did not.
|
|
111
|
+
*
|
|
112
|
+
* ## Why a sibling rather than changing `validateOverrides`
|
|
113
|
+
*
|
|
114
|
+
* That function is re-exported from `src/presets/index.ts` and documented with a
|
|
115
|
+
* `void` signature. Changing it to return rules is a **published API break** for
|
|
116
|
+
* a fault this bug concedes is low-frequency, and the user-visible outcome is
|
|
117
|
+
* identical either way — so it stays as it is and this sits beside it. ADR-008
|
|
118
|
+
* rule 6 says guard the guard, not break the API.
|
|
119
|
+
*
|
|
120
|
+
* `PresetBaseOptions` now types the key as a literal union, so most typos never
|
|
121
|
+
* reach here at all. This covers what a type cannot: JavaScript consumers, a
|
|
122
|
+
* dynamically-built overrides object, and `agent-guardrails`' template-literal
|
|
123
|
+
* ids, where the API segment is open by construction.
|
|
124
|
+
*/
|
|
125
|
+
export function overrideFindings(overrides, knownIds) {
|
|
126
|
+
if (!overrides)
|
|
127
|
+
return [];
|
|
128
|
+
const known = new Set(knownIds);
|
|
129
|
+
const unknown = Object.keys(overrides).filter((key) => !known.has(key));
|
|
130
|
+
if (unknown.length === 0)
|
|
131
|
+
return [];
|
|
132
|
+
const violations = unknown.map((key) => ({
|
|
133
|
+
rule: `preset override '${key}'`,
|
|
134
|
+
ruleId: `preset/override/${key}`,
|
|
135
|
+
element: key,
|
|
136
|
+
file: '',
|
|
137
|
+
line: 0,
|
|
138
|
+
message: `Override key '${key}' matches no rule in this preset, so it does nothing — ` +
|
|
139
|
+
`the severity you set was never applied.`,
|
|
140
|
+
because: 'an override that names no rule silently leaves that rule at its default, ' +
|
|
141
|
+
'which is a configured escalation that did not happen',
|
|
142
|
+
// Its own remedy, never the author's, and it names the alternatives because
|
|
143
|
+
// the commonest cause is a near-miss the reader cannot spot by staring.
|
|
144
|
+
suggestion: `Correct the key, or remove it. This preset's rules are: ${knownIds.join(', ')}. ` +
|
|
145
|
+
UNSUPPRESSABLE,
|
|
146
|
+
bypassFilters: true,
|
|
147
|
+
}));
|
|
148
|
+
return [{ violations: () => violations }];
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Findings for `expectEmpty` ids that bind to no constructed rule — plan 0089.
|
|
152
|
+
*
|
|
153
|
+
* The sibling of {@link overrideFindings}, and it fails for a sharper reason.
|
|
154
|
+
* An unknown override key leaves a rule at its default: an escalation that did
|
|
155
|
+
* not happen. An unknown `expectEmpty` id turns an **expiring assertion into
|
|
156
|
+
* nothing** — the author declared a state, the declaration bound to no rule, and
|
|
157
|
+
* once plan 0099's floor lands they are told to declare what they already
|
|
158
|
+
* declared, misspelled. That is bug 0017's shape, and ADR-009 rule 1 forbids
|
|
159
|
+
* answering it with a warning nobody reads.
|
|
160
|
+
*
|
|
161
|
+
* The unbound id is reported against the **constructed** set, not the declared
|
|
162
|
+
* one, so a rule switched `'off'` and still named here reports too — which is
|
|
163
|
+
* correct: `'off'` deleted the rule, so the declaration about it is dead.
|
|
164
|
+
*/
|
|
165
|
+
export function declaredEmptyFindings(expectEmpty, constructedIds) {
|
|
166
|
+
if (!expectEmpty || expectEmpty.length === 0)
|
|
167
|
+
return [];
|
|
168
|
+
const built = new Set(constructedIds);
|
|
169
|
+
const unbound = [...new Set(expectEmpty)].filter((id) => !built.has(id));
|
|
170
|
+
if (unbound.length === 0)
|
|
171
|
+
return [];
|
|
172
|
+
// De-duplicated, because `boundaries` and `layered` push the same id once per
|
|
173
|
+
// boundary / layer / pair. Un-deduplicated this degenerates exactly where the
|
|
174
|
+
// reader needs it most: measured at 5 boundaries + 1 shared glob +
|
|
175
|
+
// `isolateTests`, the list ran to 31 entries naming 4 unique ids, with
|
|
176
|
+
// `test-isolation` repeated 20 consecutive times and the answer buried inside
|
|
177
|
+
// it. `overrideFindings` never had this problem only because it is handed
|
|
178
|
+
// `RULE_IDS`, which is unique by construction.
|
|
179
|
+
const uniqueConstructed = [...new Set(constructedIds)];
|
|
180
|
+
// When the preset built NOTHING, "correct the id" is a false remedy — the id
|
|
181
|
+
// is usually right and the cause is upstream (a discovery glob that matched
|
|
182
|
+
// no folders, or every rule overridden `off`). An agent that obeys it deletes
|
|
183
|
+
// a correct declaration, and plan 0099's floor then demands the declaration
|
|
184
|
+
// back: bug 0017's loop, which ADR-009 rule 2 forbids us to reintroduce.
|
|
185
|
+
const suggestion = uniqueConstructed.length === 0
|
|
186
|
+
? `This preset constructed NO rules, so the cause is upstream of this id — check the ` +
|
|
187
|
+
`discovery glob that finds this preset's subjects, and whether every rule was set to 'off'. ` +
|
|
188
|
+
`Fix that first: the declaration is probably correct and will bind once rules exist. ` +
|
|
189
|
+
UNSUPPRESSABLE
|
|
190
|
+
: `Correct the id, or remove it. This preset constructed: ${uniqueConstructed.join(', ')}. ` +
|
|
191
|
+
`Note that a rule set to 'off' is not constructed, so a declaration naming it is dead. ` +
|
|
192
|
+
UNSUPPRESSABLE;
|
|
193
|
+
const violations = unbound.map((id) => ({
|
|
194
|
+
rule: `preset expectEmpty '${id}'`,
|
|
195
|
+
ruleId: `preset/expect-empty/${id}`,
|
|
196
|
+
element: id,
|
|
197
|
+
file: '',
|
|
198
|
+
line: 0,
|
|
199
|
+
message: `expectEmpty names '${id}', which this preset did not construct, so the ` +
|
|
200
|
+
`declaration applies to nothing.`,
|
|
201
|
+
because: 'a declaration that binds to no rule is not a weaker assertion, it is no assertion — ' +
|
|
202
|
+
'and it reads in the config as though the empty state has been accounted for',
|
|
203
|
+
suggestion,
|
|
204
|
+
bypassFilters: true,
|
|
205
|
+
}));
|
|
206
|
+
return [{ violations: () => violations }];
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Guard a preset's *construction* step (plan 0100): every rule this preset can
|
|
210
|
+
* build sits behind its own optional flag, and the required field is only the
|
|
211
|
+
* selector — so satisfying the type completely can still enable nothing.
|
|
212
|
+
* Measured: `agentGuardrails({ src })` and `dataLayerIsolation({ repositories })`
|
|
213
|
+
* both construct zero rules, on every corpus, and report nothing — the loop a
|
|
214
|
+
* user holds runs zero times and every gate is green.
|
|
215
|
+
*
|
|
216
|
+
* `attempted` is the id list the caller's OPTIONS asked for, computed BEFORE
|
|
217
|
+
* `overrides` is consulted — the same distinction plan 0099's floor draws
|
|
218
|
+
* between zero-subjects and declared-empty:
|
|
219
|
+
*
|
|
220
|
+
* - `attempted.length === 0` — no rule was ever enabled. A mistake: fire.
|
|
221
|
+
* - `attempted.length > 0` and nothing was constructed — every enabled rule
|
|
222
|
+
* was explicitly turned off (`overrides: { id: 'off' }`), which
|
|
223
|
+
* {@link UNSUPPRESSABLE}'s own text already treats as a permanent, legitimate
|
|
224
|
+
* decision, not a suppression. Silent.
|
|
225
|
+
*
|
|
226
|
+
* Fires only when `otherFindings` — every other config-finding builder this
|
|
227
|
+
* preset already produced (unknown override keys, unbound `expectEmpty`, a
|
|
228
|
+
* discovery guard) — is also empty, so a preset with a more specific cause
|
|
229
|
+
* reports that cause once, not this one stacked on top of it. Same ordering
|
|
230
|
+
* the zero-examined producer already states: report last, and only when
|
|
231
|
+
* nothing else already explained the emptiness.
|
|
232
|
+
*
|
|
233
|
+
* Returns the same `{ violations }`-only shape as {@link assertDiscovered} and
|
|
234
|
+
* {@link overrideFindings} — sufficient for both real consumers of a preset's
|
|
235
|
+
* `RuleBuilderLike[]` (`checkAll()`, `src/cli/load-rules.ts`), which call only
|
|
236
|
+
* `.violations()` on every array element, never `.check()`/`.warn()` on one
|
|
237
|
+
* item in isolation.
|
|
238
|
+
*/
|
|
239
|
+
export function assertEnabled(attempted, otherFindings, finding) {
|
|
240
|
+
if (attempted.length > 0 || otherFindings.length > 0)
|
|
241
|
+
return [];
|
|
242
|
+
const violation = {
|
|
243
|
+
rule: finding.id,
|
|
244
|
+
ruleId: finding.id,
|
|
245
|
+
element: finding.id,
|
|
246
|
+
file: '',
|
|
247
|
+
line: 0,
|
|
248
|
+
message: `${finding.presetName}(...) satisfied every required option and constructed 0 rules — every ` +
|
|
249
|
+
`rule it can build sits behind an optional flag, and none was set, so this call enforces ` +
|
|
250
|
+
`nothing while every gate reports it as healthy.`,
|
|
251
|
+
because: 'a preset that constructs no rules has nothing for the fail-closed floor to reach — a ' +
|
|
252
|
+
'function returning [] never calls collectViolations(), so no per-rule guard sees it',
|
|
253
|
+
suggestion: `Set at least one of: ${finding.optionsHint}. ` + UNSUPPRESSABLE,
|
|
254
|
+
bypassFilters: true,
|
|
255
|
+
};
|
|
256
|
+
return [{ violations: () => [violation] }];
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Validate override keys against known rule IDs.
|
|
260
|
+
* Warns for unrecognized keys (likely typos).
|
|
261
|
+
*/
|
|
262
|
+
export function validateOverrides(overrides, knownIds) {
|
|
263
|
+
if (!overrides)
|
|
264
|
+
return;
|
|
265
|
+
const knownSet = new Set(knownIds);
|
|
266
|
+
for (const key of Object.keys(overrides)) {
|
|
267
|
+
if (!knownSet.has(key)) {
|
|
268
|
+
writeStderr(`[eess] Override key '${key}' does not match any rule in this preset. ` +
|
|
269
|
+
`Available rules: ${knownIds.join(', ')}`);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Match a user-supplied glob against the file path **or** its parent directory.
|
|
275
|
+
*
|
|
276
|
+
* Preset options name a location — `repositories`, `shared`, a layer glob — and
|
|
277
|
+
* both spellings are natural: `'**\/repositories/**'` and
|
|
278
|
+
* `'**\/repositories/repo.ts'`. `resideInFolder` reads only the parent
|
|
279
|
+
* directory, so a preset that used it directly silently enforced **nothing**
|
|
280
|
+
* for a file glob: measured, `dataLayerIsolation({ repositories:
|
|
281
|
+
* '**\/repositories/bad-repo.ts' })` generated its two rules and reported 0
|
|
282
|
+
* violations on a fixture named `bad-repo` (bug 0018).
|
|
283
|
+
*
|
|
284
|
+
* The fix is to make the natural spelling work rather than to fail on it — the
|
|
285
|
+
* principle bug 0014 settled on, and 0067-C reached independently. `or()` is
|
|
286
|
+
* the right combinator for the glob model too: the declaration is dead only
|
|
287
|
+
* when **both** readings are, which is what `doctor` will report on it.
|
|
288
|
+
*
|
|
289
|
+
* Internal to presets on purpose. A user writing their own rule chooses
|
|
290
|
+
* `resideInFile` or `resideInFolder` knowing which they mean; a preset option
|
|
291
|
+
* has to accept whichever its caller wrote.
|
|
292
|
+
*/
|
|
293
|
+
export function atPath(glob, option) {
|
|
294
|
+
const combined = or(resideInFile(glob), resideInFolder(glob));
|
|
295
|
+
// The option name, when the caller knows it, so a configuration finding names
|
|
296
|
+
// `shared: "…"` rather than the two calls `or()` expanded into (plan 0074).
|
|
297
|
+
return option === undefined ? combined : { ...combined, originLabel: `${option}: "${glob}"` };
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* A preset's return value, honouring `report` when the caller named one.
|
|
301
|
+
*
|
|
302
|
+
* One definition, called by all five presets — the pre-copy code had this logic
|
|
303
|
+
* inline in each and they had already drifted over what `'print'` did.
|
|
304
|
+
*/
|
|
305
|
+
export function deliver(builders, options) {
|
|
306
|
+
// Only an EXPLICIT 'builders' returns without running. Omission falls through
|
|
307
|
+
// to `finishPreset`, whose own default is 'throw' — so a preset called with no
|
|
308
|
+
// options enforces, which is what ADR-008 states and what the docs teach.
|
|
309
|
+
if (options?.report === 'builders')
|
|
310
|
+
return builders;
|
|
311
|
+
const violations = builders.flatMap((b) => b.violations());
|
|
312
|
+
const mode = options?.report ?? 'throw';
|
|
313
|
+
// **Bug 0203 — enforce, but let an aggregating caller do the reporting.**
|
|
314
|
+
//
|
|
315
|
+
// `finishPreset` emits and then throws. Under `eess-ts check` that printed the
|
|
316
|
+
// findings before the CLI saw them, and the CLI then reported the same
|
|
317
|
+
// violations again off the throw: one violation, two blocks, two contradicting
|
|
318
|
+
// counters, with no flags involved. Measured on a rule file carried over from
|
|
319
|
+
// `@nielspeter/ts-archunit` — 13 blocks, 6 exact duplicates.
|
|
320
|
+
//
|
|
321
|
+
// The throw is kept, so behaviour is unchanged for everyone: the caller still
|
|
322
|
+
// learns the run failed, and the violations ride the error exactly as
|
|
323
|
+
// `executeCheck`'s do. Only the emission moves.
|
|
324
|
+
//
|
|
325
|
+
// ONLY for the default 'throw' mode. `'warn'` and `'return'` are explicit
|
|
326
|
+
// choices about emission that a caller made on purpose, and `'warn'`'s
|
|
327
|
+
// violations do NOT ride a throw — suppressing them here would lose them.
|
|
328
|
+
if (mode === 'throw' && callerAggregates()) {
|
|
329
|
+
if (violations.length > 0)
|
|
330
|
+
throw new ArchRuleError(violations, options?.reason);
|
|
331
|
+
return violations;
|
|
332
|
+
}
|
|
333
|
+
return finishPreset(violations, {
|
|
334
|
+
report: mode,
|
|
335
|
+
format: options?.format,
|
|
336
|
+
reason: options?.reason,
|
|
337
|
+
});
|
|
338
|
+
}
|
|
5
339
|
//# sourceMappingURL=shared.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../src/presets/shared.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../src/presets/shared.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAA;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAGjD,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AACxE,OAAO,EAAE,EAAE,EAAE,MAAM,wBAAwB,CAAA;AAG3C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAiB9C;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,WAAW,CACzB,OAAmB,EACnB,IAAmC,EACnC,eAA6B,EAC7B,MAAqC,EACrC,WAAsB;IAEtB,MAAM,SAAS,GAAG,MAAM,EAAE,SAAS,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,eAAe,CAAA;IACjE,IAAI,SAAS,KAAK,KAAK;QAAE,OAAO,EAAE,CAAA;IAClC,6EAA6E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OAAO,UAAU,CAAA;IACnB,CAAC;IAED,OAAO,YAAY,CAAC,UAAU,EAAE;QAC9B,MAAM,EAAE,IAAI;QACZ,MAAM,EAAE,OAAO,EAAE,MAAM;QACvB,MAAM,EAAE,OAAO,EAAE,MAAM;KACxB,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-quality.d.ts","sourceRoot":"","sources":["../../src/rules/code-quality.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAChD,OAAO,KAAK,EAAE,SAAS,EAAoB,MAAM,kBAAkB,CAAA;AAInE;;;;;;;;;;;;;GAaG;AACH,wBAAgB,2BAA2B,IAAI,SAAS,CAAC,gBAAgB,CAAC,CAuBzE;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,cAAc,IAAI,SAAS,CAAC,gBAAgB,CAAC,
|
|
1
|
+
{"version":3,"file":"code-quality.d.ts","sourceRoot":"","sources":["../../src/rules/code-quality.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAA;AAChD,OAAO,KAAK,EAAE,SAAS,EAAoB,MAAM,kBAAkB,CAAA;AAInE;;;;;;;;;;;;;GAaG;AACH,wBAAgB,2BAA2B,IAAI,SAAS,CAAC,gBAAgB,CAAC,CAuBzE;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,cAAc,IAAI,SAAS,CAAC,gBAAgB,CAAC,CAoC5D;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,cAAc,CAAC,OAAO,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,GAAG,SAAS,CAAC,gBAAgB,CAAC,CA8B5F"}
|