eslint-plugin-tailwindcss
Advanced tools
Comparing version 1.16.1 to 1.17.0-beta.0
@@ -223,5 +223,6 @@ /** | ||
if (arg === null) { | ||
originalClassNamesValue = node.value.value; | ||
start = node.value.range[0] + 1; | ||
end = node.value.range[1] - 1; | ||
originalClassNamesValue = astUtil.extractValueFromNode(node); | ||
const range = astUtil.extractRangeFromNode(node); | ||
start = range[0] + 1; | ||
end = range[1] - 1; | ||
} else { | ||
@@ -228,0 +229,0 @@ switch (arg.type) { |
@@ -50,5 +50,11 @@ /** | ||
function isLiteralAttributeValue(node) { | ||
if (node.value && node.value.type === 'Literal') { | ||
// No support for dynamic or conditional... | ||
return !/\{|\?|\}/.test(node.value.value); | ||
if (node.value) { | ||
switch (node.value.type) { | ||
case 'Literal': | ||
// No support for dynamic or conditional... | ||
return !/\{|\?|\}/.test(node.value.value); | ||
case 'JSXExpressionContainer': | ||
// className={"..."} | ||
return node.value.expression.type === 'Literal'; | ||
} | ||
} | ||
@@ -94,2 +100,20 @@ return false; | ||
function extractRangeFromNode(node) { | ||
switch (node.value.type) { | ||
case 'JSXExpressionContainer': | ||
return node.value.expression.range; | ||
default: | ||
return node.value.range; | ||
} | ||
} | ||
function extractValueFromNode(node) { | ||
switch (node.value.type) { | ||
case 'JSXExpressionContainer': | ||
return node.value.expression.value; | ||
default: | ||
return node.value.value; | ||
} | ||
} | ||
/** | ||
@@ -109,3 +133,3 @@ * Inspect and parse an abstract syntax node and run a callback function | ||
if (arg === null) { | ||
originalClassNamesValue = node.value.value; | ||
originalClassNamesValue = extractValueFromNode(node); | ||
classNames = attrUtil.getClassNamesFromAttribute(originalClassNamesValue, true); | ||
@@ -178,2 +202,4 @@ classNames = removeDuplicatesFromArray(classNames); | ||
module.exports = { | ||
extractRangeFromNode, | ||
extractValueFromNode, | ||
isValidJSXAttribute, | ||
@@ -180,0 +206,0 @@ isValidVueAttribute, |
{ | ||
"name": "eslint-plugin-tailwindcss", | ||
"version": "1.16.1", | ||
"version": "1.17.0-beta.0", | ||
"description": "Rules enforcing best practices while using Tailwind CSS", | ||
@@ -35,4 +35,6 @@ "keywords": [ | ||
"@tailwindcss/typography": "^0.4.0", | ||
"@typescript-eslint/parser": "^4.33.0", | ||
"eslint": "^7.1.0", | ||
"mocha": "^7.2.0", | ||
"typescript": "4.3.5", | ||
"vue-eslint-parser": "^7.6.0" | ||
@@ -39,0 +41,0 @@ }, |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
93948
2777
8
1