Fix recommended variant order linting in Tailwind v2 (#849)

master
Brad Cornes 2023-08-29 10:42:11 +01:00 committed by GitHub
parent bac7e2e564
commit 401a306e16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 3 deletions

View File

@ -30,10 +30,9 @@ export async function getRecommendedVariantOrderDiagnostics(
return return
} }
let order = state.jitContext.variantOrder ?? state.jitContext.offsets.variantOffsets
let { variants, offset } = getVariantsFromClassName(state, className.className) let { variants, offset } = getVariantsFromClassName(state, className.className)
let sortedVariants = [...variants].sort((a, b) => let sortedVariants = [...variants].sort((a, b) => jit.bigSign(order.get(b) - order.get(a)))
jit.bigSign(state.jitContext.variantOrder.get(b) - state.jitContext.variantOrder.get(a))
)
if (!equalExact(variants, sortedVariants)) { if (!equalExact(variants, sortedVariants)) {
diagnostics.push({ diagnostics.push({