From 9e03a6800b365529d976e8cdeed9694681c0fe6f Mon Sep 17 00:00:00 2001 From: Robin Malfait Date: Fri, 17 Dec 2021 17:32:50 +0100 Subject: [PATCH] Improve jsx interpolation candidate matching (#6593) * ensure that strangely used jsx with interpolation gets detected Co-authored-by: Luke Warlow Co-authored-by: Jordan Pittman * update changelog Co-authored-by: Luke Warlow Co-authored-by: Jordan Pittman --- CHANGELOG.md | 1 + src/lib/defaultExtractor.js | 2 +- tests/default-extractor.test.js | 7 +++++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index efaf131d9ba4..02c1d4a9123b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Improve circular dependency detection when using `@apply` ([#6588](https://github.com/tailwindlabs/tailwindcss/pull/6588)) - Only generate variants for non-`user` layers ([#6589](https://github.com/tailwindlabs/tailwindcss/pull/6589)) - Properly extract classes with arbitrary values in arrays and classes followed by escaped quotes ([#6590](https://github.com/tailwindlabs/tailwindcss/pull/6590)) +- Improve jsx interpolation candidate matching ([#6593](https://github.com/tailwindlabs/tailwindcss/pull/6593)) ## [3.0.6] - 2021-12-16 diff --git a/src/lib/defaultExtractor.js b/src/lib/defaultExtractor.js index 32c18fe6bca2..eccf8efc42af 100644 --- a/src/lib/defaultExtractor.js +++ b/src/lib/defaultExtractor.js @@ -17,7 +17,7 @@ const PATTERNS = [ ].join('|') const BROAD_MATCH_GLOBAL_REGEXP = new RegExp(PATTERNS, 'g') -const INNER_MATCH_GLOBAL_REGEXP = /[^<>"'`\s.(){}[\]#=%]*[^<>"'`\s.(){}[\]#=%:]/g +const INNER_MATCH_GLOBAL_REGEXP = /[^<>"'`\s.(){}[\]#=%$]*[^<>"'`\s.(){}[\]#=%:$]/g /** * @param {string} content diff --git a/tests/default-extractor.test.js b/tests/default-extractor.test.js index 08315ca49a89..5c128f64274c 100644 --- a/tests/default-extractor.test.js +++ b/tests/default-extractor.test.js @@ -1,7 +1,9 @@ import { html } from './util/run' import { defaultExtractor } from '../src/lib/defaultExtractor' -const input = html` +let jsxExample = "
" +const input = + html`
@@ -44,7 +46,7 @@ const input = html` uppercase:true } -` +` + jsxExample const includes = [ `font-['some_font',sans-serif]`, @@ -84,6 +86,7 @@ const includes = [ `lg:text-[24px]`, `content-['>']`, `hover:test`, + `overflow-scroll`, ] const excludes = [