eslint-plugin-tailwindcss
Advanced tools
Comparing version 3.10.1-beta.4 to 3.10.1
@@ -247,3 +247,3 @@ /** | ||
switch (true) { | ||
case !astUtil.isValidVueAttribute(node): | ||
case !astUtil.isValidVueAttribute(node, classRegex): | ||
return; | ||
@@ -250,0 +250,0 @@ case astUtil.isVLiteralValue(node): |
@@ -191,3 +191,3 @@ /** | ||
switch (true) { | ||
case !astUtil.isValidVueAttribute(node): | ||
case !astUtil.isValidVueAttribute(node, classRegex): | ||
return; | ||
@@ -194,0 +194,0 @@ case astUtil.isVLiteralValue(node): |
@@ -424,3 +424,3 @@ /** | ||
switch (true) { | ||
case !astUtil.isValidVueAttribute(node): | ||
case !astUtil.isValidVueAttribute(node, classRegex): | ||
return; | ||
@@ -427,0 +427,0 @@ case astUtil.isVLiteralValue(node): |
@@ -302,3 +302,3 @@ /** | ||
switch (true) { | ||
case !astUtil.isValidVueAttribute(node): | ||
case !astUtil.isValidVueAttribute(node, classRegex): | ||
return; | ||
@@ -305,0 +305,0 @@ case astUtil.isVLiteralValue(node): |
@@ -191,3 +191,3 @@ /** | ||
switch (true) { | ||
case !astUtil.isValidVueAttribute(node): | ||
case !astUtil.isValidVueAttribute(node, classRegex): | ||
return; | ||
@@ -194,0 +194,0 @@ case astUtil.isVLiteralValue(node): |
@@ -219,3 +219,3 @@ /** | ||
switch (true) { | ||
case !astUtil.isValidVueAttribute(node): | ||
case !astUtil.isValidVueAttribute(node, classRegex): | ||
return; | ||
@@ -222,0 +222,0 @@ case astUtil.isVLiteralValue(node): |
@@ -190,3 +190,3 @@ /** | ||
switch (true) { | ||
case !astUtil.isValidVueAttribute(node): | ||
case !astUtil.isValidVueAttribute(node, classRegex): | ||
return; | ||
@@ -193,0 +193,0 @@ case astUtil.isVLiteralValue(node): |
@@ -39,10 +39,12 @@ /** | ||
* @param {ASTNode} node The AST node being checked | ||
* @param {String} classRegex Regex to test the attribute that is being checked against | ||
* @returns {Boolean} | ||
*/ | ||
function isVueClassAttribute(node) { | ||
function isVueClassAttribute(node, classRegex) { | ||
const re = new RegExp(classRegex); | ||
let name = ''; | ||
switch (true) { | ||
case node.key && /^class$/.test(node.key.name): | ||
case node.key && node.key.name && re.test(node.key.name): | ||
// class="vue-classes-as-litteral" | ||
return true; | ||
break; | ||
case node.key && | ||
@@ -54,7 +56,6 @@ node.key.name && | ||
/^bind$/.test(node.key.name.name) && | ||
/^class$/.test(node.key.argument.name): | ||
re.test(node.key.argument.name): | ||
// v-bind:class="vue-classes-as-bind" | ||
// :class="vue-classes-as-bind" | ||
return true; | ||
break; | ||
default: | ||
@@ -159,6 +160,7 @@ return false; | ||
* @param {ASTNode} node The AST node being checked | ||
* @param {String} classRegex Regex to test the attribute that is being checked against | ||
* @returns {Boolean} | ||
*/ | ||
function isValidVueAttribute(node) { | ||
if (!isVueClassAttribute(node)) { | ||
function isValidVueAttribute(node, classRegex) { | ||
if (!isVueClassAttribute(node, classRegex)) { | ||
// Only run for class attributes | ||
@@ -165,0 +167,0 @@ return false; |
@@ -17,2 +17,4 @@ 'use strict'; | ||
return ['classnames', 'clsx', 'ctl']; | ||
case 'classRegex': | ||
return '^class(Name)?$'; | ||
case 'config': | ||
@@ -22,2 +24,4 @@ return 'tailwind.config.js'; | ||
return ['**/*.css', '!**/node_modules', '!**/.*', '!**/dist', '!**/build']; | ||
case 'cssFilesRefreshRate': | ||
return 5_000; | ||
case 'removeDuplicates': | ||
@@ -31,4 +35,2 @@ return true; | ||
return []; | ||
case 'classRegex': | ||
return "^class(Name)?$" | ||
} | ||
@@ -35,0 +37,0 @@ } |
{ | ||
"name": "eslint-plugin-tailwindcss", | ||
"version": "3.10.1-beta.4", | ||
"version": "3.10.1", | ||
"description": "Rules enforcing best practices while using Tailwind CSS", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -43,2 +43,4 @@ # eslint-plugin-tailwindcss | ||
- fix: [default settings conflict](https://github.com/francoismassart/eslint-plugin-tailwindcss/issues/212) | ||
- fix: [`classRegex` ignored in vuejs](https://github.com/francoismassart/eslint-plugin-tailwindcss/issues/216) | ||
- chore: fix dependency vulnerability (mocha) | ||
@@ -45,0 +47,0 @@ - feat: [support named group/peer syntax](https://github.com/francoismassart/eslint-plugin-tailwindcss/pull/215) (by [hampustagerud](https://github.com/hampustagerud) π) |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
174144
4617
0
214