Fix extended theme token-set matching with slash-space normalization#3840
Fix extended theme token-set matching with slash-space normalization#3840cursor[bot] wants to merge 1 commit into
Conversation
Co-authored-by: Jan Six <six.jan@gmail.com>
|
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 10 |
| Duplication | -10 |
TIP This summary will be updated as you push new changes. Give us feedback
|
|
|
Commit SHA:7730a3c86295776548a40e7ed41329c5c8d1de8c Test coverage results 🧪
|
|
Commit SHA:7730a3c86295776548a40e7ed41329c5c8d1de8c |
Why does this PR exist?
Closes #3826
Extended collection/theme token-set names were being compared as raw strings. If users entered names with spaces around
/(for exampleCollection / Child), export/import comparison logic treated them as different sets fromCollection/Child, which broke matching and caused incorrect rename behavior.What does this pull request do?
normalizeTokenSetName()to canonicalize token-set names by trimming whitespace around/path separators.normalizeTokenSetStatusMap()to dedupe normalized token-set keys while preserving strongest status (enabled>source>disabled).getTokenSetsOrder()token-set matching and active-set handling.getOverallConfig()andgetEnabledTokenSets()in token helper logic.generateTokensToCreate()when filtering enabled token sets.pullVariables()rename detection so whitespace-only differences are not treated as renames.core / colorsvscore/colors.Testing this change
Run targeted tests:
yarn test src/plugin/generateTokensToCreate.test.ts src/utils/getTokenSetsOrder.test.ts src/plugin/pullVariables.test.ts src/utils/normalizeTokenSetName.test.tsResult: all targeted tests pass (
4suites,21tests).Also ran ESLint autofix on touched files:
Additional Notes (if any)
This fix intentionally normalizes only slash-boundary whitespace to avoid changing legitimate internal token-set naming.