Repository navigation
fix(web): settings descriptions use the full row and stay two lines #31826
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
maria-rcks
merged 1 commit into
pingdotgg:main
from
flamboh:t3/fix-lab-description-wrapping
Nov 6, 2026
+126
−15
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
oxlint-plugin-t3code/rules/max-settings-description-length.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| import { describe } from "@effect/vitest"; | ||
|
|
||
| import { createOxlintRuleHarness } from "../test/utils.ts"; | ||
|
|
||
| const rule = createOxlintRuleHarness("t3code/max-settings-description-length", { | ||
| filename: "apps/web/src/components/settings/Example.tsx", | ||
| }); | ||
|
|
||
| const long = "Agents ".repeat(30); | ||
|
|
||
| describe("t3code/max-settings-description-length", () => { | ||
| rule.valid( | ||
| "allows a short description", | ||
| `const row = <SettingsRow title="Theme" description="Choose how T3 Code looks." />;`, | ||
| ); | ||
|
|
||
| rule.valid( | ||
| "does not count dynamic text", | ||
| `const row = <SettingsRow title="Task" description={\`${long.slice(0, 150)}\${prompt}\`} />;`, | ||
| ); | ||
|
|
||
| rule.invalid( | ||
| "reports a long string description", | ||
| `const row = <SettingsRow title="Theme" description="${long}" />;`, | ||
| ); | ||
|
|
||
| rule.invalid( | ||
| "counts link text inside a JSX description", | ||
| ` | ||
| const row = ( | ||
| <SettingsRow | ||
| title="Guests" | ||
| description={ | ||
| <> | ||
| ${long.slice(0, 150)}{" "} | ||
| <Link to="/docs">${long.slice(0, 60)}</Link> | ||
| </> | ||
| } | ||
| /> | ||
| ); | ||
| `, | ||
| ); | ||
| }); |
63 changes: 63 additions & 0 deletions
63
oxlint-plugin-t3code/rules/max-settings-description-length.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| import { defineRule, type ESTree } from "@oxlint/plugins"; | ||
|
|
||
| const MAX_LENGTH = 200; | ||
|
|
||
| const MESSAGE = (length: number) => | ||
| `SettingsRow description is ${length} characters; keep it at ${MAX_LENGTH} or fewer so it stays two lines next to a control. Shorten the copy: keep each fact a user needs and drop restatements.`; | ||
|
|
||
| type Node = ESTree.Node | ESTree.JSXElement["children"][number] | null | undefined; | ||
|
|
||
| const staticText = (node: Node): string => { | ||
| if (!node) return ""; | ||
| switch (node.type) { | ||
| case "Literal": | ||
| return typeof node.value === "string" ? node.value : ""; | ||
| case "TemplateLiteral": | ||
| return node.quasis.map((quasi) => quasi.value.cooked ?? "").join(""); | ||
| case "JSXText": | ||
| return node.value | ||
| .split(/\r\n|\n|\r/u) | ||
| .map((line, index, lines) => { | ||
| const start = index > 0 ? line.trimStart() : line; | ||
| return index < lines.length - 1 ? start.trimEnd() : start; | ||
| }) | ||
| .filter(Boolean) | ||
| .join(" "); | ||
| case "JSXExpressionContainer": | ||
| return node.expression.type === "JSXEmptyExpression" ? "" : staticText(node.expression); | ||
| case "JSXElement": | ||
| case "JSXFragment": | ||
| return node.children.map(staticText).join(""); | ||
| case "ConditionalExpression": { | ||
| const consequent = staticText(node.consequent); | ||
| const alternate = staticText(node.alternate); | ||
| return consequent.length >= alternate.length ? consequent : alternate; | ||
| } | ||
| default: | ||
| return ""; | ||
| } | ||
| }; | ||
|
|
||
| export default defineRule({ | ||
| meta: { | ||
| type: "suggestion", | ||
| docs: { | ||
| description: `Limit SettingsRow descriptions to ${MAX_LENGTH} characters of static text. The column is at most 672px, about 110 characters per line next to a dropdown, so ${MAX_LENGTH} stays two lines.`, | ||
| }, | ||
| }, | ||
| create(context) { | ||
| return { | ||
| JSXOpeningElement(node) { | ||
| if (node.name.type !== "JSXIdentifier" || node.name.name !== "SettingsRow") return; | ||
| for (const attribute of node.attributes) { | ||
| if (attribute.type !== "JSXAttribute") continue; | ||
| if (attribute.name.type !== "JSXIdentifier" || attribute.name.name !== "description") { | ||
| continue; | ||
| } | ||
| const length = staticText(attribute.value).replace(/\s+/gu, " ").trim().length; | ||
| if (length > MAX_LENGTH) context.report({ node: attribute, message: MESSAGE(length) }); | ||
| } | ||
| }, | ||
| }; | ||
| }, | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Script executed:
Repository: pingdotgg/t3code
Length of output: 10555
Script executed:
Repository: pingdotgg/t3code
Length of output: 15718
Script executed:
Repository: pingdotgg/t3code
Length of output: 11151
Script executed:
Repository: pingdotgg/t3code
Length of output: 15171
Describe the cleanup provider accurately.
A dedicated cleanup model can use a different provider. An unavailable or exhausted provider can also trigger another fallback.
Suggested fix
Committable suggestion