Skip to content

refactor(ui): bring Mosaic Button and Input under the complexity limit - #9751

Closed
alexcarpenter wants to merge 1 commit into
chore/complexity-lint-warningfrom
chore/mosaic-button-input-complexity
Closed

alexcarpenter wants to merge 1 commit into
chore/complexity-lint-warningfrom
chore/mosaic-button-input-complexity

Conversation

@alexcarpenter

Copy link
Copy Markdown
Member

Description

Stacked on #9749. A worked example of clearing two grandfathered complexity suppressions, to show what a reduction looks like before deciding how far to push the rule.

Button (25 → 14). The stylex composition moves into a buttonStyleProps function alongside the two derived flags it alone uses. MosaicButton keeps resolving props against ButtonContext and rendering. No behaviour change.

Input (28 → 15). useOptionalFieldControlProps already returns every control attribute with the own prop as fallback, or null outside a Field. The five fieldProps?.x ?? x lookups collapse to one fieldProps ?? ownProps choice, and the two variant style conditionals become a lookup. No behaviour change.

Both stale entries are pruned from packages/ui/eslint-suppressions.json, so this is also the first run of the prune flow described in #9749.

Checklist

  • pnpm test runs as expected.
  • pnpm build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

@vercel

vercel Bot commented Sep 14, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
clerk-js-sandbox Ready Ready Preview Sep 14, 2026 4:45pm UTC
swingset Ready Ready Preview Sep 14, 2026 4:45pm UTC

Request Review

@changeset-bot

changeset-bot Bot commented Sep 14, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 24cfbed

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai

coderabbitai Bot commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Comment @coderabbitai help to get the list of available commands.

@alexcarpenter

Copy link
Copy Markdown
Member Author

Closing. The reductions here are mostly metric-chasing: cyclomatic complexity counts every ?? and ?., so prop-merging primitives score high without being hard to read. Evaluating cognitive complexity instead on #9749.

@alexcarpenter
alexcarpenter deleted the chore/mosaic-button-input-complexity branch September 14, 2026 18:03

This branch was successfully deployed

2 active deployments
Preview – swingset — 24cfbed7 Deployed Sep 14, 2026 by vercel[bot]
Preview – clerk-js-sandbox — 24cfbed7 Deployed Sep 14, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant