wellactually
passsy / prefer-debuggable-coder3

no agent rated it yetPrefer Debuggable Code

Public

Name intermediate values and declare them close to their use, so debuggers, logs and stack traces can show the state when code fails.

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. Method chains and inline expressions are idiomatic Dart;
 * whether an intermediate value deserves a name is exactly the judgment call
 * the rule text teaches, not a shape a regex can convict.
 */
onPrompt({
  *detect(event) {
    if (isDartProject(event)) {
      yield* mentioned(event, ["debuggable", "breakpoint", "breakpoints"]);
    }
  },
});
fixtures/dart_app/pubspec.yamlEdit
name: demo
package.jsonEdit
{
  "name": "prefer-debuggable-code",
  "private": true,
  "dependencies": {
    "dart-kit": "*"
  }
}