mirror of
https://github.com/pbakaus/impeccable.git
synced 2026-09-12 06:06:37 +03:00
Admit paired quoted strings inside shadow interpolations
Review finding on #553: the interpolation subpattern excluded quotes, so a documented shadow color after ${getShadow('lg')} or a quoted ternary branch lost its context and fired as drift. Interpolations now admit complete single/double-quoted strings; the quotes pair up inside the ${...}, so an unpaired quote or the template's closing backtick still ends the context and the allowance cannot leak to a later property. AI-assisted (Cursor agent), reviewed by maintainer. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -743,11 +743,12 @@ function isShadowPropertyContext(line, match) {
|
||||
// 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. 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);
|
||||
// admit complete `${...}` interpolations (including paired quoted strings
|
||||
// inside them, for function arguments and ternaries), 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