In short
In TS many things use decorators (@Component, @Injectable, @Controller). This lets a rule target decorated things — 'everything with @Controller lives in the web folder', or 'no property may use a field-injection decorator.'
Problem
A large class of architecture rules is naturally expressed against decorators — 'classes decorated with @controller must live in the web layer', 'no property may use field injection (@Inject)', '@entity types belong to the domain'. ArchUnitTS matches on file paths and names but cannot assert on decorators today.
Proposal
Add decorator predicates onto the existing projectFiles(...) chain (class/method/property/parameter, incl. meta-decorators), e.g. projectFiles("src").withDecorator("Controller").should().beInFolder("**/web/**") and projectFiles("src").inFolder("**/domain/**").shouldNot().useDecorator("Inject").
Acceptance criteria
In short
In TS many things use decorators (
@Component,@Injectable,@Controller). This lets a rule target decorated things — 'everything with@Controllerlives in the web folder', or 'no property may use a field-injection decorator.'Problem
A large class of architecture rules is naturally expressed against decorators — 'classes decorated with @controller must live in the web layer', 'no property may use field injection (@Inject)', '@entity types belong to the domain'. ArchUnitTS matches on file paths and names but cannot assert on decorators today.
Proposal
Add decorator predicates onto the existing
projectFiles(...)chain (class/method/property/parameter, incl. meta-decorators), e.g.projectFiles("src").withDecorator("Controller").should().beInFolder("**/web/**")andprojectFiles("src").inFolder("**/domain/**").shouldNot().useDecorator("Inject").Acceptance criteria
.withDecorator("Controller")selects classes carrying that decorator, including via a meta-decorator..shouldNot().useDecorator("Inject")fails on a violating element with a clickable location.