Skip to content

A linter rule to recommend "mixing in" #60515

Open
@nate-thegrate

Description

@nate-thegrate

I think it'd be nice to have a linter rule that recommends using with rather than extends when inheriting from a mixin class.

For example:

class A extends ChangeNotifier {}

class B with ChangeNotifier {}

I believe that B offers improved readability, since it's much clearer that the class could inherit from ChangeNotifier while also extending from something else.

  • It gives a better intuition about different ways the class could be restructured in the future.
  • If the class is part of a public package, anyone reading it would gain a better intuition about how ChangeNotifier could be used in their own projects.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P4area-devexpFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.devexp-linterIssues with the analyzer's support for the linter packagelinter-lint-proposal

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions