From 872c032582ea6474bb3467c99bf83bd0512086e1 Mon Sep 17 00:00:00 2001 From: Paul Bakaus Date: Wed, 29 Jul 2026 14:28:15 -0700 Subject: [PATCH] Ignore rounded-none in border accents AI-assisted change. --- cli/engine/engines/regex/detect-text.mjs | 3 ++- tests/detect-antipatterns.test.js | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/cli/engine/engines/regex/detect-text.mjs b/cli/engine/engines/regex/detect-text.mjs index c664f70b6..03cb0d978 100644 --- a/cli/engine/engines/regex/detect-text.mjs +++ b/cli/engine/engines/regex/detect-text.mjs @@ -12,7 +12,8 @@ import { profileFindings, profileStep } from '../../profile/profiler.mjs'; // Regex fallback (non-HTML files: CSS, JSX, TSX, etc.) // --------------------------------------------------------------------------- -const hasRounded = (line) => /\brounded(?:-\w+)?\b/.test(line); +const hasRounded = (line) => + /\brounded(?:-\w+)?\b/.test(line.replace(/\brounded-none\b/g, '')); const hasBorderRadius = (line) => /border-radius/i.test(line); const isSafeElement = (line) => /<(?:blockquote|nav[\s>]|pre[\s>]|code[\s>]|a\s|input[\s>]|span[\s>])/i.test(line); diff --git a/tests/detect-antipatterns.test.js b/tests/detect-antipatterns.test.js index 8fd08f464..85ae0c2e9 100644 --- a/tests/detect-antipatterns.test.js +++ b/tests/detect-antipatterns.test.js @@ -199,6 +199,22 @@ describe('detectText — Tailwind side-tab', () => { const f = detectText('
', 'test.html'); expect(f.filter(r => r.antipattern === 'border-accent-on-rounded')).toHaveLength(0); }); + + test('ignores border accent paired with rounded-none', () => { + const f = detectText( + '', + 'test.tsx', + ); + expect(f.filter(r => r.antipattern === 'border-accent-on-rounded')).toHaveLength(0); + }); + + test('still detects a real rounded token alongside rounded-none', () => { + const f = detectText( + '
', + 'test.tsx', + ); + expect(f.some(r => r.antipattern === 'border-accent-on-rounded')).toBe(true); + }); }); describe('detectText — CSS borders', () => {