avoid-unnecessary-enum-prefix
Suggests removing unnecessary enum prefixes.
Example
❌ Bad:
enum MyEnum {
alpha(),
beta(),
gama();
const MyEnum();
int someFunction() => switch (this) {
MyEnum.alpha => 0, // LINT: This enum prefix matches the declaration name and is unnecessary. Try removing it.
beta => 1,
MyEnum.gama => 2, // LINT: This enum prefix matches the declaration name and is unnecessary. Try removing it.
};
}
✅ Good:
enum MyEnum {
alpha(),
beta(),
gama();
const MyEnum();
int someFunction() => switch (this) {
alpha => 0, // Correct, no prefix
beta => 1,
gama => 2,
};
}