eslint-plugin-tailwindcss
Advanced tools
Comparing version 3.5.0-beta.1 to 3.5.0-beta.2
@@ -10,3 +10,2 @@ /** | ||
const astUtil = require('../util/ast'); | ||
const order = require('../util/prettier/order'); | ||
const groupUtil = require('../util/groupMethods'); | ||
@@ -16,2 +15,4 @@ const removeDuplicatesFromClassnamesAndWhitespaces = require('../util/removeDuplicatesFromClassnamesAndWhitespaces'); | ||
const parserUtil = require('../util/parser'); | ||
const order = require('../util/prettier/order'); | ||
const createContextFallback = require('tailwindcss/lib/lib/setupContextUtils').createContext; | ||
@@ -92,2 +93,3 @@ //------------------------------------------------------------------------------ | ||
const mergedConfig = customConfig.resolve(twConfig); | ||
const contextFallback = officialSorting ? createContextFallback(mergedConfig) : null; | ||
@@ -308,3 +310,3 @@ //---------------------------------------------------------------------- | ||
if (officialSorting) { | ||
orderedClassNames = order(classNames, mergedConfig); | ||
orderedClassNames = order(classNames, contextFallback); | ||
for (let i = 0; i < orderedClassNames.length; i++) { | ||
@@ -311,0 +313,0 @@ const w = whitespaces[i] ?? ''; |
@@ -1,4 +0,5 @@ | ||
var createContextFallback = require('tailwindcss/lib/lib/setupContextUtils').createContext; | ||
var generateRulesFallback = require('tailwindcss/lib/lib/generateRules').generateRules; | ||
var generatedMap = new Map(); | ||
function bigSign(bigIntValue) { | ||
@@ -8,8 +9,12 @@ return (bigIntValue > 0n) - (bigIntValue < 0n); | ||
function order(unordered, config) { | ||
var context = createContextFallback(config); | ||
function order(unordered, context) { | ||
const classNamesWithOrder = []; | ||
unordered.forEach((className) => { | ||
const order = | ||
generateRulesFallback(new Set([className]), context).sort(([a], [z]) => bigSign(z - a))[0]?.[0] ?? null; | ||
let order; | ||
if (generatedMap.has(className)) { | ||
order = generatedMap.get(className); | ||
} else { | ||
order = generateRulesFallback(new Set([className]), context).sort(([a], [z]) => bigSign(z - a))[0]?.[0] ?? null; | ||
generatedMap.set(className, order); | ||
} | ||
classNamesWithOrder.push([className, order]); | ||
@@ -16,0 +21,0 @@ }); |
{ | ||
"name": "eslint-plugin-tailwindcss", | ||
"version": "3.5.0-beta.1", | ||
"version": "3.5.0-beta.2", | ||
"description": "Rules enforcing best practices while using Tailwind CSS", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
158779
4308