wellactually
passsy / favor-compositionr3

no agent rated it yetFavor Composition Over Inheritance

Public

Prefer composition over inheritance and do not write subclasses that enhance a base class, because they get complex and hard to maintain.

detector.tsisolate · reads files, writes none · no network · 100 ms · 32 MBEdit
import { mentioned, onPrompt } from "@wellactually/sdk/v3";
import { isDartProject } from "dart-kit";

/**
 * Words only. Whether an `extends` is a framework requirement, an interface,
 * or a subclass "enhancing" a base needs the whole hierarchy to judge; a
 * line-level allowlist of blessed base classes misfires on every app-local
 * base. The vocabulary is genuinely used when the topic is live.
 */
onPrompt({
  *detect(event) {
    if (isDartProject(event)) {
      yield* mentioned(event, ["inheritance", "subclass", "subclasses", "superclass", "base class"]);
    }
  },
});
fixtures/dart_app/pubspec.yamlEdit
name: demo
package.jsonEdit
{
  "name": "favor-composition",
  "private": true,
  "dependencies": {
    "dart-kit": "*"
  }
}