Skip to main content

avoid-unnecessary-enum-prefix

added in: 1.22.0
🛠
Pro+

Suggests removing unnecessary enum prefixes.

Example

❌ Bad:

enum MyEnum {
alpha(),
beta(),
gama();

const MyEnum();

int someFunction() => switch (this) {
MyEnum.alpha => 0, // LINT
beta => 1,
MyEnum.gama => 2, // LINT
};
}

✅ Good:

enum MyEnum {
alpha(),
beta(),
gama();

const MyEnum();

int someFunction() => switch (this) {
alpha => 0,
beta => 1,
gama => 2,
};
}