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 React Native Paper icon="menu" in drawer-nav (#243)

Papito084150fe62693ee
diff --git a/skills/unslop-anything/scripts/detect.js b/skills/unslop-anything/scripts/detect.js
index acc5682..3bf2f38 100644
--- a/skills/unslop-anything/scripts/detect.js
+++ b/skills/unslop-anything/scripts/detect.js
@@ -1175,7 +1175,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|name=["']menu(?:-outline|-sharp)?["']|\bcreateDrawerNavigator\b|from\s+["']expo-router\/drawer["']|\bModalNavigationDrawer\b|\bdrawer:\s*(?:const\s+)?\w*Drawer\b|<ion-menu\b|\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)?["']|\bcreateDrawerNavigator\b|from\s+["']expo-router\/drawer["']|\bModalNavigationDrawer\b|\bdrawer:\s*(?:const\s+)?\w*Drawer\b|<ion-menu\b|\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 ede3863..c08d62b 100644
--- a/test/detect.test.js
+++ b/test/detect.test.js
@@ -1930,6 +1930,32 @@ test("drawer-nav catches Heroicons Bars3Icon and Tabler IconMenu2, not dropdown
assert.deepStrictEqual(lines("<EllipsisVerticalIcon size={24} />\n"), []);
});
+test("drawer-nav catches React Native Paper's icon=\"menu\" (issue #226)", () => {
+ const lines = (src, file = "Header.tsx") => scanSource(src, file, { platform: "mobile" }).filter((f) => f.rule === "drawer-nav").map((f) => [f.line, f.severity]);
+ // Issue #226 repro:
+ const repro = [
+ 'import { Appbar } from "react-native-paper";',
+ "",
+ "export function Header() {",
+ " return (",
+ " <Appbar.Header>",
+ ' <Appbar.Action icon="menu" onPress={openDrawer} />',
+ " </Appbar.Header>",
+ " );",
+ "}",
+ ].join("\n");
+ assert.deepStrictEqual(lines(repro), [[6, "noticeable"]]);
+
+ assert.deepStrictEqual(lines('<IconButton icon="menu" />\n'), [[1, "noticeable"]]);
+ assert.deepStrictEqual(lines("<IconButton icon='menu' />\n"), [[1, "noticeable"]]);
+ assert.deepStrictEqual(lines('<Icon name="menu" />\n'), [[1, "noticeable"]]);
+ assert.deepStrictEqual(lines("<Icon name='menu' />\n"), [[1, "noticeable"]]);
+
+ // Other Paper icons stay quiet
+ assert.deepStrictEqual(lines('<IconButton icon="menu-down" />\n'), []);
+ assert.deepStrictEqual(lines('<Appbar.Action icon="dots-vertical" />\n'), []);
+});
+
test("clickable-div flags Angular (click) and Alpine x-on:click handlers", () => {
const rulesFor = (src) => scanSource(src, "a.html").map((f) => f.rule);
assert.deepStrictEqual(rulesFor('<div class="card" (click)="open()">Details</div>\n'), ["clickable-div"]);