mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-14 07:06:45 +03:00
Keep shadow context across template interpolations
Review finding on #553: the end-anchored shadow-context tails excluded `}` (JS) and `{`/`}` (CSS), so a documented shadow color after a ${...} interpolation in a boxShadow template literal or a CSS-in-JS box-shadow line lost its allowance and fired as drift. Both tails now admit complete ${...} interpolations; a bare `}`, quote, or `;` still ends the context, so the allowance cannot leak past a template's closing backtick into a later property. AI-assisted (Cursor agent), reviewed by maintainer. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -742,9 +742,12 @@ function isShadowPropertyContext(line, match) {
|
||||
const before = line.slice(0, index);
|
||||
// Unlike jsColorKeyContext, the JS tail admits commas: a multi-layer shadow
|
||||
// string is comma-separated, and a later property on the same line is still
|
||||
// blocked because it sits past the string's closing quote.
|
||||
return /(?:^|[{\s;"'`(,])(?:box-shadow|text-shadow)\s*:\s*[^;{}"'`]*$/i.test(before)
|
||||
|| /(?:^|[,{]\s*)(?:boxShadow|textShadow)\s*[:=]\s*["'`]?[^"'`}]*$/i.test(before);
|
||||
// blocked because it sits past the string's closing quote. Both tails also
|
||||
// admit complete `${...}` interpolations, so a tokenized dynamic shadow
|
||||
// (template literal or CSS-in-JS) keeps its context; a bare `}`, quote, or
|
||||
// `;` still ends it.
|
||||
return /(?:^|[{\s;"'`(,])(?:box-shadow|text-shadow)\s*:\s*(?:\$\{[^}"'`]*\}|[^;{}"'`])*$/i.test(before)
|
||||
|| /(?:^|[,{]\s*)(?:boxShadow|textShadow)\s*[:=]\s*["'`]?(?:\$\{[^}"'`]*\}|[^"'`}])*$/i.test(before);
|
||||
}
|
||||
|
||||
function isInsideCssAttributeSelector(line, index) {
|
||||
|
||||
Reference in New Issue
Block a user