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.3.0 to 3.3.1-beta.0

25

lib/rules/classnames-order.js

@@ -229,4 +229,9 @@ /**

const range = astUtil.extractRangeFromNode(node);
start = range[0] + 1;
end = range[1] - 1;
if (node.type === 'TextAttribute') {
start = range[0];
end = range[1];
} else {
start = range[0] + 1;
end = range[1] - 1;
}
} else {

@@ -345,9 +350,13 @@ switch (arg.type) {

//----------------------------------------------------------------------
const attributeVisitor = function (node) {
if (!astUtil.isValidJSXAttribute(node)) {
return;
}
sortNodeArgumentValue(node);
};
const scriptVisitor = {
JSXAttribute: function (node) {
if (!astUtil.isValidJSXAttribute(node)) {
return;
}
sortNodeArgumentValue(node);
},
JSXAttribute: attributeVisitor,
TextAttribute: attributeVisitor,
CallExpression: function (node) {

@@ -354,0 +363,0 @@ if (callees.findIndex((name) => node.callee.name === name) === -1) {

@@ -345,9 +345,12 @@ /**

const attributeVisitor = function (node) {
if (!astUtil.isValidJSXAttribute(node)) {
return;
}
parseForShorthandCandidates(node);
};
const scriptVisitor = {
JSXAttribute: function (node) {
if (!astUtil.isValidJSXAttribute(node)) {
return;
}
parseForShorthandCandidates(node);
},
JSXAttribute: attributeVisitor,
TextAttribute: attributeVisitor,
CallExpression: function (node) {

@@ -354,0 +357,0 @@ if (callees.findIndex((name) => node.callee.name === name) === -1) {

@@ -244,9 +244,12 @@ /**

const attributeVisitor = function (node) {
if (!astUtil.isValidJSXAttribute(node)) {
return;
}
parseForObsoleteClassNames(node);
};
const scriptVisitor = {
JSXAttribute: function (node) {
if (!astUtil.isValidJSXAttribute(node)) {
return;
}
parseForObsoleteClassNames(node);
},
JSXAttribute: attributeVisitor,
TextAttribute: attributeVisitor,
CallExpression: function (node) {

@@ -253,0 +256,0 @@ if (callees.findIndex((name) => node.callee.name === name) === -1) {

@@ -141,9 +141,12 @@ /**

const attributeVisitor = function (node) {
if (!astUtil.isValidJSXAttribute(node)) {
return;
}
parseForArbitraryValues(node);
};
const scriptVisitor = {
JSXAttribute: function (node) {
if (!astUtil.isValidJSXAttribute(node)) {
return;
}
parseForArbitraryValues(node);
},
JSXAttribute: attributeVisitor,
TextAttribute: attributeVisitor,
CallExpression: function (node) {

@@ -150,0 +153,0 @@ if (callees.findIndex((name) => node.callee.name === name) === -1) {

@@ -132,9 +132,12 @@ /**

const attributeVisitor = function (node) {
if (!astUtil.isValidJSXAttribute(node)) {
return;
}
astUtil.parseNodeRecursive(node, null, parseForContradictingClassNames, true);
};
const scriptVisitor = {
JSXAttribute: function (node) {
if (!astUtil.isValidJSXAttribute(node)) {
return;
}
astUtil.parseNodeRecursive(node, null, parseForContradictingClassNames, true);
},
JSXAttribute: attributeVisitor,
TextAttribute: attributeVisitor,
CallExpression: function (node) {

@@ -141,0 +144,0 @@ if (callees.findIndex((name) => node.callee.name === name) === -1) {

@@ -128,9 +128,12 @@ /**

const attributeVisitor = function (node) {
if (!astUtil.isValidJSXAttribute(node)) {
return;
}
astUtil.parseNodeRecursive(node, null, parseForCustomClassNames);
};
const scriptVisitor = {
JSXAttribute: function (node) {
if (!astUtil.isValidJSXAttribute(node)) {
return;
}
astUtil.parseNodeRecursive(node, null, parseForCustomClassNames);
},
JSXAttribute: attributeVisitor,
TextAttribute: attributeVisitor,
CallExpression: function (node) {

@@ -137,0 +140,0 @@ if (callees.findIndex((name) => node.callee.name === name) === -1) {

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

// context.parserPath
// /.../eslint-plugin-tailwindcss/node_modules/espree/espree.js
// /.../eslint-plugin-tailwindcss/node_modules/@angular-eslint/template-parser/dist/index.js
const attrUtil = require('./attr');

@@ -18,3 +22,14 @@ const removeDuplicatesFromArray = require('./removeDuplicatesFromArray');

function isClassAttribute(node) {
return node.name && /^class(Name)?$/.test(node.name.name);
if (!node.name) {
return false;
}
let name = '';
switch (node.type) {
case 'TextAttribute':
name = node.name;
break;
default:
name = node.name.name;
}
return /^class(Name)?$/.test(name);
}

@@ -52,2 +67,5 @@

function isLiteralAttributeValue(node) {
if (node.type === 'TextAttribute' && node.name === 'class' && typeof node.value === 'string') {
return true;
}
if (node.value) {

@@ -103,2 +121,5 @@ switch (node.value.type) {

function extractRangeFromNode(node) {
if (node.type === 'TextAttribute' && node.name === 'class') {
return [node.valueSpan.fullStart.offset, node.valueSpan.end.offset];
}
switch (node.value.type) {

@@ -113,2 +134,5 @@ case 'JSXExpressionContainer':

function extractValueFromNode(node) {
if (node.type === 'TextAttribute' && node.name === 'class') {
return node.value;
}
switch (node.value.type) {

@@ -115,0 +139,0 @@ case 'JSXExpressionContainer':

@@ -32,3 +32,3 @@ /**

function escapeSpecialChars(str) {
return str.replace(/[\-\.\/\(\)]/g, '\\$&');
return str.replace(/\W/g, '\\$&');
}

@@ -35,0 +35,0 @@

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

@@ -32,2 +32,3 @@ "keywords": [

"devDependencies": {
"@angular-eslint/template-parser": "^13.0.1",
"@tailwindcss/aspect-ratio": "^0.4.0",

@@ -34,0 +35,0 @@ "@tailwindcss/forms": "^0.4.0",

@@ -36,2 +36,5 @@ # eslint-plugin-tailwindcss

- FIX: [Escaping special characters in the `prefix`](https://github.com/francoismassart/eslint-plugin-tailwindcss/issues/73)
- FIX: [Formating HTML files](https://github.com/francoismassart/eslint-plugin-tailwindcss/issues/85) is now possible using `@angular-eslint/template-parser`
- New feature: [crawling `ArrayExpression` elements and `ObjectExpression`](https://github.com/francoismassart/eslint-plugin-tailwindcss/pull/103), see [issue #99](https://github.com/francoismassart/eslint-plugin-tailwindcss/issues/99) (by [matt-tingen](https://github.com/matt-tingen) πŸ™)

@@ -38,0 +41,0 @@ - New rule: [`no-arbitrary-value`](https://github.com/francoismassart/eslint-plugin-tailwindcss/issues/89) which forbid using arbitrary values in classnames

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