Nested ternaries in template literal interpolations
Nested ternaries in loop headers
Assignment expressions whose operator is not plain =
Assignment expressions whose left-hand side is not a bare identifier
Nodes preceded by codemod-ignore no-nested-ternary
File Coverage
The workflow runs the TSX parser across *.js, *.jsx, *.mjs, *.cjs, *.ts, and *.tsx files so JSX and TypeScript syntax can coexist with plain JavaScript input.
This codemod is intentionally conservative in declaration and assignment contexts where preserving JavaScript runtime semantics would otherwise be ambiguous.
Usage
bash
# Run from the registry
codemod run disallow-nested-ternary-unfold-to-if-else
# Run the local package against a target repository
pnpm dlx codemod@latest workflow run -w . -t /path/to/repo
Development
bash
# Run fixture tests
pnpm test
# Validate the workflow
pnpm validate
# Type-check the codemod
pnpm check-types
License
MIT
Ready to evolve your codebase?
Build tailored, compiler-aware skills to assess, plan, and automate complex codebase changes.