Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

eslint-plugin-tailwindcss

Package Overview
Dependencies
Maintainers
1
Versions
184
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eslint-plugin-tailwindcss - npm Package Compare versions

Comparing version 3.10.3 to 3.11.0-beta.0

5

lib/rules/classnames-order.js

@@ -47,2 +47,7 @@ /**

},
ignoredKeys: {
type: 'array',
items: { type: 'string', minLength: 0 },
uniqueItems: true,
},
config: {

@@ -49,0 +54,0 @@ // default: 'tailwind.config.js',

@@ -43,2 +43,7 @@ /**

},
ignoredKeys: {
type: 'array',
items: { type: 'string', minLength: 0 },
uniqueItems: true,
},
config: {

@@ -45,0 +50,0 @@ // default: 'tailwind.config.js',

@@ -44,2 +44,7 @@ /**

},
ignoredKeys: {
type: 'array',
items: { type: 'string', minLength: 0 },
uniqueItems: true,
},
config: {

@@ -46,0 +51,0 @@ // default: 'tailwind.config.js',

@@ -49,2 +49,7 @@ /**

},
ignoredKeys: {
type: 'array',
items: { type: 'string', minLength: 0 },
uniqueItems: true,
},
config: {

@@ -51,0 +56,0 @@ // default: 'tailwind.config.js',

@@ -43,2 +43,7 @@ /**

},
ignoredKeys: {
type: 'array',
items: { type: 'string', minLength: 0 },
uniqueItems: true,
},
config: {

@@ -45,0 +50,0 @@ // default: 'tailwind.config.js',

27

lib/rules/no-contradicting-classname.js

@@ -44,2 +44,7 @@ /**

},
ignoredKeys: {
type: 'array',
items: { type: 'string', minLength: 0 },
uniqueItems: true,
},
config: {

@@ -61,2 +66,3 @@ // default: 'tailwind.config.js',

const callees = getOption(context, 'callees');
const ignoredKeys = getOption(context, 'ignoredKeys');
const skipClassAttribute = getOption(context, 'skipClassAttribute');

@@ -163,5 +169,12 @@ const tags = getOption(context, 'tags');

if (astUtil.isLiteralAttributeValue(node)) {
astUtil.parseNodeRecursive(node, null, parseForContradictingClassNames, true);
astUtil.parseNodeRecursive(node, null, parseForContradictingClassNames, true, false, ignoredKeys);
} else if (node.value && node.value.type === 'JSXExpressionContainer') {
astUtil.parseNodeRecursive(node, node.value.expression, parseForContradictingClassNames, true);
astUtil.parseNodeRecursive(
node,
node.value.expression,
parseForContradictingClassNames,
true,
false,
ignoredKeys
);
}

@@ -186,3 +199,3 @@ };

node.arguments.forEach((arg) => {
astUtil.parseNodeRecursive(node, arg, pushClasses, true);
astUtil.parseNodeRecursive(node, arg, pushClasses, true, false, ignoredKeys);
});

@@ -211,3 +224,3 @@ parseForContradictingClassNames(allClassnamesForNode, node);

};
astUtil.parseNodeRecursive(node, node.quasi, pushClasses, true);
astUtil.parseNodeRecursive(node, node.quasi, pushClasses, true, false, ignoredKeys);
parseForContradictingClassNames(allClassnamesForNode, node);

@@ -228,3 +241,3 @@ },

case astUtil.isVLiteralValue(node):
astUtil.parseNodeRecursive(node, null, parseForContradictingClassNames, true);
astUtil.parseNodeRecursive(node, null, parseForContradictingClassNames, true, false, ignoredKeys);
break;

@@ -243,3 +256,3 @@ case astUtil.isArrayExpression(node):

node.value.expression.elements.forEach((el) => {
astUtil.parseNodeRecursive(node, el, pushClasses, true);
astUtil.parseNodeRecursive(node, el, pushClasses, true, false, ignoredKeys);
});

@@ -250,3 +263,3 @@ parseForContradictingClassNames(allClassnamesForNode, node);

node.value.expression.properties.forEach((prop) => {
astUtil.parseNodeRecursive(node, prop, parseForContradictingClassNames);
astUtil.parseNodeRecursive(node, prop, parseForContradictingClassNames, false, false, ignoredKeys);
});

@@ -253,0 +266,0 @@ break;

@@ -54,2 +54,7 @@ /**

},
ignoredKeys: {
type: 'array',
items: { type: 'string', minLength: 0 },
uniqueItems: true,
},
config: {

@@ -85,2 +90,3 @@ // default: 'tailwind.config.js',

const callees = getOption(context, 'callees');
const ignoredKeys = getOption(context, 'ignoredKeys');
const skipClassAttribute = getOption(context, 'skipClassAttribute');

@@ -157,5 +163,5 @@ const tags = getOption(context, 'tags');

if (astUtil.isLiteralAttributeValue(node)) {
astUtil.parseNodeRecursive(node, null, parseForCustomClassNames);
astUtil.parseNodeRecursive(node, null, parseForCustomClassNames, false, false, ignoredKeys);
} else if (node.value && node.value.type === 'JSXExpressionContainer') {
astUtil.parseNodeRecursive(node, node.value.expression, parseForCustomClassNames);
astUtil.parseNodeRecursive(node, node.value.expression, parseForCustomClassNames, false, false, ignoredKeys);
}

@@ -170,3 +176,3 @@ };

node.arguments.forEach((arg) => {
astUtil.parseNodeRecursive(node, arg, parseForCustomClassNames);
astUtil.parseNodeRecursive(node, arg, parseForCustomClassNames, false, false, ignoredKeys);
});

@@ -183,3 +189,3 @@ };

}
astUtil.parseNodeRecursive(node, node.quasi, parseForCustomClassNames);
astUtil.parseNodeRecursive(node, node.quasi, parseForCustomClassNames, false, false, ignoredKeys);
},

@@ -199,7 +205,7 @@ };

case astUtil.isVLiteralValue(node):
astUtil.parseNodeRecursive(node, null, parseForCustomClassNames);
astUtil.parseNodeRecursive(node, null, parseForCustomClassNames, false, false, ignoredKeys);
break;
case astUtil.isArrayExpression(node):
node.value.expression.elements.forEach((arg) => {
astUtil.parseNodeRecursive(node, arg, parseForCustomClassNames);
astUtil.parseNodeRecursive(node, arg, parseForCustomClassNames, false, false, ignoredKeys);
});

@@ -209,3 +215,3 @@ break;

node.value.expression.properties.forEach((prop) => {
astUtil.parseNodeRecursive(node, prop, parseForCustomClassNames);
astUtil.parseNodeRecursive(node, prop, parseForCustomClassNames, false, false, ignoredKeys);
});

@@ -212,0 +218,0 @@ break;

@@ -245,5 +245,6 @@ /**

* @param {Boolean} isolate Optional, set internally to isolate parsing and validation on conditional children
* @param {Array} ignoredKeys Optional, set object keys which should not be parsed e.g. for `cva`
* @returns {void}
*/
function parseNodeRecursive(rootNode, childNode, cb, skipConditional = false, isolate = false) {
function parseNodeRecursive(rootNode, childNode, cb, skipConditional = false, isolate = false, ignoredKeys = []) {
// TODO allow vue non litteral

@@ -270,18 +271,18 @@ let originalClassNamesValue;

childNode.expressions.forEach((exp) => {
parseNodeRecursive(rootNode, exp, cb, skipConditional, forceIsolation);
parseNodeRecursive(rootNode, exp, cb, skipConditional, forceIsolation, ignoredKeys);
});
childNode.quasis.forEach((quasis) => {
parseNodeRecursive(rootNode, quasis, cb, skipConditional, isolate);
parseNodeRecursive(rootNode, quasis, cb, skipConditional, isolate, ignoredKeys);
});
return;
case 'ConditionalExpression':
parseNodeRecursive(rootNode, childNode.consequent, cb, skipConditional, forceIsolation);
parseNodeRecursive(rootNode, childNode.alternate, cb, skipConditional, forceIsolation);
parseNodeRecursive(rootNode, childNode.consequent, cb, skipConditional, forceIsolation, ignoredKeys);
parseNodeRecursive(rootNode, childNode.alternate, cb, skipConditional, forceIsolation, ignoredKeys);
return;
case 'LogicalExpression':
parseNodeRecursive(rootNode, childNode.right, cb, skipConditional, forceIsolation);
parseNodeRecursive(rootNode, childNode.right, cb, skipConditional, forceIsolation, ignoredKeys);
return;
case 'ArrayExpression':
childNode.elements.forEach((el) => {
parseNodeRecursive(rootNode, el, cb, skipConditional, forceIsolation);
parseNodeRecursive(rootNode, el, cb, skipConditional, forceIsolation, ignoredKeys);
});

@@ -293,2 +294,7 @@ return;

if (prop.key.type === 'Identifier' && ignoredKeys.includes(prop.key.name)) {
// Ignore specific keys defined in settings
return;
}
parseNodeRecursive(

@@ -299,3 +305,4 @@ rootNode,

skipConditional,
forceIsolation
forceIsolation,
ignoredKeys
);

@@ -305,3 +312,3 @@ });

case 'Property':
parseNodeRecursive(rootNode, childNode.key, cb, skipConditional, forceIsolation);
parseNodeRecursive(rootNode, childNode.key, cb, skipConditional, forceIsolation, ignoredKeys);
return;

@@ -308,0 +315,0 @@ case 'Literal':

@@ -16,3 +16,5 @@ 'use strict';

case 'callees':
return ['classnames', 'clsx', 'ctl'];
return ['classnames', 'clsx', 'ctl', 'cva'];
case 'ignoredKeys':
return ['compoundVariants', 'defaultVariants'];
case 'classRegex':

@@ -19,0 +21,0 @@ return '^class(Name)?$';

{
"name": "eslint-plugin-tailwindcss",
"version": "3.10.3",
"version": "3.11.0-beta.0",
"description": "Rules enforcing best practices while using Tailwind CSS",

@@ -5,0 +5,0 @@ "keywords": [

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc