avoid-duplicate-mixins
preset: recommended
Warns when a class has a mixin that is already present in that class's hierarchy.
Duplicate mixins are either a sign of a bug (a different mixin should have been used instead) or are redundant and can be simply removed.
Example
❌ Bad:
mixin class MC {}
mixin M {}
class C1 = MC with M;
class C2 = Object with M, M; // LINT: Avoid duplicate mixins. Try removing the duplicate mixin or replacing it with a different mixin.
class C3 extends MC with MC {} // LINT: Avoid duplicate mixins. Extended class already has this mixin. Try removing the duplicate mixin or replacing it with a different mixin.
class C4 extends C1 with MC; // LINT: Avoid duplicate mixins. Extended class already has this mixin. Try removing the duplicate mixin or replacing it with a different mixin.
class C5 extends C6 with MC; // LINT: Avoid duplicate mixins. Extended class already has this mixin. Try removing the duplicate mixin or replacing it with a different mixin.
class C6 extends C1;
✅ Good:
mixin class MC {}
mixin M {}
class C1 = MC with MC;
class C2 = Object with M; // Correct, no duplicates
class C3 extends MC {}
class C4 extends C1;
class C5 extends C6;
class C6 extends C1;