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.12.2-beta.0 to 3.13.0-beta.0

49

lib/rules/enforces-shorthand.js

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

// These are shorthand candidates that do not share the same parent type
const complexEquivalences = [
[["overflow-hidden", "text-ellipsis", "whitespace-nowrap"], "truncate"]
]
// Init assets

@@ -85,3 +90,5 @@ const targetProperties = {

Transforms: ['Scale'],
Typography: ['Text Overflow', 'Whitespace']
};
// We don't want to affect other rules by object reference

@@ -215,5 +222,45 @@ const cloned = JSON.parse(JSON.stringify(defaultGroups));

const validated = [];
// Handle sets of classnames with different parent types
let remaining = parsed
for (const [inputSet, outputClassname] of complexEquivalences) {
if (remaining.length < inputSet.length) {
continue
}
const parsedElementsInInputSet = remaining.filter(remainingClass => inputSet.some(inputClass => remainingClass.name.includes(inputClass)))
// Make sure all required classes for the shorthand are present
if (parsedElementsInInputSet.length !== inputSet.length) {
continue
}
// Make sure the classes share all the same variants
if (new Set(parsedElementsInInputSet.map(p => p.variants)).size !== 1) {
continue
}
// Make sure the classes share all the same importance
if (new Set(parsedElementsInInputSet.map(p => p.important)).size !== 1) {
continue
}
const index = parsedElementsInInputSet[0].index
const variants = parsedElementsInInputSet[0].variants
const important = parsedElementsInInputSet[0].important ? "!" : ""
const patchedClassname = `${variants}${important}${mergedConfig.prefix}${outputClassname}`
troubles.push([parsedElementsInInputSet.map((c) => `${c.name}`), patchedClassname]);
const validatedClassname = groupUtil.parseClassname(patchedClassname, targetGroups, mergedConfig, index)
validated.push(validatedClassname);
remaining = remaining.filter(p => !parsedElementsInInputSet.includes(p))
}
// Handle sets of classnames with the same parent type
// Each group parentType
const checkedGroups = [];
parsed.forEach((classname) => {
remaining.forEach((classname) => {
// Valid candidate

@@ -220,0 +267,0 @@ if (classname.parentType === '') {

8

lib/util/ast.js

@@ -285,4 +285,3 @@ /**

childNode.elements.forEach((el) => {
// parseNodeRecursive(rootNode, el, cb, skipConditional, forceIsolation, ignoredKeys);
parseNodeRecursive(rootNode, el, cb, skipConditional, false, ignoredKeys);
parseNodeRecursive(rootNode, el, cb, skipConditional, forceIsolation, ignoredKeys);
});

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

if (prop.type === 'SpreadElement') {
// Ignore spread elements
return;
}
if (prop.key.type === 'Identifier' && ignoredKeys.includes(prop.key.name)) {

@@ -296,0 +300,0 @@ // Ignore specific keys defined in settings

@@ -6,2 +6,3 @@ var generateRulesFallback = require('tailwindcss/lib/lib/generateRules').generateRules;

const gen = generateRulesFallback(new Set([className]), context);
// console.debug(gen);
return gen;

@@ -8,0 +9,0 @@ }

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

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

@@ -43,2 +43,4 @@ # eslint-plugin-tailwindcss

- feat: [support enforcing truncate shorthand](https://github.com/francoismassart/eslint-plugin-tailwindcss/pull/255) (by [bezbac](https://github.com/bezbac) πŸ™)
- fix: [parsing spreads in object expressions](https://github.com/francoismassart/eslint-plugin-tailwindcss/pull/251) (by [bezbac](https://github.com/bezbac) πŸ™)
- fix: [do not handle non-ASCII whitespace as separator](https://github.com/francoismassart/eslint-plugin-tailwindcss/pull/246) (by [uhyo](https://github.com/uhyo) πŸ™)

@@ -45,0 +47,0 @@ - fix: [prefix support for named group/peer syntax](https://github.com/francoismassart/eslint-plugin-tailwindcss/pull/244) (by [bezbac](https://github.com/bezbac) πŸ™)

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