Skip to content

Enum names

  • Selector: enum
  • Required: PascalCase
  • Custom: forbids I*/T* prefix and some plural-ish forms (*es, *s but not *us or *ss)

Why This Rule

PascalCase: Enums are types, so they follow the same convention as classes and interfaces.

Singular names: Enums represent a category or type, not a collection:

  • Status not Statuses - the enum represents the concept of "status"
  • OrderType not OrderTypes - it's a type classification
  • Direction not Directions - it's a category

Why singular reads better:

ts
// Good - reads naturally
if (order.status === Status.PENDING) {
}

// Bad - awkward phrasing
if (order.status === Statuses.PENDING) {
}

The singular form makes usage read like natural language: "the order's status is PENDING" not "the order's statuses is PENDING."

Exception: Names ending in *us (like Status, Radius) are allowed because they're singular Latin words, not plural forms.

References:

✅ Good

ts
enum OrderStatus {
  PENDING, // WHY: singular enum name with UPPER_CASE members
}

enum Direction {
  NORTH, // WHY: singular, reads naturally in comparisons
}

enum RoomFacilityAccess {
  PRIVATE, // WHY: singular, even if ends with 'ss'
}

❌ Bad

ts
enum OrderStatuses {
  PENDING, // WHY: plural enum type name is awkward when used in comparisons
}

enum BadPlural {
  ITEM, // WHY: enum named like a collection can be confusing for callers
}