Skip to main content

avoid-duplicate-mixins

added in: 1.8.0
🛠
Pro+
preset: recommended

Warns when a class has a mixin that is already present in that class's hierarchy.

Example

❌ Bad:

mixin class MC {}
mixin M {}

class C1 = MC with MC; // LINT
class C2 = Object with M, M; // LINT
class C3 extends MC with MC {} // LINT
class C4 extends C1 with MC; // LINT
class C5 extends C6 with MC; // LINT
class C6 extends C1;

✅ Good:

mixin class MC {}
mixin M {}

class C1 = MC;
class C2 = Object with M;
class C3 extends MC {}
class C4 extends C1;
class C5 extends C6;
class C6 extends C1;