Add a linter enforcing numeric durations
- Dominant language
- TypeScript
- Stars
- 27
- Forks
- 90
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 164
Description
### Clear and concise description of the problem
`duration` defaults to a string on the wire, but Azure prohibits ISO8601 durations outside of recurrences. We should have a linting rule that validates anyone using `duration` is also specifying `@encode(DurationKnownEncoding.seconds)` for any of the numeric duration types.
### Checklist
- [x] Follow our [Code of Conduct](https://github.com/azure/typespec-azure/blob/main/CODE_OF_CONDUCT.md)
- [x] Check that this issue is about the Azure libraries for typespec. For feature request in the typespec language or core libraries file it in the [TypeSpec repo](https://github.com/Microsoft/TypeSpec/issues/new/choose)
- [x] Read the [docs](https://azure.github.io/typespec-azure/).
- [x] Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
Contributor guide
Research direction
No implementation files or tests are named in the issue. Start by locating the existing lint-rule entry points and their tests, then trace how duration uses and encoding decorators are represented. Done means numeric duration types using duration are linted unless they specify @encode(DurationKnownEncoding.seconds), with coverage for the relevant cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100