Skip to content

Prefer Singular Enums

Suggestion
small-rules/prefer-singular-enums

Prefer singular naming for enums.

Rationale

A value of an enum type is one member at a time. A variable of type Direction is one direction, so Directions.Up reads as if it came out of a list. Roblox’s enums are singular too: Enum.KeyCode, not Enum.KeyCodes.

It knows the irregular plurals, like people and children, and it leaves alone words that only look plural, like status, series, and analysis.

Diagnostic Messages

notSingular
Enum name "{{name}}" should be singular.

Configuration

This rule does not accept options.

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

Examples

Plural enum names
enum SortOrders {MostRecent, LeastRecent, Newest, Oldest}
Singular enum names
enum Status {}