prefer-literal-enum-member
Configuration
rslint.config.ts
Rule Details
Require that all enum members are literal values to prevent unintended enum member values.
TypeScript allows the value of an enum member to be many different kinds of valid JavaScript expressions. However, because enums create their own scope whereby each enum member becomes a variable in that scope, developers are often surprised at the result of using non-literal values. Explicit enum values should only be literals (string or number).
Examples of incorrect code for this rule:
Examples of correct code for this rule:
Options
allowBitwiseExpressions
When set to true, allows using bitwise expressions in enum initializers, which is common in flag-style enums.