The design language that makes your AI harness better at design.
JavaScript
Fix: skip border-accent-on-rounded on Tailwind spinners (#837) (#839)
Abdul Wahabb3251220127e
diff --git a/crates/detect/src/regex_matchers.rs b/crates/detect/src/regex_matchers.rsindex 514541ce7..68f3ab2e4 100644--- a/crates/detect/src/regex_matchers.rs+++ b/crates/detect/src/regex_matchers.rs@@ -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);