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(drawer-nav): match @expo/vector-icons bars icon name (#351)

Shreeyasshfb5039c3705a
diff --git a/skills/unslop-anything/scripts/detect.js b/skills/unslop-anything/scripts/detect.js
index 9f93566..1983ba7 100644
--- a/skills/unslop-anything/scripts/detect.js
+++ b/skills/unslop-anything/scripts/detect.js
@@ -1196,7 +1196,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|horizontal\.3)["']|\bIcons\.(?:Default\.|Filled\.|Outlined\.|Rounded\.|Sharp\.)?Menu\b|\bIcons\.menu(?:_rounded|_outlined|_sharp)?\b|\b(?:name|icon)=["']menu(?:-outline|-sharp)?["']|\bcreateDrawerNavigator\b|from\s+["']expo-router\/drawer["']|\b(?:Modal|Dismissible)NavigationDrawer\s*\(|\b(?:drawer|endDrawer):\s*(?:const\s+)?\w*Drawer\b|<ion-menu\b|<IonMenu(?:Button|Toggle)?\b|<(?:q-drawer|QDrawer)(?![\w-])|<(?:mat-sidenav|mat-drawer)(?![\w-])|<(?:v-navigation-drawer|VNavigationDrawer)(?![\w-])|\bBars3(?:BottomLeft|BottomRight|CenterLeft)?Icon\b|\bIconMenu2\b/;
+ const re = /["']line\.(?:3\.horizontal|horizontal\.3)["']|\bIcons\.(?:Default\.|Filled\.|Outlined\.|Rounded\.|Sharp\.)?Menu\b|\bIcons\.menu(?:_rounded|_outlined|_sharp)?\b|\b(?:name|icon)=["'](?:menu(?:-outline|-sharp)?|bars)["']|\bcreateDrawerNavigator\b|from\s+["']expo-router\/drawer["']|\b(?:Modal|Dismissible)NavigationDrawer\s*\(|\b(?:drawer|endDrawer):\s*(?:const\s+)?\w*Drawer\b|<ion-menu\b|<IonMenu(?:Button|Toggle)?\b|<(?:q-drawer|QDrawer)(?![\w-])|<(?:mat-sidenav|mat-drawer)(?![\w-])|<(?:v-navigation-drawer|VNavigationDrawer)(?![\w-])|\bBars3(?:BottomLeft|BottomRight|CenterLeft)?Icon\b|\bIconMenu2\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 77da609..83d6de4 100644
--- a/test/detect.test.js
+++ b/test/detect.test.js
@@ -3493,3 +3493,21 @@ test("drawer-nav catches Compose DismissibleNavigationDrawer and ModalNavigation
].join("\n");
assert.deepStrictEqual(drawerLines(unusedImport), []);
});
+
+test("drawer-nav catches @expo/vector-icons bars icon name (issue #337)", () => {
+ const drawerLines = (src, file = "Header.tsx") =>
+ scanSource(src, file, { kind: "mobile" }).filter((f) => f.rule === "drawer-nav").map((f) => f.line);
+
+ for (const attr of [
+ 'name="bars"',
+ "name='bars'",
+ 'icon="bars"',
+ "icon='bars'",
+ 'name="menu"',
+ ]) {
+ assert.deepStrictEqual(drawerLines(`<FontAwesome ${attr} size={24} />\n`), [1], attr);
+ }
+
+ // Prefix-only names stay quiet
+ assert.deepStrictEqual(drawerLines('<FontAwesome name="bars-progress" size={24} />\n'), []);
+});