Add linter rule to provide meaningful union/enum key name
- Dominant language
- TypeScript
- Stars
- 27
- Forks
- 90
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 156
Description
### Clear and concise description of the problem
Sometimes, there will be number prefixed enum or union key, which makes sense in typespec but not in the generated code.
```
enum Foo {1, 2, 3} // should warn out.
enum Foo {
1one: 1, // should warn out.
two: 2,
three: 3
}
```
we should add a linter rule for this.
### 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
Start by reading the repository's existing linter rules and their tests to find the rule entry points and expected diagnostics. Add coverage for numeric or number-prefixed enum and union keys, and consider the work done when those cases produce warnings while meaningful keys remain unaffected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100