Skip to content

docs(components): one const per UI variant, the JSX picks - #3412

Open
mfal wants to merge 1 commit into
mainfrom
docs/jsx-variant-consts
Open

mfal wants to merge 1 commit into
mainfrom
docs/jsx-variant-consts

Conversation

@mfal

@mfal mfal commented Oct 8, 2026

Copy link
Copy Markdown
Member

Sharpens the JSX readability rule in packages/components/AGENTS.md and PATTERNS.md: every alternative UI part gets its own const, and the returned JSX decides with a one-line ternary or &&.

const skeletonDonut = <span className={styles.skeleton} inert />;
const donut = <Aria.ProgressBar …>…</Aria.ProgressBar>;

return <div>{isSkeleton ? skeletonDonut : donut}</div>;

The old wording, "lift … non-trivial conditionals into named consts", read as "assign the whole ternary to a const". That produced multi-line ternaries that hide both variants inside one variable (const donut = isSkeleton ? (…) : (…)). Seven such spots in the SkeletonMode stack (#3321, #3322, #3320, #3324) are already rewritten to the new rule.

Docs only, no release.

🤖 Generated with Claude Code

"Lift non-trivial conditionals into named consts" read as "assign the
whole ternary to a const", which produced multi-line ternaries hiding
both variants in one variable. The rule now says: every alternative UI
part gets its own const, and the returned JSX decides with a one-line
ternary or &&.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mfal mfal self-assigned this Oct 8, 2026
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

Coverage Report for ./packages/components/

Status Category Percentage Covered / Total
🔵 Lines 78.12% 1314 / 1682
🔵 Statements 77.85% 1350 / 1734
🔵 Functions 72.46% 300 / 414
🔵 Branches 71.81% 698 / 972
File CoverageNo changed files found.
Generated in workflow #7159 for commit 2aa5ff1 by the Vitest Coverage Report Action

@mfal
mfal marked this pull request as ready for review October 8, 2026 09:10
@mfal
mfal requested a review from a team October 8, 2026 09:10
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown
Contributor

🚀 Preview Deployment

Preview environments are ready:

Type URL
docs pr-3412.docs.review.flow-components.de
storybook pr-3412.storybook.review.flow-components.de

Images:

  • docs: ghcr.io/mittwald/flow/docs:pr-3412
  • storybook: ghcr.io/mittwald/flow/storybook:pr-3412

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant