ReadonlycategoryRule category for grouping.
ReadonlydescriptionRule description explaining what it does.
ReadonlyidUnique rule identifier (scoped to plugin).
ReadonlynameHuman-readable rule name.
ReadonlytagsTags for filtering and search.
Transform a source file.
Transform context with file, project, and API access
Promise resolving to transform result
Transform rule that resolves constructor-injection DIP violations by introducing interfaces and InjectionTokens.
Problem:
@Injectableclasses injecting other@Injectableclasses by concrete type violate the Dependency Inversion Principle. The consuming class is coupled to the implementation, making it hard to substitute or test in isolation.Solution: For each violating constructor parameter:
I${ClassName}) from the injected serviceInjectionToken<IClassName>in the injected file@Inject(TOKEN)to the parameterBefore:
After (consuming file):
After (injected service file):
Configuration:
Idempotency: Parameters that already have an
@Injectdecorator are skipped. Interfaces that already exist in the injected file are not re-created.See
ServiceDipViolationTransformOrchestrator for detailed transformation logic