Skip to content

Latest commit

 

History

History
27 lines (18 loc) · 930 Bytes

ARC0002.md

File metadata and controls

27 lines (18 loc) · 930 Bytes
title ARC0002: Command-like class is not decorated
description Fix ARC0002 in Arc TypeScript by decorating command-shaped classes with @command, and check which helpers and external handlers the rule excludes.

What

A concrete class has a public instance field and an instance handle() but no @command(). Rule: arc-core/arc0002. Abstract classes, static handlers, and classes ending in Helper or Extensions are excluded. With type information, a handler taking an Arc command is left to ARC0003.

Why

Arc does not discover an undecorated command; handle() alone is not a route. A service with no public instance fields is not assumed to be a command.

Bad

export class Register { title!: string; handle() {} }

Good

@command()
export class Register { @field(String) title!: string; handle() {} }

If the class is a service rather than a command, no decorator is needed.