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(rules): match pre-SF3 line.horizontal.3 symbol in drawer-nav (#122)

Papito084a2975ba97e3b
diff --git a/skills/unslop-anything/scripts/detect.js b/skills/unslop-anything/scripts/detect.js
index 1540ce1..408d05e 100644
--- a/skills/unslop-anything/scripts/detect.js
+++ b/skills/unslop-anything/scripts/detect.js
@@ -793,7 +793,7 @@ const rules = [
message: "Hamburger menu or navigation drawer. It hides the top destinations behind a tap.",
fix: "Ask first. Use tabs for three to five peer destinations; keep a drawer only for many destinations or a large-screen rail.",
find({ code }) {
- const re = /["']line\.3\.horizontal["']|\bIcons\.(?:Default\.|Filled\.|Outlined\.|Rounded\.|Sharp\.)?Menu\b|\bIcons\.menu\b|name=["']menu(?:-outline)?["']|\bcreateDrawerNavigator\b|from\s+["']expo-router\/drawer["']|\bModalNavigationDrawer\b|\bdrawer:\s*(?:const\s+)?\w*Drawer\b|<ion-menu\b/;
+ const re = /["']line\.(?:3\.horizontal|horizontal\.3)["']|\bIcons\.(?:Default\.|Filled\.|Outlined\.|Rounded\.|Sharp\.)?Menu\b|\bIcons\.menu\b|name=["']menu(?:-outline)?["']|\bcreateDrawerNavigator\b|from\s+["']expo-router\/drawer["']|\bModalNavigationDrawer\b|\bdrawer:\s*(?:const\s+)?\w*Drawer\b|<ion-menu\b/;
const first = matches(re, code).next();
return first.done ? [] : [first.value.index];
},
diff --git a/test/detect.test.js b/test/detect.test.js
index 99f5cd4..4a57397 100644
--- a/test/detect.test.js
+++ b/test/detect.test.js
@@ -1174,3 +1174,18 @@ test("tracked-caps-label catches leading-dot Tailwind tracking and rem letter-sp
[],
);
});
+
+test("drawer-nav catches both line.3.horizontal and older line.horizontal.3 SF Symbols", () => {
+ assert.deepStrictEqual(
+ scanSource('Image(systemName: "line.3.horizontal")', "Menu.swift").map((f) => f.rule),
+ ["drawer-nav"],
+ );
+ assert.deepStrictEqual(
+ scanSource('Image(systemName: "line.horizontal.3")', "Menu.swift").map((f) => f.rule),
+ ["drawer-nav"],
+ );
+ assert.deepStrictEqual(
+ scanSource("// Use line.horizontal.3 in prose without quotes", "Menu.swift"),
+ [],
+ );
+});