The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import { assert, describe } from "@effect/vitest"; |
| 2 | |
| 3 | import { createOxlintRuleHarness } from "../test/utils.ts"; |
| 4 | |
| 5 | const rule = createOxlintRuleHarness("t3code/require-registered-list-scroll", { |
| 6 | filename: "fixture.tsx", |
| 7 | }); |
| 8 | |
| 9 | describe("t3code/require-registered-list-scroll", () => { |
| 10 | rule.valid( |
| 11 | "allows a list that renders through a registered scroll view", |
| 12 | `const el = <LegendList data={rows} renderScrollComponent={NativeScrollView} />;`, |
| 13 | ); |
| 14 | |
| 15 | rule.valid( |
| 16 | "allows a keyboard-aware list with its scroll view component", |
| 17 | `const el = <KeyboardAwareLegendList data={rows} ScrollViewComponent={FeedScrollView} />;`, |
| 18 | ); |
| 19 | |
| 20 | rule.invalid( |
| 21 | "reports a list given the other list's scroll prop", |
| 22 | `const el = <LegendList data={rows} ScrollViewComponent={NativeScrollView} />;`, |
| 23 | ); |
| 24 | |
| 25 | rule.invalid( |
| 26 | "reports a list with the default scroll view", |
| 27 | `const el = <AnimatedLegendList data={rows} renderItem={renderRow} />;`, |
| 28 | (output) => { |
| 29 | assert.match(output, /header-registered scroll view/); |
| 30 | }, |
| 31 | ); |
| 32 | }); |