chore(lint): add BFF architecture enforcement rules
Add ESLint rules to enforce ADR-007 service classification patterns: - Controllers must import integration facades, not services (warn level) - Aggregators must be read-only (no mutation methods) Rules reference docs/decisions/007-service-classification.md and will help catch architectural violations during code review. Note: Set to warn for incremental adoption as some existing violations need to be fixed (billing controller, address controller). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
b885e9c34b
commit
975a11474a
@ -380,6 +380,72 @@ export default [
|
||||
},
|
||||
},
|
||||
|
||||
// =============================================================================
|
||||
// BFF Architecture: Controllers must use facades, not integration internals
|
||||
// See: docs/decisions/007-service-classification.md
|
||||
// Note: Set to "warn" for incremental adoption. Upgrade to "error" once violations are fixed.
|
||||
// =============================================================================
|
||||
{
|
||||
files: ["apps/bff/src/modules/**/*.controller.ts"],
|
||||
rules: {
|
||||
"no-restricted-imports": [
|
||||
"warn",
|
||||
{
|
||||
paths: [
|
||||
{
|
||||
name: "@customer-portal/domain",
|
||||
message:
|
||||
"Do not import @customer-portal/domain (root). Use @customer-portal/domain/<module> instead.",
|
||||
},
|
||||
],
|
||||
patterns: [
|
||||
{
|
||||
group: ["@customer-portal/domain/**/src/**"],
|
||||
message: "Import from @customer-portal/domain/<module> instead of internals.",
|
||||
},
|
||||
{
|
||||
group: ["@customer-portal/domain/*/*", "!@customer-portal/domain/*/providers"],
|
||||
message:
|
||||
"No deep @customer-portal/domain imports. Use @customer-portal/domain/<module> (or BFF-only: .../<module>/providers).",
|
||||
},
|
||||
{
|
||||
group: ["@customer-portal/domain/*/providers/*"],
|
||||
message:
|
||||
"Do not deep-import provider internals. Import from @customer-portal/domain/<module>/providers only.",
|
||||
},
|
||||
{
|
||||
group: ["@bff/integrations/*/services/*", "@bff/integrations/*/connection/*"],
|
||||
message:
|
||||
"Controllers should not import integration services or connection internals directly. Import from @bff/integrations/*/facades/* instead (ADR-007).",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
|
||||
// =============================================================================
|
||||
// BFF Architecture: Aggregators must be read-only (no mutation methods)
|
||||
// See: docs/decisions/007-service-classification.md
|
||||
// =============================================================================
|
||||
{
|
||||
files: [
|
||||
"apps/bff/src/aggregators/**/*.ts",
|
||||
"apps/bff/src/modules/me-status/me-status.service.ts",
|
||||
"apps/bff/src/modules/users/infra/user-profile.service.ts",
|
||||
],
|
||||
rules: {
|
||||
"no-restricted-syntax": [
|
||||
"warn",
|
||||
{
|
||||
selector: "MethodDefinition[key.name=/^(create|update|delete|save|remove|add|set)[A-Z]/]",
|
||||
message:
|
||||
"Aggregators must be read-only. Mutation methods should be moved to orchestrators or services (ADR-007).",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
|
||||
// =============================================================================
|
||||
// Node globals for tooling/config files
|
||||
// =============================================================================
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user