Skip to content

Your app looks AI-generated. Vincent Van Gogh noticed. An agent skill that finds and fixes AI-looking UI and UX in mobile apps, web apps, and websites.

fix(detect): flag outline-style none longhand in focus-removed (#253)

daocuong11cd2c172b7a0c
diff --git a/skills/unslop-anything/scripts/detect.js b/skills/unslop-anything/scripts/detect.js
index c5b74fa..51d15ec 100644
--- a/skills/unslop-anything/scripts/detect.js
+++ b/skills/unslop-anything/scripts/detect.js
@@ -1428,6 +1428,9 @@ const rules = [
}
if (!/focus-visible/.test(code)) {
for (const m of matches(/outline:\s*(?:["']?none["']?|0\b)/, code)) hits.push(m.index);
+ // The longhand: `outline-style: none` in CSS and `outlineStyle: "none"`
+ // in a JS style object (#250) remove the focus outline just the same.
+ for (const m of matches(/outline-style\s*:\s*["']?none\b["']?|outlineStyle\s*:\s*["']?none\b["']?/, code)) hits.push(m.index);
}
return hits;
},
diff --git a/test/detect.test.js b/test/detect.test.js
index 8961c8a..0b63be7 100644
--- a/test/detect.test.js
+++ b/test/detect.test.js
@@ -1262,6 +1262,23 @@ test("focus-removed flags outline: none and outline: 0 in JS/TS files (issue #22
assert.deepStrictEqual(lines('<input style={{ outline: "2px solid #2563eb" }} />\n'), []);
});
+test("focus-removed flags outline-style: none and outlineStyle: \"none\" (issue #250)", () => {
+ const lines = (src, file = "Field.tsx") => scanSource(src, file, { kind: "web" }).filter((f) => f.rule === "focus-removed").map((f) => f.line);
+ // Issue #250 repro:
+ assert.deepStrictEqual(lines('export const Field = () => <input style={{ outlineStyle: "none" }} aria-label="Email" />;\n'), [1]);
+ assert.deepStrictEqual(lines("input:focus { outline-style: none; }\n", "field.css"), [1]);
+ assert.deepStrictEqual(lines("<input style={{ outlineStyle: 'none' }} />\n"), [1]);
+ // The quiet cases: a real outline value, and a file with a focus-visible style.
+ assert.deepStrictEqual(lines("input:focus { outline-style: solid; }\n", "field.css"), []);
+ assert.deepStrictEqual(lines('<input style={{ outlineStyle: "auto" }} />\n'), []);
+ assert.deepStrictEqual(
+ lines('export const Field = () => <input style={{ outlineStyle: "none" }} />;\n:focus-visible { outline: 2px solid blue; }\n'),
+ [],
+ );
+ assert.deepStrictEqual(lines('<input style={{ outlineStyle: "none" }} className="focus-visible:ring-2" />\n'), []);
+ assert.deepStrictEqual(lines("input:focus { outline-style: none; } input:focus-visible { outline: 2px solid blue; }\n", "field.css"), []);
+});
+
test("nested-cards ignores dotted subcomponents and ion-card parts, still flags a real nested card", () => {
const rulesFor = (src, file = "a.tsx") => scanSource(src, file).map((f) => f.rule);
// Issue #65: dotted subcomponents of a single card are not nested cards.