design-sparx / design-sparx/pattern-base

fix(all): refactor nested ternary expressions for readability (~20 instances)

Open
#37 0 comments 0 reactions 1 assignee View on GitHub

@kelvink96 is already working on this.

Since Sep 19, 2026.

lint
Dominant language
TypeScript
Stars
1
Forks
0
Avg merge
23h 44m
Merged PRs (30d)
5

Description

Problem

All framework packages have no-nested-ternary warnings. Nested ternaries are hard to read and error-prone.

Affected files

Antd
  • caveat.tsx, expand.tsx (x2), madlibs.tsx, prompt-details.tsx, sample-response.tsx, synthesis.tsx, verification.tsx
Bootstrap
  • caveat.tsx, expand.tsx (x2), madlibs.tsx, prompt-details.tsx, sample-response.tsx, synthesis.tsx, verification.tsx
Mantine
  • action-list.tsx, follow-up.tsx, inline-action.tsx, prompt-details.tsx, restyle.tsx, templates.tsx

Fix

Extract nested ternaries into named variables, helper functions, or use early-return patterns:

- const color = isActive ? 'blue' : isDisabled ? 'gray' : 'black'
+ const getColor = () => {
+   if (isActive) return 'blue';
+   if (isDisabled) return 'gray';
+   return 'black';
+ };
+ const color = getColor();

Count

~20+ instances.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.