Repository navigation
chore(eslint): disallow nested ternaries - #8340
Draft
tamas-sage wants to merge 1 commit into
Draft
tamas-sage wants to merge 1 commit into
tamas-sage wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block the nested-ternary rule and accompanying refactors.
No open issues 🎉
What changed in this PR
Disallows nested ternaries across Carbon and refactors existing expressions without intended behavior changes.
Changes:
- Enables ESLint’s
no-nested-ternaryrule. - Replaces nested ternaries with helpers, conditionals, and simpler expressions.
- Updates affected tests and skills-generation logic.
| File | Description |
|---|---|
src/locales/pt-pt.ts |
Simplifies selection-count formatting. |
src/components/tile/tile.component.tsx |
Simplifies status-keyline fallback. |
src/components/tile/tile-footer/tile-footer.component.tsx |
Uses conditional variant mapping. |
src/components/textarea/textarea.style.ts |
Extracts label-spacing helper. |
src/components/table/table-header/table-header.component.tsx |
Calculates aria-sort separately. |
src/components/table/components-test.pw.tsx |
Simplifies fixture rendering conditions. |
src/components/switch/switch.style.tsx |
Shares thumb-transform helper. |
src/components/select/__internal__/select-list/__next__/use-select-list-virtualization.ts |
Extracts navigation starting position. |
src/components/select/__internal__/select-list/__next__/select-list.component.tsx |
Extracts divider-padding helper. |
src/components/numeral-date/numeral-date.test.tsx |
Supplies field keys in test cases. |
src/components/loader/__next__/loader.style.ts |
Extracts label-font helpers. |
src/components/loader/__next__/internal/ring-loader.component.tsx |
Uses conditional ring sizing. |
src/components/date/__internal__/hooks/useDatePickerMonthYearSelection.ts |
Simplifies displayed-month bounds handling. |
src/components/accordion/accordion.component.tsx |
Extracts simple-header rendering. |
src/__internal__/popover-menu/hooks/useHandleDropdownMenuKeyDown.ts |
Simplifies navigation-index fallback. |
src/__internal__/character-count/character-count.style.ts |
Extracts count-color helper. |
scripts/skills/build_skills.mjs |
Simplifies sorting and deprecation formatting. |
eslint.config.mjs |
Prohibits nested ternaries. |
Review effort: Balanced
FE-7853 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
tamas-sage
force-pushed
the
FE-7853-no-nested-ternary
branch
from
December 4, 2026 13:26
de7590c to
aeea43c
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
FE-7853
Proposed behaviour
Current behaviour
Checklist
d.tsfile added or updated if requiredQA
Additional context
Testing instructions