eslint-plugin-tailwindcss
Advanced tools
Comparing version 3.5.1-beta.0 to 3.5.2
@@ -1326,17 +1326,8 @@ /** | ||
type: 'prose', | ||
members: '(not\\-)?prose', | ||
members: 'prose', | ||
}, | ||
{ | ||
type: 'Prose Gray Scale', | ||
members: 'prose\\-(gray|slate|zinc|neutral|stone)', | ||
type: 'prose-modifier', | ||
members: 'prose(\\-(?<value>${typography}))?', | ||
}, | ||
{ | ||
type: 'Prose Type Scale', | ||
members: 'prose\\-(sm|base|lg|2?xl)', | ||
}, | ||
{ | ||
type: 'Prose Dark Mode', | ||
members: 'prose\\-invert', | ||
}, | ||
// prose\\-(headings|lead|h1|h2|h3|h4|p|a|blockquote|figure|figcaption|strong|em|code|pre|ol|ul|li|table|thead|tr|th|td|img|video|hr) | ||
], | ||
@@ -1343,0 +1334,0 @@ }, |
@@ -25,2 +25,4 @@ /** | ||
const contextFallbackCache = new WeakMap(); | ||
module.exports = { | ||
@@ -92,3 +94,10 @@ meta: { | ||
const mergedConfig = customConfig.resolve(twConfig); | ||
const contextFallback = officialSorting ? createContextFallback(mergedConfig) : null; | ||
const contextFallback = officialSorting | ||
? ( | ||
// Set the created contextFallback in the cache if it does not exist yet. | ||
contextFallbackCache.has(mergedConfig) | ||
? contextFallbackCache | ||
: contextFallbackCache.set(mergedConfig, createContextFallback(mergedConfig)) | ||
).get(mergedConfig) | ||
: null; | ||
@@ -95,0 +104,0 @@ //---------------------------------------------------------------------- |
@@ -15,4 +15,2 @@ /** | ||
const getClassnamesFromCSS = require('../util/cssFiles'); | ||
const createContextFallback = require('tailwindcss/lib/lib/setupContextUtils').createContext; | ||
const generated = require('../util/generated'); | ||
@@ -85,3 +83,2 @@ //------------------------------------------------------------------------------ | ||
const mergedConfig = customConfig.resolve(twConfig); | ||
const contextFallback = createContextFallback(mergedConfig); | ||
@@ -103,6 +100,2 @@ //---------------------------------------------------------------------- | ||
classNames.forEach((className) => { | ||
const gen = generated(className, contextFallback); | ||
if (gen.length) { | ||
return; // Lazier is faster... processing next className! | ||
} | ||
const idx = groupUtil.getGroupIndex(className, groups, mergedConfig.separator); | ||
@@ -109,0 +102,0 @@ if (idx >= 0) { |
@@ -264,2 +264,4 @@ /** | ||
const cachedRegexes = new WeakMap(); | ||
/** | ||
@@ -270,5 +272,12 @@ * Customize the regex based on config | ||
* @param {Object} config The merged Tailwind CSS config | ||
* @returns {String} Patched version with config values and additinal parameters | ||
* @returns {String} Patched version with config values and additional parameters | ||
*/ | ||
function patchRegex(re, config) { | ||
if (!cachedRegexes.has(config)) { | ||
cachedRegexes.set(config, {}); | ||
} | ||
const cache = cachedRegexes.get(config); | ||
if (re in cache) { | ||
return cache[re]; | ||
} | ||
let patched = '\\!?'; | ||
@@ -286,3 +295,3 @@ // Prefix | ||
if (props.length === 0) { | ||
return `${patched}(${replaced})`; | ||
return cache[re] = `${patched}(${replaced})`; | ||
} | ||
@@ -342,3 +351,3 @@ // e.g. backgroundColor, letterSpacing, -margin... | ||
}); | ||
return `${patched}(${replaced})`; | ||
return cache[re] = `${patched}(${replaced})`; | ||
} | ||
@@ -345,0 +354,0 @@ |
{ | ||
"name": "eslint-plugin-tailwindcss", | ||
"version": "3.5.1-beta.0", | ||
"version": "3.5.2", | ||
"description": "Rules enforcing best practices while using Tailwind CSS", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -40,2 +40,3 @@ # eslint-plugin-tailwindcss | ||
- FIX: [speeds up `enforces-shorthand` and `classnames-order`](https://github.com/francoismassart/eslint-plugin-tailwindcss/issues/136) with `officialSorting: true` by introducing WeakMap caches to reduce duplicate calculations (by [mpsijm](https://github.com/mpsijm) π) | ||
- New strategy for whitespaces and linebreaks: the plugin will attempt to leave them intact | ||
@@ -42,0 +43,0 @@ - New option `officialSorting` for [`classnames-order`](docs/rules/classnames-order.md#officialsorting-default-false) can be set to `true` in order to use the same ordering order as the official [`prettier-plugin-tailwindcss`](https://www.npmjs.com/package/prettier-plugin-tailwindcss) |
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
0
202
153256
26
4318