passsy / avoid-rxdartr3
Avoid rxdart
PublicAvoid package:rxdart unless it is really required: plain Streams solve most cases, and its regular breaking changes cause dependency conflicts.
tests, run by the registry13 passed · slowest 4.7 ms
✓fires3.0 ms
fires on an rxdart dependency the agent writes
write pubspec.yamlfired: line 5
namedemo
dependencies
flutter
sdkflutter
rxdart^0.27.0✓quiet2.5 ms
stays quiet on a commented out dependency
write pubspec.yamlstayed quiet
namedemo
dependencies
# rxdart: ^0.27.0
✓fires2.3 ms
fires on an rxdart import the agent writes
write lib/store.dartfired: line 1
import 'package:rxdart/rxdart.dart';
final user = BehaviorSubject<User?>();✓quiet2.4 ms
stays quiet on a legacy import when the agent edits another line
write lib/store.dart · wrote line 3stayed quiet
import 'package:rxdart/rxdart.dart';
final user = BehaviorSubject<User?>();✓skips0.0 ms
stays quiet when the agent only reads the file
read lib/store.dartno handler of the detector wants this event
import 'package:rxdart/rxdart.dart';
final user = BehaviorSubject<User?>();✓fires3.4 ms
points at the principle when the user writes rxdart
prompt · in fixtures/dart_appfired: "rxdart"
does this project depend on rxdart✓fires3.1 ms
points at the principle when the user writes rx_dart
prompt · in fixtures/dart_appfired: "rx_dart"
does this project depend on rx_dart✓fires3.1 ms
points at the principle when the user writes rx-dart
prompt · in fixtures/dart_appfired: "rx-dart"
does this project depend on rx-dart✓fires3.5 ms
points at the principle when the user writes RxDart
prompt · in fixtures/dart_appfired: "RxDart"
does this project depend on RxDart✓fires3.5 ms
points at the principle when the user writes RXDART
prompt · in fixtures/dart_appfired: "RXDART"
does this project depend on RXDART✓fires4.0 ms
points at the principle when the user names BehaviorSubject
prompt · in fixtures/dart_appfired: "BehaviorSubject"
Keep the user in a BehaviorSubject✓quiet4.7 ms
stays quiet on a longer word that starts with rxdart
prompt · in fixtures/dart_appstayed quiet
the rxdartboard package✓quiet2.6 ms
stays quiet outside a Dart project
promptstayed quiet
we should use rxdart for this streamdetector.test.tseach detect() call runs the real detectorEdit
import { expect, test } from "vitest";
import { detect, edit, prompt, read, source, write } from "@wellactually/sdk/v3/test";
test("fires on an rxdart dependency the agent writes", () => {
const pubspec = source`
name: demo
dependencies:
flutter:
sdk: flutter
rxdart: ^0.27.0
`;
expect(detect(write("pubspec.yaml", pubspec))).toEqual([{ line: 5 }]);
});
test("stays quiet on a commented out dependency", () => {
expect(detect(write("pubspec.yaml", "name: demo\ndependencies:\n # rxdart: ^0.27.0\n"))).toEqual([]);
});
const store = source`
import 'package:rxdart/rxdart.dart';
final user = BehaviorSubject<User?>();
`;
test("fires on an rxdart import the agent writes", () => {
expect(detect(write("lib/store.dart", store))).toEqual([{ line: 1 }]);
});
test("stays quiet on a legacy import when the agent edits another line", () => {
expect(detect(edit("lib/store.dart", store, { written: "final user = BehaviorSubject<User?>();" }))).toEqual([]);
});
test("stays quiet when the agent only reads the file", () => {
expect(detect(read("lib/store.dart", store))).toEqual([]);
});
const dartApp = { project: "fixtures/dart_app" };
test.each(["rxdart", "rx_dart", "rx-dart", "RxDart", "RXDART"])("points at the principle when the user writes %s", (spelling) => {
expect(detect(prompt(`does this project depend on ${spelling}`), dartApp)).toEqual([{ match: spelling, depth: "pointer" }]);
});
test("points at the principle when the user names BehaviorSubject", () => {
expect(detect(prompt("Keep the user in a BehaviorSubject"), dartApp)).toEqual([{ match: "BehaviorSubject", depth: "pointer" }]);
});
test("stays quiet on a longer word that starts with rxdart", () => {
expect(detect(prompt("the rxdartboard package"), dartApp)).toEqual([]);
});
test("stays quiet outside a Dart project", () => {
expect(detect(prompt("we should use rxdart for this stream"))).toEqual([]);
});