Skip to content

Prefer Pascal Case Enums

Suggestion
small-rules/prefer-pascal-case-enums

Enforce PascalCase names for enums and enum members.

Rationale

Enums are types, and types are Pascal case. The members follow suit, so you write Direction.Up instead of Direction.UP or direction.up. That’s also how Roblox’s own enums look, like Enum.KeyCode.LeftShift and Enum.Material.SmoothPlastic, so your enums read like the ones you use next to them.

The rule skips member names that start with a digit, or that use characters past A to Z, because there’s no Pascal case spelling to suggest.

Diagnostic Messages

notPascalCase
Enum '{{ identifier }}' uses non-standard casing. TypeScript convention requires PascalCase for enum names and members to distinguish them from variables (camelCase) and constants (UPPER_CASE). Rename to PascalCase: capitalize first letter of each word, no underscores.

Configuration

This rule does not accept options.

{
"jsPlugins": [
"@pobammer-ts/small-rules"
],
"rules": {
"small-rules/prefer-pascal-case-enums": "error"
}
}

Examples

All-caps enum name
enum SORTORDER {MostRecent, LeastRecent, Newest, Oldest}
PascalCase enum names
enum SortOrder {MostRecent, LeastRecent, Newest, Oldest}