eslint-plugin-tailwindcss
Advanced tools
Comparing version 3.3.6 to 3.3.7
@@ -59,3 +59,2 @@ /** | ||
const genericArbitraryOption = '\\[(.*)\\]'; | ||
const supportArbitrary = !isNegative; | ||
const defaultKeyIndex = keys.findIndex((v) => v === 'DEFAULT'); | ||
@@ -90,8 +89,6 @@ if (defaultKeyIndex > -1) { | ||
const options = []; | ||
// Conditionnaly generates the opacity suffix | ||
const opacitySuffix = supportArbitrary ? opacitySuffixes : ''; | ||
keys.forEach((k) => { | ||
const color = config.theme[propName][k] || config.theme.colors[k]; | ||
if (typeof color === 'string') { | ||
options.push(escapeSpecialChars(k) + opacitySuffix); | ||
options.push(escapeSpecialChars(k) + opacitySuffixes); | ||
} else { | ||
@@ -104,26 +101,24 @@ const variants = Object.keys(color).map((colorKey) => escapeSpecialChars(colorKey)); | ||
} | ||
options.push(k + '(\\-(' + variants.join('|') + '))' + (hasDefault ? '?' : '') + opacitySuffix); | ||
options.push(k + '(\\-(' + variants.join('|') + '))' + (hasDefault ? '?' : '') + opacitySuffixes); | ||
} | ||
}); | ||
if (supportArbitrary) { | ||
const arbitraryColors = [...color.mergedColorValues]; | ||
switch (propName) { | ||
case 'fill': | ||
// Forbidden prefixes | ||
arbitraryColors.push(`(?!(angle|length|list)\:).{1,}`); | ||
break; | ||
case 'gradientColorStops': | ||
arbitraryColors.push(color.RGBAPercentages); // RGBA % 0.5[%] | ||
arbitraryColors.push(color.optionalColorPrefixedVar); | ||
arbitraryColors.push(color.notHSLAPlusWildcard); | ||
break; | ||
case 'textColor': | ||
arbitraryColors.push(color.RGBAPercentages); // RGBA % 0.5[%] | ||
arbitraryColors.push(color.mandatoryColorPrefixed); | ||
break; | ||
default: | ||
arbitraryColors.push(color.mandatoryColorPrefixed); | ||
} | ||
options.push(`\\[(${arbitraryColors.join('|')})\\]`); | ||
const arbitraryColors = [...color.mergedColorValues]; | ||
switch (propName) { | ||
case 'fill': | ||
// Forbidden prefixes | ||
arbitraryColors.push(`(?!(angle|length|list)\:).{1,}`); | ||
break; | ||
case 'gradientColorStops': | ||
arbitraryColors.push(color.RGBAPercentages); // RGBA % 0.5[%] | ||
arbitraryColors.push(color.optionalColorPrefixedVar); | ||
arbitraryColors.push(color.notHSLAPlusWildcard); | ||
break; | ||
case 'textColor': | ||
arbitraryColors.push(color.RGBAPercentages); // RGBA % 0.5[%] | ||
arbitraryColors.push(color.mandatoryColorPrefixed); | ||
break; | ||
default: | ||
arbitraryColors.push(color.mandatoryColorPrefixed); | ||
} | ||
options.push(`\\[(${arbitraryColors.join('|')})\\]`); | ||
return '(' + options.join('|') + ')'; | ||
@@ -182,8 +177,6 @@ case 'borderWidth': | ||
case 'cursor': | ||
if (supportArbitrary) { | ||
// All units | ||
escapedKeys.push(length.mergedUnitsRegEx); | ||
// Forbidden prefixes | ||
escapedKeys.push(`\\[(?!(angle|color|length|list)\:).{1,}\\]`); | ||
} | ||
// All units | ||
escapedKeys.push(length.mergedUnitsRegEx); | ||
// Forbidden prefixes | ||
escapedKeys.push(`\\[(?!(angle|color|length|list)\:).{1,}\\]`); | ||
return '(' + escapedKeys.join('|') + ')'; | ||
@@ -200,8 +193,6 @@ case 'backdropHueRotate': | ||
case 'translate': | ||
if (supportArbitrary) { | ||
// All units | ||
escapedKeys.push(length.mergedUnitsRegEx); | ||
// Forbidden prefixes | ||
escapedKeys.push(`\\[(?!(angle|color|length|list)\:).{1,}\\]`); | ||
} | ||
// All units | ||
escapedKeys.push(length.mergedUnitsRegEx); | ||
// Forbidden prefixes | ||
escapedKeys.push(`\\[(?!(angle|color|length|list)\:).{1,}\\]`); | ||
return '(' + escapedKeys.join('|') + ')'; | ||
@@ -219,5 +210,3 @@ case 'backgroundOpacity': | ||
case 'rotate': | ||
if (supportArbitrary) { | ||
escapedKeys.push(`\\[(${angle.mergedAngleValues.join('|')})\\]`); | ||
} | ||
escapedKeys.push(`\\[(${angle.mergedAngleValues.join('|')})\\]`); | ||
return '(' + escapedKeys.join('|') + ')'; | ||
@@ -262,5 +251,3 @@ case 'gridTemplateColumns': | ||
case 'zIndex': | ||
if (supportArbitrary) { | ||
escapedKeys.push(genericArbitraryOption); | ||
} | ||
escapedKeys.push(genericArbitraryOption); | ||
return '(' + escapedKeys.join('|') + ')'; | ||
@@ -267,0 +254,0 @@ case 'fontWeight': |
{ | ||
"name": "eslint-plugin-tailwindcss", | ||
"version": "3.3.6", | ||
"version": "3.3.7", | ||
"description": "Rules enforcing best practices while using Tailwind CSS", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -40,2 +40,3 @@ # eslint-plugin-tailwindcss | ||
- FIX: [allowing negative arbitrary values in dash prefixed classnames](https://github.com/francoismassart/eslint-plugin-tailwindcss/issues/112) | ||
- FIX: deprecated message for `ring-opacity-*` in `migration-from-tailwind-2` rule | ||
@@ -42,0 +43,0 @@ - FIX: `migration-from-tailwind-2` and `enforces-shorthand` fixer with `@angular-eslint/template-parser` |
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
193
147864
4092