Angular Modernizer
    Preparing search index...

    Layer Boundary Violation Rule (architecture:layer-boundary-violation) - detects imports that violate the project's layer topology.

    Fully config-driven: the topology comes from layers (or layersSource) in .angular-modernizer.json, so the rule knows which files belong to which layer and which import directions are allowed. Unlike the convention-based ImportDirectionViolationRule it reports nothing when no layers are configured.

    Matching logic:

    • Every import and export ... from specifier (path alias or relative) is resolved to an absolute file path via TypeScript module resolution (tsconfig paths, baseUrl, index.ts probing).

    • Source and target files are classified by path with LayerPathMatcher: each layer's paths globs (anchored at the project root, segment-correct), else the directory its alias maps to in tsconfig. The most specific matching pattern wins.

    • Aliased imports that cannot be resolved fall back to alias-prefix matching (@core/x belongs to the layer with alias @core).

    • An import into another layer is a violation unless that layer's name or alias is listed in the source layer's canImportFrom. When both layers have a level, an import into the same or a lower level is always allowed (arch-validator semantics). Type-only imports are reported too and flagged with typeOnly in the metadata.

    • Imports whose line or the line above carries a comment starting with one of rules['architecture:layer-boundary-violation'].suppressionComments are skipped (no marker is built in).

    Result metadata: LayerBoundaryViolationMetadata.

    // .angular-modernizer.json
    {
    "layers": [
    { "name": "core", "alias": "@core", "paths": ["src/app/core/**"], "canImportFrom": [] },
    { "name": "shared", "alias": "@shared", "paths": ["src/app/shared/**"], "canImportFrom": ["@core"] },
    { "name": "features", "alias": "@features", "paths": ["src/app/features/**"],"canImportFrom": ["@core","@shared"] }
    ]
    }
    // Violation: @core imports from @features
    // src/app/core/services/auth.service.ts
    import { AdminModule } from '@features/admin/admin.module'; // <- violation

    Implements

    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    category: "architecture" = 'architecture'

    Rule category for grouping.

    description: "Detects imports that violate the project layer topology defined in .angular-modernizer.json (layers section). Config-driven — complements the generic solid:import-direction-violation rule." = 'Detects imports that violate the project layer topology defined in .angular-modernizer.json (layers section). Config-driven — complements the generic solid:import-direction-violation rule.'

    Rule description explaining what it checks.

    id: "architecture:layer-boundary-violation" = 'architecture:layer-boundary-violation'

    Unique rule identifier (scoped to plugin). Format: "plugin-name:rule-name" (e.g., "angular-standalone:component-not-standalone")

    name: "Layer Boundary Violation" = 'Layer Boundary Violation'

    Human-readable rule name.

    severity: "error" = ...

    Rule severity level.

    tags: string[] = ...

    Tags for filtering and search.

    Methods