The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 03:37 UTC
| 1 | import { describe } from "@effect/vitest"; |
| 2 | |
| 3 | import { createOxlintRuleHarness } from "../test/utils.ts"; |
| 4 | |
| 5 | const rule = createOxlintRuleHarness("t3code/max-settings-description-length", { |
| 6 | filename: "apps/web/src/components/settings/Example.tsx", |
| 7 | }); |
| 8 | |
| 9 | const long = "Agents ".repeat(30); |
| 10 | |
| 11 | describe("t3code/max-settings-description-length", () => { |
| 12 | rule.valid( |
| 13 | "allows a short description", |
| 14 | `const row = <SettingsRow title="Theme" description="Choose how T3 Code looks." />;`, |
| 15 | ); |
| 16 | |
| 17 | rule.valid( |
| 18 | "does not count dynamic text", |
| 19 | `const row = <SettingsRow title="Task" description={\`${long.slice(0, 150)}\${prompt}\`} />;`, |
| 20 | ); |
| 21 | |
| 22 | rule.invalid( |
| 23 | "reports a long string description", |
| 24 | `const row = <SettingsRow title="Theme" description="${long}" />;`, |
| 25 | ); |
| 26 | |
| 27 | rule.invalid( |
| 28 | "counts link text inside a JSX description", |
| 29 | ` |
| 30 | const row = ( |
| 31 | <SettingsRow |
| 32 | title="Guests" |
| 33 | description={ |
| 34 | <> |
| 35 | ${long.slice(0, 150)}{" "} |
| 36 | <Link to="/docs">${long.slice(0, 60)}</Link> |
| 37 | </> |
| 38 | } |
| 39 | /> |
| 40 | ); |
| 41 | `, |
| 42 | ); |
| 43 | }); |