This rule is included in plugin:alignment/recommended
preset.
🔧 The --fix option on the command line can automatically fix the problems reported by this rule.
Aligns the members of a TypeScript enum.
Examples of incorrect code:
/*eslint align-enums: "warn"*/
enum Direction {
UP = "up",
DOWN = "down",
LEFT = "left",
RIGHT = "right",
}
Examples of correct code:
/*eslint align-enums: "warn"*/
enum Direction {
UP /* */ = "up",
DOWN /* */ = "down",
LEFT /* */ = "left",
RIGHT /**/ = "right",
}
- Type:
string
- Default:
" "
The spacing character inserted between the comments. The Length of the character must be one.
/*eslint align-enums: ["warn", "always", { "spacingCharacter": "-" }]*/
// Valid
enum Direction {
UP /*---*/ = "up",
DOWN /*-*/ = "down",
LEFT /*-*/ = "left",
RIGHT /**/ = "right",
}