Fix: scope spinner exemption to the containing tag (#837)

A spinner on the same line as a rounded card was suppressing the card's border-accent finding. animate-spin is now checked on the match's markup tag, the same sibling-tag split gray-on-color uses.

Written with AI assistance.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Abdul Wahab
2026-09-18 17:03:18 +05:00
co-authored by Cursor
parent 9953435dda
commit a45750d2c4
+9 -1
View File
@@ -868,7 +868,11 @@ pub static REGEX_MATCHERS: Lazy<Vec<Matcher>> = Lazy::new(|| {
Matcher {
id: "border-accent-on-rounded",
find_all: |l| all(&BORDER_ACCENT_TW_RE, l),
test: |m, line| has_rounded(line) && num(m.g(1)) >= 1.0 && !ANIMATE_SPIN_RE.is_match(line),
test: |m, line| {
has_rounded(line)
&& num(m.g(1)) >= 1.0
&& !ANIMATE_SPIN_RE.is_match(&containing_markup_tag(line)(m.index))
},
fmt: |m, _| m.whole().to_string(),
},
Matcher {
@@ -1472,6 +1476,10 @@ mod tests {
assert!(g(r#"<div className="animate-spin rounded-full h-12 w-12 border-b-2 border-accent" />"#).is_empty());
assert!(g(r#"<div className="sm:animate-spin rounded-full h-8 w-8 border-t-2" />"#).is_empty());
assert!(g(r#"<div className="motion-safe:animate-spin rounded-full border-b-2" />"#).is_empty());
assert_eq!(
g(r#"<div className="animate-spin rounded-full h-12 w-12 border-b-2" /><div className="rounded-lg border-t-4" />"#),
vec!["border-t-4"]
);
}
#[test]