Optionallayers: LayerConfig[]Layer topology in effect (empty disables the rule)
Optionaloptions: LayerBoundaryOptionsProject root for the layer paths globs and suppression comment markers
ReadonlycategoryRule category for grouping.
ReadonlydescriptionRule description explaining what it checks.
ReadonlyidUnique rule identifier (scoped to plugin). Format: "plugin-name:rule-name" (e.g., "angular-standalone:component-not-standalone")
ReadonlynameHuman-readable rule name.
ReadonlyseverityRule severity level.
ReadonlytagsTags for filtering and search.
Analyze a source file and return findings.
Analysis context with file, project, and API access
Promise resolving to array of analysis results
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(orlayersSource) 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
importandexport ... fromspecifier (path alias or relative) is resolved to an absolute file path via TypeScript module resolution (tsconfigpaths,baseUrl,index.tsprobing).Source and target files are classified by path with LayerPathMatcher: each layer's
pathsglobs (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/xbelongs 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 alevel, an import into the same or a lower level is always allowed (arch-validator semantics). Type-only imports are reported too and flagged withtypeOnlyin the metadata.Imports whose line or the line above carries a comment starting with one of
rules['architecture:layer-boundary-violation'].suppressionCommentsare skipped (no marker is built in).Result metadata: LayerBoundaryViolationMetadata.
Example