Skip to content

Commit 16f0482

Browse files
author
Evan Jacobs
committed
apply review feedback
1 parent 5775eff commit 16f0482

2 files changed

Lines changed: 4 additions & 25 deletions

File tree

src/lib/parse-class-name.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,6 @@ export const createParseClassName = (config: AnyConfig) => {
6161
else if (currentCharacter === ')') parenDepth--
6262
}
6363

64-
// Use modifiers array directly or empty array
65-
const finalModifiers = modifiers.length > 0 ? modifiers : EMPTY_MODIFIERS
66-
6764
const baseClassNameWithImportantModifier =
6865
modifiers.length === 0 ? className : className.slice(modifierStart)
6966

@@ -91,7 +88,7 @@ export const createParseClassName = (config: AnyConfig) => {
9188
: undefined
9289

9390
return createResultObject(
94-
finalModifiers,
91+
modifiers,
9592
hasImportantModifier,
9693
baseClassName,
9794
maybePostfixModifierPosition,

src/lib/sort-modifiers.ts

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,9 @@ export const createSortModifiers = (config: AnyConfig) => {
3030
const isOrderSensitive = modifierWeights.has(modifier)
3131

3232
if (isArbitrary || isOrderSensitive) {
33-
// Sort and flush current segment using numeric weights
33+
// Sort and flush current segment alphabetically
3434
if (currentSegment.length > 0) {
35-
currentSegment.sort((a, b) => {
36-
const weightA = modifierWeights.get(a)
37-
const weightB = modifierWeights.get(b)
38-
if (weightA !== undefined && weightB !== undefined) {
39-
return weightA - weightB
40-
}
41-
if (weightA !== undefined) return -1
42-
if (weightB !== undefined) return 1
43-
return a.localeCompare(b)
44-
})
35+
currentSegment.sort((a, b) => a.localeCompare(b))
4536
result.push(...currentSegment)
4637
currentSegment = []
4738
}
@@ -54,16 +45,7 @@ export const createSortModifiers = (config: AnyConfig) => {
5445

5546
// Sort and add any remaining segment items
5647
if (currentSegment.length > 0) {
57-
currentSegment.sort((a, b) => {
58-
const weightA = modifierWeights.get(a)
59-
const weightB = modifierWeights.get(b)
60-
if (weightA !== undefined && weightB !== undefined) {
61-
return weightA - weightB
62-
}
63-
if (weightA !== undefined) return -1
64-
if (weightB !== undefined) return 1
65-
return a.localeCompare(b)
66-
})
48+
currentSegment.sort((a, b) => a.localeCompare(b))
6749
result.push(...currentSegment)
6850
}
6951

0 commit comments

Comments
 (0)