Compare commits

...
Author SHA1 Message Date
Abdul WahabandCursor cadf6574b9 Fix: scope rounded check to the containing tag (#837)
has_rounded was still line-wide after the spinner skip moved onto containing_markup_tag, so a spinner's rounded-full could make a non-rounded sibling look like a card accent.

Written with AI assistance.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-18 17:12:22 +05:00
Abdul WahabandCursor a45750d2c4 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>
2026-09-18 17:03:18 +05:00
Abdul WahabandCursor 9953435dda Fix: skip border-accent-on-rounded on Tailwind spinners (#837)
The Tailwind matcher treated border-b-2 + rounded-full as a card accent, so the hook flagged the canonical animate-spin spinner. Exempt lines with animate-spin.

Written with AI assistance.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-18 16:55:05 +05:00
+28 -1
View File
@@ -495,6 +495,7 @@ re!(
format!("border(?:Left|Right){WS}*[:=]{WS}*[\"'`]({D}+)px{WS}+solid")
);
re!(BORDER_ACCENT_TW_RE, format!("{B}border-[tb]-({D}+){B}"));
re!(ANIMATE_SPIN_RE, format!("{B}animate-spin{B}"));
re!(
BORDER_ACCENT_CSS_RE,
format!(
@@ -867,7 +868,12 @@ 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,
test: |m, line| {
let scope = containing_markup_tag(line)(m.index);
has_rounded(&scope)
&& num(m.g(1)) >= 1.0
&& !ANIMATE_SPIN_RE.is_match(&scope)
},
fmt: |m, _| m.whole().to_string(),
},
Matcher {
@@ -1457,6 +1463,27 @@ mod tests {
);
}
#[test]
fn border_accent_skips_tailwind_spinner() {
let g = |line: &str| run("border-accent-on-rounded", line);
assert_eq!(
g(r#"<div className="rounded-lg border-t-4 border-blue-500" />"#),
vec!["border-t-4"]
);
assert_eq!(
g(r#"<div className="rounded-full border-b-2" />"#),
vec!["border-b-2"]
);
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"]
);
assert!(g(r#"<div className="animate-spin rounded-full h-12 w-12 border-b-2" /><div className="border-t-4" />"#).is_empty());
}
#[test]
fn dashes() {
assert_eq!(count_em_dashes("a — b -- c ---d"), 2);