Linter: `Operation` suffix must be dropped unless model derives from `Operation<T>`
- Dominant language
- TypeScript
- Stars
- 27
- Forks
- 90
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 156
Description
Parent: #4442
## Convention
Remove `Operation` suffix unless the model derives from `Operation` or `Operation`. If hard to rename, append `Data` or `Info`.
> Source: [Azure SDK for .NET Mgmt Naming Conventions](https://github.com/Azure/azure-sdk-for-net/blob/main/doc/dev/Mgmt-Naming-Conventions.md)
## Observed today
A scan of `Azure/azure-rest-api-specs` (334 `client.tsp` files, 10,754 csharp-scoped `@@clientName` decorators) shows **31** decorators currently encoding this rule by hand. Examples:
- `AnalyzeBatchOperation` → `AnalyzeBatchOperationDetails` (ai/DocumentIntelligence/client.tsp)
- `Operation` → `CustomVoiceOperation` (cognitiveservices/data-plane/TextToSpeech/client.tsp)
- `ResourceOperation` → `ResourceOperationResult` (compute/resource-manager/Microsoft.Compute/Bulkactions/client.tsp)
- `ResourceOperation` → `BulkActionResourceOperation` (computebulkactions/ComputeBulkActions.Management/client.tsp)
- `ResourceOperation` → `ResourceOperationResult` (computeschedule/ComputeSchedule.Management/client.tsp)
- `UpdateOperation` → `DataBoxEdgeUpdateOperation` (databoxedge/resource-manager/Microsoft.DataBoxEdge/DataBoxEdge/client.tsp)
## Proposed linter
**Detection**
Flag any model whose name ends with `Operation` and is not a long-running-operation envelope or status type.
**Auto-fix**
Suggest drop or `Result`/`Details`/`Info` via `@@clientName`.
**Scope**
The rule should be csharp-scoped — it only flags violations of the .NET convention, not the underlying TypeSpec name. It should suggest inserting a `@@clientName(..., "csharp")` override when the underlying TypeSpec name is intentional, or renaming the TypeSpec model when the convention applies cross-language.
## Acceptance criteria
- [ ] New lint rule registered in the appropriate ruleset (`@azure-tools/typespec-client-generator-core` or `@azure-tools/typespec-azure-resource-manager`).
- [ ] Doc page under `website/src/content/docs/docs/libraries/.../rules/`.
- [ ] Unit tests covering positive / negative cases and the auto-fix.
- [ ] A `.chronus/changes/` entry.
Contributor guide
Research direction
Start by locating the lint rules and ruleset registration in @azure-tools/typespec-client-generator-core and @azure-tools/typespec-azure-resource-manager, then review existing rule tests and auto-fix patterns. Add the rule, its positive and negative tests, the documentation page under website/src/content/docs/docs/libraries/.../rules/, and a .chronus/changes/ entry; done means the acceptance criteria are covered.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- documentation, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100