Angular Modernizer
    Preparing search index...

    Service Bag Analysis Rule (architecture:service-bag) - detects services and static helper classes that mix responsibilities.

    Checks classes with at least 11 public methods that are services (detection confidence at least 0.7) or static-only helpers. The classification lives in the public API (api.analysis.responsibilityClassifier): each public method gets a concern from typed signals (HTTP calls, reactive fields, DOM, file, dialog, storage, validator types), data access with its own mappers is one concern, and its backend areas come from the resolved URL of each call.

    Reported:

    • kind: 'service' / 'static-utility': two or more technical concerns besides data access, one large technical concern next to data access, or two or more substantial backend areas.
    • kind: 'domain-candidate' (severity info): several large name domains in one backend area; the decision belongs to the owner.

    Methods that only forward to an injected service (a split facade) and uncertain methods do not count; uncertain methods are listed with their evidence in the metadata. The split itself is done by the service bag transform in @angular-modernizer/plugin-angular.

    const results = await new ServiceBagAnalysisRule().analyze(context);
    results[0]?.metadata?.['concerns']; // concern groups with methods

    Implements

    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    category: "architecture" = 'architecture'

    Rule category for grouping.

    description: "Detects services and static helpers mixing concerns or backend areas" = 'Detects services and static helpers mixing concerns or backend areas'

    Rule description explaining what it checks.

    id: "architecture:service-bag" = 'architecture:service-bag'

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

    name: "Service Bag Detection" = 'Service Bag Detection'

    Human-readable rule name.

    severity: "error" = 'error'

    Rule severity level.

    tags: string[] = ...

    Tags for filtering and search.

    Methods