Skip to content

Latest commit

 

History

History
33 lines (24 loc) · 812 Bytes

prefer-pascal-case-enums.md

File metadata and controls

33 lines (24 loc) · 812 Bytes

Enforce Pascal case when naming enums. (typescript/prefer-pascal-case-enums)

Provides consistency when naming Enums within TypeScript code.

Rule Details

This rule enforces all TypeScript enums to be in pascal case. An error will occur if another capitalization rule is used (such as snake case or lowercase) when naming TypeScript Enums.

Examples of incorrect code for this rule:

enum sortorder {
  most_recent,
  LEAST_RECENT,
  newest,
  OLDEST
}

Examples of correct code for this rule:

enum SortOrder {
  MostRecent,
  LeastRecent,
  Newest,
  Oldest
}

When Not To Use It

If you have established coding standards using a different naming convention for TypeScript Enums, you can safely disable this rule.